From: Luke Kenneth Casson Leighton Date: Sun, 1 Jan 2023 15:37:33 +0000 (+0000) Subject: ascii dump on xchacha20 to compare against x86 version X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9eccc278fc2a469bc92a2032a5c9b2ff0dd3a525;p=openpower-isa.git ascii dump on xchacha20 to compare against x86 version --- diff --git a/crypto/chacha20/Makefile b/crypto/chacha20/Makefile index ef18a75a..fb64bfa5 100644 --- a/crypto/chacha20/Makefile +++ b/crypto/chacha20/Makefile @@ -10,7 +10,7 @@ LFLAGS = -Wall SRCDIR = src -SOURCES := $(wildcard $(SRCDIR)/*.c) +SOURCES := $(SRCDIR)/xchacha20.c $(SRCDIR)/test.c INCLUDES := $(wildcard $(SRCDIR)/*.h)) OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(SRCDIR)/%.o) diff --git a/crypto/chacha20/src/svp64test.c b/crypto/chacha20/src/svp64test.c index 3e081137..d12af4b6 100644 --- a/crypto/chacha20/src/svp64test.c +++ b/crypto/chacha20/src/svp64test.c @@ -59,7 +59,9 @@ int check_cpp(void){ uint8_t plaintext[] = "My Plaintext!! My Dear plaintext!!!"; uint32_t msglen = strlen((char *)plaintext); + /* knock one byte off the end */ plaintext[msglen-1] = 0; + msglen -= 1; xchacha_keysetup(&ctx, key, iv); diff --git a/crypto/chacha20/src/test.c b/crypto/chacha20/src/test.c index 2dfa4c1a..9562fbf3 100644 --- a/crypto/chacha20/src/test.c +++ b/crypto/chacha20/src/test.c @@ -45,9 +45,13 @@ int check_cpp(void){ 0x6C, 0x72 }; - uint8_t plaintext[] = "My Plaintext!! My Dear plaintext!!"; + uint8_t plaintext[] = "My Plaintext!! My Dear plaintext!!!"; uint32_t msglen = strlen((char *)plaintext); + /* knock one byte off the end */ + plaintext[msglen-1] = 0; + msglen -= 1; + /* Allocate a buffer to hold our calculated ciphertext */ if((buffer = malloc(50 * sizeof(uint8_t))) == NULL){ perror("malloc() error"); diff --git a/src/openpower/decoder/isa/pypowersim.py b/src/openpower/decoder/isa/pypowersim.py index bcbf8e9f..4cb32a6b 100644 --- a/src/openpower/decoder/isa/pypowersim.py +++ b/src/openpower/decoder/isa/pypowersim.py @@ -405,7 +405,7 @@ def run_simulation(): print ("SPRs") simulator.spr.dump() print ("Mem") - simulator.mem.dump() + simulator.mem.dump(asciidump=True) for fname, offs, length in write_to: write_data(simulator.mem, fname, offs, length)