From 1748ed048029763cb758623a7c67ebfa87cc055e Mon Sep 17 00:00:00 2001 From: mikeb Date: Tue, 20 Feb 2018 15:02:13 +0000 Subject: [PATCH] Convert key length from bits to bytes Reported by Renaud Allard, fix tested by Renaud (i386) and fcambus@ (amd64). OK visa, fcambus --- sys/arch/amd64/amd64/via.c | 6 +++--- sys/arch/i386/i386/via.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c index c0e1e540b12..0f8f63f4957 100644 --- a/sys/arch/amd64/amd64/via.c +++ b/sys/arch/amd64/amd64/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.26 2017/12/24 16:19:27 fcambus Exp $ */ +/* $OpenBSD: via.c,v 1.27 2018/02/20 15:02:13 mikeb Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -179,9 +179,9 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri) /* Build expanded keys for both directions */ AES_KeySetup_Encrypt(ses->ses_ekey, c->cri_key, - c->cri_klen); + c->cri_klen / 8); AES_KeySetup_Decrypt(ses->ses_dkey, c->cri_key, - c->cri_klen); + c->cri_klen / 8); for (i = 0; i < 4 * (AES_MAXROUNDS + 1); i++) { ses->ses_ekey[i] = ntohl(ses->ses_ekey[i]); ses->ses_dkey[i] = ntohl(ses->ses_dkey[i]); diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c index 860fa45c0ac..89fd4a39a38 100644 --- a/sys/arch/i386/i386/via.c +++ b/sys/arch/i386/i386/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.40 2017/12/29 13:24:11 fcambus Exp $ */ +/* $OpenBSD: via.c,v 1.41 2018/02/20 15:02:13 mikeb Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -180,9 +180,9 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri) /* Build expanded keys for both directions */ AES_KeySetup_Encrypt(ses->ses_ekey, c->cri_key, - c->cri_klen); + c->cri_klen / 8); AES_KeySetup_Decrypt(ses->ses_dkey, c->cri_key, - c->cri_klen); + c->cri_klen / 8); for (i = 0; i < 4 * (AES_MAXROUNDS + 1); i++) { ses->ses_ekey[i] = ntohl(ses->ses_ekey[i]); ses->ses_dkey[i] = ntohl(ses->ses_dkey[i]); -- 2.20.1