rijndael is assymmetric, correction from markus@openbsd
This commit is contained in:
parent
b1597d221a
commit
7b74887942
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: esp_rijndael.c,v 1.10 2003/07/15 11:00:36 itojun Exp $ */
|
||||
/* $NetBSD: esp_rijndael.c,v 1.11 2003/07/15 15:25:13 itojun Exp $ */
|
||||
/* $KAME: esp_rijndael.c,v 1.4 2001/03/02 05:53:05 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: esp_rijndael.c,v 1.10 2003/07/15 11:00:36 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: esp_rijndael.c,v 1.11 2003/07/15 15:25:13 itojun Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: esp_rijndael.c,v 1.10 2003/07/15 11:00:36 itojun Exp
|
|||
#include <net/net_osdep.h>
|
||||
|
||||
/* as rijndael uses assymetric scheduled keys, we need to do it twice. */
|
||||
|
||||
typedef struct {
|
||||
u_int32_t r_ek[(RIJNDAEL_MAXNR+1)*4];
|
||||
u_int32_t r_dk[(RIJNDAEL_MAXNR+1)*4];
|
||||
|
@ -78,8 +79,8 @@ esp_rijndael_schedule(algo, sav)
|
|||
if ((ctx->r_nr = rijndaelKeySetupEnc(ctx->r_ek,
|
||||
(char *)_KEYBUF(sav->key_enc), _KEYLEN(sav->key_enc) * 8)) == 0)
|
||||
return -1;
|
||||
if ((ctx->r_nr = rijndaelKeySetupDec(ctx->r_dk,
|
||||
(char *)_KEYBUF(sav->key_enc), _KEYLEN(sav->key_enc) * 8)) == 0)
|
||||
if (rijndaelKeySetupDec(ctx->r_dk, (char *)_KEYBUF(sav->key_enc),
|
||||
_KEYLEN(sav->key_enc) * 8) == 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -108,6 +109,6 @@ esp_rijndael_blockencrypt(algo, sav, s, d)
|
|||
rijndael_ctx *ctx;
|
||||
|
||||
ctx = (rijndael_ctx *)sav->sched;
|
||||
rijndaelEncrypt(ctx->r_dk, ctx->r_nr, s, d);
|
||||
rijndaelEncrypt(ctx->r_ek, ctx->r_nr, s, d);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue