Switch glxsb(4), VIA padlock and AES-NI drivers over to the new AES
authormikeb <mikeb@openbsd.org>
Tue, 2 May 2017 11:47:49 +0000 (11:47 +0000)
committermikeb <mikeb@openbsd.org>
Tue, 2 May 2017 11:47:49 +0000 (11:47 +0000)
sys/arch/amd64/amd64/aesni.c
sys/arch/amd64/amd64/via.c
sys/arch/i386/i386/via.c
sys/arch/i386/pci/glxsb.c
sys/crypto/aes.h

index dd8dbfd..b744aaf 100644 (file)
@@ -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 <sys/mbuf.h>
 
 #include <crypto/cryptodev.h>
-#include <crypto/rijndael.h>
+#include <crypto/aes.h>
 #include <crypto/gmac.h>
 #include <crypto/xform.h>
 #include <crypto/cryptosoft.h>
index 53cfe18..35d467e 100644 (file)
@@ -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 <crypto/cryptodev.h>
-#include <crypto/rijndael.h>
+#include <crypto/aes.h>
 #include <crypto/xform.h>
 #include <crypto/cryptosoft.h>
 #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]);
index 2765dc5..3fac9ab 100644 (file)
@@ -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 <crypto/cryptodev.h>
-#include <crypto/rijndael.h>
+#include <crypto/aes.h>
 #include <crypto/xform.h>
 #include <crypto/cryptosoft.h>
 #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]);
index 21786ab..6792e9c 100644 (file)
@@ -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 <tom@openbsd.org>
@@ -40,7 +40,7 @@
 
 #ifdef CRYPTO
 #include <crypto/cryptodev.h>
-#include <crypto/rijndael.h>
+#include <crypto/aes.h>
 #include <crypto/xform.h>
 #include <crypto/cryptosoft.h>
 #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,
index f3885c7..a670a2b 100644 (file)
@@ -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];