From cb3087542b323ec5bf5db9dc64f0d54dc40cca40 Mon Sep 17 00:00:00 2001 From: mikeb Date: Tue, 2 May 2017 11:47:49 +0000 Subject: [PATCH] Switch glxsb(4), VIA padlock and AES-NI drivers over to the new AES --- sys/arch/amd64/amd64/aesni.c | 4 ++-- sys/arch/amd64/amd64/via.c | 8 ++++---- sys/arch/i386/i386/via.c | 8 ++++---- sys/arch/i386/pci/glxsb.c | 6 +++--- sys/crypto/aes.h | 2 ++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c index dd8dbfd3ed9..b744aaf343d 100644 --- a/sys/arch/amd64/amd64/aesni.c +++ b/sys/arch/amd64/amd64/aesni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aesni.c,v 1.40 2017/02/07 17:25:45 patrick Exp $ */ +/* $OpenBSD: aesni.c,v 1.41 2017/05/02 11:47:49 mikeb Exp $ */ /*- * Copyright (c) 2003 Jason Wright * Copyright (c) 2003, 2004 Theo de Raadt @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c index 53cfe1813f5..35d467eed4c 100644 --- a/sys/arch/amd64/amd64/via.c +++ b/sys/arch/amd64/amd64/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.22 2017/02/07 17:25:45 patrick Exp $ */ +/* $OpenBSD: via.c,v 1.23 2017/05/02 11:47:49 mikeb Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -36,7 +36,7 @@ #ifdef CRYPTO #include -#include +#include #include #include #endif @@ -194,9 +194,9 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri) ses->ses_cw0 = cw0; /* Build expanded keys for both directions */ - rijndaelKeySetupEnc(ses->ses_ekey, c->cri_key, + AES_KeySetup_Encrypt(ses->ses_ekey, c->cri_key, c->cri_klen); - rijndaelKeySetupDec(ses->ses_dkey, c->cri_key, + AES_KeySetup_Decrypt(ses->ses_dkey, c->cri_key, c->cri_klen); for (i = 0; i < 4 * (AES_MAXROUNDS + 1); i++) { ses->ses_ekey[i] = ntohl(ses->ses_ekey[i]); diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c index 2765dc596ec..3fac9abf5cb 100644 --- a/sys/arch/i386/i386/via.c +++ b/sys/arch/i386/i386/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.36 2017/02/07 17:25:45 patrick Exp $ */ +/* $OpenBSD: via.c,v 1.37 2017/05/02 11:47:49 mikeb Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -36,7 +36,7 @@ #ifdef CRYPTO #include -#include +#include #include #include #endif @@ -197,9 +197,9 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri) ses->ses_cw0 = cw0; /* Build expanded keys for both directions */ - rijndaelKeySetupEnc(ses->ses_ekey, c->cri_key, + AES_KeySetup_Encrypt(ses->ses_ekey, c->cri_key, c->cri_klen); - rijndaelKeySetupDec(ses->ses_dkey, c->cri_key, + AES_KeySetup_Decrypt(ses->ses_dkey, c->cri_key, c->cri_klen); for (i = 0; i < 4 * (AES_MAXROUNDS + 1); i++) { ses->ses_ekey[i] = ntohl(ses->ses_ekey[i]); diff --git a/sys/arch/i386/pci/glxsb.c b/sys/arch/i386/pci/glxsb.c index 21786ab4ece..6792e9c99d0 100644 --- a/sys/arch/i386/pci/glxsb.c +++ b/sys/arch/i386/pci/glxsb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxsb.c,v 1.31 2017/02/07 17:25:45 patrick Exp $ */ +/* $OpenBSD: glxsb.c,v 1.32 2017/05/02 11:47:49 mikeb Exp $ */ /* * Copyright (c) 2006 Tom Cosgrove @@ -40,7 +40,7 @@ #ifdef CRYPTO #include -#include +#include #include #include #endif @@ -406,7 +406,7 @@ glxsb_crypto_newsession(uint32_t *sidp, struct cryptoini *cri) return (ENOMEM); } ses->ses_swd_enc = swd; - txf = &enc_xform_rijndael128; + txf = &enc_xform_aes; if (txf->ctxsize > 0) { swd->sw_kschedule = malloc(txf->ctxsize, diff --git a/sys/crypto/aes.h b/sys/crypto/aes.h index f3885c773ef..a670a2b522c 100644 --- a/sys/crypto/aes.h +++ b/sys/crypto/aes.h @@ -26,6 +26,8 @@ #ifndef _AES_H_ #define _AES_H_ +#define AES_MAXROUNDS (14) + typedef struct aes_ctx { uint32_t sk[60]; uint32_t sk_exp[120]; -- 2.20.1