From: Raphaƫl Couturier Date: Sun, 7 Jul 2019 19:24:53 +0000 (+0200) Subject: add openssl hmac X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/4e82257884f5ab73a3add3a448bfc85caa8cbfa5 add openssl hmac --- diff --git a/OneRoundIoT/openssl/Makefile b/OneRoundIoT/openssl/Makefile index 65338fd..34b74d2 100644 --- a/OneRoundIoT/openssl/Makefile +++ b/OneRoundIoT/openssl/Makefile @@ -5,6 +5,7 @@ OBJ2 = pixmap_io.o openssl_evp_cmac.o OBJ3 = pixmap_io.o openssl_evp_ccm.o OBJ4 = pixmap_io.o aesccm.o OBJ5 = pixmap_io.o openssl_evp_gcm.o +OBJ6 = pixmap_io.o openssl_evp_hmac.o openssl_evp: $(OBJ) $(C) -o $@ $^ $(CFLAGS) @@ -22,6 +23,10 @@ aesccm: $(OBJ4) openssl_evp_gcm: $(OBJ5) $(C) -o $@ $^ $(CFLAGS) +openssl_evp_hmac: $(OBJ6) + $(C) -o $@ $^ $(CFLAGS) + + %.o: %.c $(C) -c -o $@ $< -O3 diff --git a/OneRoundIoT/openssl/openssl_evp_hmac.c b/OneRoundIoT/openssl/openssl_evp_hmac.c new file mode 100644 index 0000000..eae5d01 --- /dev/null +++ b/OneRoundIoT/openssl/openssl_evp_hmac.c @@ -0,0 +1,333 @@ +//gcc pixmap_io.c -c +//gcc openssl_evp.c pixmap_io.o -o openssl_evp -I /usr/include/openssl/ -lcrypto -O3 -std=c99 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pixmap_io.h" + +typedef unsigned char uchar; + +int nb_test=1; +int ctr=0; + +double TimeStart() +{ + struct timeval tstart; + gettimeofday(&tstart,0); + return( (double) (tstart.tv_sec + tstart.tv_usec*1e-6) ); +} + +double TimeStop(double t) +{ + struct timeval tend; + + gettimeofday(&tend,0); + t = (double) (tend.tv_sec + tend.tv_usec*1e-6) - t; + return (t); +} + + +void printBytes(unsigned char *buf, size_t len) { + for(int i=0; i