From: mikeb Date: Tue, 2 May 2017 11:46:00 +0000 (+0000) Subject: Sync GMAC and AES-CTR/-XTS regress tests with the new AES code X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=eb5970ec1ae6f1dcb31f0256267b792a0bfffee7;p=openbsd Sync GMAC and AES-CTR/-XTS regress tests with the new AES code ok djm --- diff --git a/regress/sys/crypto/aesctr/Makefile b/regress/sys/crypto/aesctr/Makefile index b1417864a2e..5de38f38802 100644 --- a/regress/sys/crypto/aesctr/Makefile +++ b/regress/sys/crypto/aesctr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2016/09/02 11:20:48 mikeb Exp $ +# $OpenBSD: Makefile,v 1.4 2017/05/02 11:46:00 mikeb Exp $ DIR= ${.CURDIR}/../../../../sys @@ -20,7 +20,7 @@ CDIAGFLAGS+= -Wshadow REGRESS_ROOT_TARGETS= run-regress-${PROG} .PATH: ${DIR}/crypto -SRCS+= cast.c ecb_enc.c ecb3_enc.c gmac.c rijndael.c set_key.c +SRCS+= cast.c ecb_enc.c ecb3_enc.c gmac.c aes.c set_key.c SRCS+= chachapoly.c poly1305.c SRCS+= xform.c diff --git a/regress/sys/crypto/aesctr/aesctr.c b/regress/sys/crypto/aesctr/aesctr.c index a7107331a8d..0c2e605193c 100644 --- a/regress/sys/crypto/aesctr/aesctr.c +++ b/regress/sys/crypto/aesctr/aesctr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aesctr.c,v 1.2 2014/08/15 14:39:04 mikeb Exp $ */ +/* $OpenBSD: aesctr.c,v 1.3 2017/05/02 11:46:00 mikeb Exp $ */ /* * Copyright (c) 2005 Markus Friedl @@ -17,7 +17,7 @@ */ #include -#include +#include #include #include #include @@ -151,9 +151,8 @@ explicit_bzero(void *b, size_t len) #define AESCTR_BLOCKSIZE 16 struct aes_ctr_ctx { - u_int32_t ac_ek[4*(AES_MAXROUNDS + 1)]; + AES_CTX ac_key; u_int8_t ac_block[AESCTR_BLOCKSIZE]; - int ac_nr; }; int aes_ctr_setkey(void *, u_int8_t *, int); @@ -182,7 +181,6 @@ docrypt(const unsigned char *key, size_t klen, const unsigned char *iv, out += AESCTR_BLOCKSIZE; } return 0; - } static int @@ -242,7 +240,7 @@ run(int num) if (docrypt(data[TST_KEY], length[TST_KEY], data[TST_IV], data[TST_PLAIN], p, length[TST_PLAIN], 0) < 0) { - warnx("crypt with /dev/crypto failed"); + warnx("encryption failed"); goto done; } fail = !match(data[TST_CIPHER], p, len); diff --git a/regress/sys/crypto/aesxts/Makefile b/regress/sys/crypto/aesxts/Makefile index 4e1040c536a..4c47348d9c8 100644 --- a/regress/sys/crypto/aesxts/Makefile +++ b/regress/sys/crypto/aesxts/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2016/09/02 11:22:23 mikeb Exp $ +# $OpenBSD: Makefile,v 1.5 2017/05/02 11:46:00 mikeb Exp $ DIR= ${.CURDIR}/../../../../sys @@ -20,7 +20,7 @@ CDIAGFLAGS+= -Wshadow REGRESS_TARGETS= run-regress-${PROG} .PATH: ${DIR}/crypto -SRCS+= cast.c ecb_enc.c ecb3_enc.c gmac.c rijndael.c set_key.c +SRCS+= cast.c ecb_enc.c ecb3_enc.c gmac.c aes.c set_key.c SRCS+= chachapoly.c poly1305.c SRCS+= xform.c diff --git a/regress/sys/crypto/aesxts/aes_xts.c b/regress/sys/crypto/aesxts/aes_xts.c index 77a64108498..861d143bac6 100644 --- a/regress/sys/crypto/aesxts/aes_xts.c +++ b/regress/sys/crypto/aesxts/aes_xts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aes_xts.c,v 1.2 2013/10/06 16:59:34 jsing Exp $ */ +/* $OpenBSD: aes_xts.c,v 1.3 2017/05/02 11:46:00 mikeb Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserved. @@ -26,7 +26,7 @@ */ #include -#include +#include #include #include #include @@ -37,8 +37,8 @@ #define AES_XTS_BLOCKSIZE 16 struct aes_xts_ctx { - rijndael_ctx key1; - rijndael_ctx key2; + AES_CTX key1; + AES_CTX key2; u_int8_t tweak[AES_XTS_BLOCKSIZE]; }; diff --git a/regress/sys/crypto/gmac/Makefile b/regress/sys/crypto/gmac/Makefile index 9e687f53e20..35f6776304a 100644 --- a/regress/sys/crypto/gmac/Makefile +++ b/regress/sys/crypto/gmac/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.2 2014/01/18 05:54:52 martynas Exp $ +# $OpenBSD: Makefile,v 1.3 2017/05/02 11:46:00 mikeb Exp $ DIR=${.CURDIR}/../../../../sys PROG= gmac_test -SRCS+= rijndael.c gmac.c gmac_test.c +SRCS+= aes.c gmac.c gmac_test.c CDIAGFLAGS= -Wall CDIAGFLAGS+= -Werror CDIAGFLAGS+= -Wpointer-arith diff --git a/regress/sys/crypto/gmac/gmac_test.c b/regress/sys/crypto/gmac/gmac_test.c index 90732976d34..1286b8b63ad 100644 --- a/regress/sys/crypto/gmac/gmac_test.c +++ b/regress/sys/crypto/gmac/gmac_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gmac_test.c,v 1.4 2017/03/07 16:11:34 inoguchi Exp $ */ +/* $OpenBSD: gmac_test.c,v 1.5 2017/05/02 11:46:00 mikeb Exp $ */ /* * Copyright (c) 2010 Mike Belopuhov @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include