diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-04-09 04:34:57 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-04-09 04:34:57 +0000 |
commit | 3586fa848c7b3df684c463a0243f9452d0317424 (patch) | |
tree | d2f40f5ef38a97a180f7c5226068e90451c77d56 | |
parent | 7a9621f657ec871ffbe83307a4e7a8403aad7731 (diff) |
Move some AES-related defines into xform.h to reduce duplication.
gmac.c is left untouched for now to preserve layering.
OK mikeb@, deraadt@
-rw-r--r-- | sys/arch/amd64/amd64/aesni.c | 11 | ||||
-rw-r--r-- | sys/crypto/xform.c | 10 | ||||
-rw-r--r-- | sys/crypto/xform.h | 10 |
3 files changed, 11 insertions, 20 deletions
diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c index e2e4ffd7b1b..ce2808cbfc6 100644 --- a/sys/arch/amd64/amd64/aesni.c +++ b/sys/arch/amd64/amd64/aesni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aesni.c,v 1.43 2018/02/23 15:41:08 visa Exp $ */ +/* $OpenBSD: aesni.c,v 1.44 2018/04/09 04:34:56 visa Exp $ */ /*- * Copyright (c) 2003 Jason Wright * Copyright (c) 2003, 2004 Theo de Raadt @@ -34,15 +34,6 @@ #include <machine/fpu.h> -/* defines from crypto/xform.c */ -#define AESCTR_NONCESIZE 4 -#define AESCTR_IVSIZE 8 -#define AESCTR_BLOCKSIZE 16 - -#define AES_XTS_BLOCKSIZE 16 -#define AES_XTS_IVSIZE 8 -#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ - struct aesni_aes_ctx { uint32_t aes_ekey[4 * (AES_MAXROUNDS + 1)]; uint32_t aes_dkey[4 * (AES_MAXROUNDS + 1)]; diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c index f94a44eab27..96db2bb699b 100644 --- a/sys/crypto/xform.c +++ b/sys/crypto/xform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.c,v 1.58 2017/05/31 00:34:33 djm Exp $ */ +/* $OpenBSD: xform.c,v 1.59 2018/04/09 04:34:56 visa Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -108,19 +108,11 @@ u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **); u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **); u_int32_t lzs_dummy(u_int8_t *, u_int32_t, u_int8_t **); -#define AESCTR_NONCESIZE 4 -#define AESCTR_IVSIZE 8 -#define AESCTR_BLOCKSIZE 16 - struct aes_ctr_ctx { AES_CTX ac_key; u_int8_t ac_block[AESCTR_BLOCKSIZE]; }; -#define AES_XTS_BLOCKSIZE 16 -#define AES_XTS_IVSIZE 8 -#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ - struct aes_xts_ctx { rijndael_ctx key1; rijndael_ctx key2; diff --git a/sys/crypto/xform.h b/sys/crypto/xform.h index 7e3e5913dd4..41fc36ca235 100644 --- a/sys/crypto/xform.h +++ b/sys/crypto/xform.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.h,v 1.29 2017/05/02 11:44:32 mikeb Exp $ */ +/* $OpenBSD: xform.h,v 1.30 2018/04/09 04:34:56 visa Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -30,6 +30,14 @@ #include <crypto/sha2.h> #include <crypto/gmac.h> +#define AESCTR_NONCESIZE 4 +#define AESCTR_IVSIZE 8 +#define AESCTR_BLOCKSIZE 16 + +#define AES_XTS_BLOCKSIZE 16 +#define AES_XTS_IVSIZE 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + /* Declarations */ struct auth_hash { int type; |