Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/crypto/rijndael Ensure that the IV is aligned for strict...
details: https://anonhg.NetBSD.org/src/rev/093031d1530f
branches: trunk
changeset: 550700:093031d1530f
user: elric <elric%NetBSD.org@localhost>
date: Mon Aug 18 02:36:17 2003 +0000
description:
Ensure that the IV is aligned for strict alignment machines.
diffstat:
sys/crypto/rijndael/rijndael-api-fst.c | 14 +++++++-------
sys/crypto/rijndael/rijndael-api-fst.h | 5 +++--
2 files changed, 10 insertions(+), 9 deletions(-)
diffs (83 lines):
diff -r 08ada53f2073 -r 093031d1530f sys/crypto/rijndael/rijndael-api-fst.c
--- a/sys/crypto/rijndael/rijndael-api-fst.c Mon Aug 18 00:28:11 2003 +0000
+++ b/sys/crypto/rijndael/rijndael-api-fst.c Mon Aug 18 02:36:17 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rijndael-api-fst.c,v 1.16 2003/07/24 14:51:34 itojun Exp $ */
+/* $NetBSD: rijndael-api-fst.c,v 1.17 2003/08/18 02:36:17 elric Exp $ */
/**
* rijndael-api-fst.c
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rijndael-api-fst.c,v 1.16 2003/07/24 14:51:34 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rijndael-api-fst.c,v 1.17 2003/08/18 02:36:17 elric Exp $");
#include <sys/param.h>
#ifdef _KERNEL
@@ -126,7 +126,7 @@
break;
case MODE_CBC:
- iv = cipher->IV;
+ iv = (u_int8_t *)cipher->IV;
for (i = numBlocks; i > 0; i--) {
((u_int32_t*)block)[0] = ((u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0];
((u_int32_t*)block)[1] = ((u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1];
@@ -140,7 +140,7 @@
break;
case MODE_CFB1:
- iv = cipher->IV;
+ iv = (u_int8_t *)cipher->IV;
for (i = numBlocks; i > 0; i--) {
memcpy(outBuffer, input, 16);
for (k = 0; k < 128; k++) {
@@ -202,7 +202,7 @@
break;
case MODE_CBC:
- iv = cipher->IV;
+ iv = (u_int8_t *)cipher->IV;
for (i = numBlocks; i > 0; i--) {
((u_int32_t*)block)[0] = ((u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0];
((u_int32_t*)block)[1] = ((u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1];
@@ -256,7 +256,7 @@
break;
case MODE_CBC:
- iv = cipher->IV;
+ iv = (u_int8_t *)cipher->IV;
for (i = numBlocks; i > 0; i--) {
rijndaelDecrypt(key->rk, key->Nr, input, block);
((u_int32_t*)block)[0] ^= ((u_int32_t*)iv)[0];
@@ -271,7 +271,7 @@
break;
case MODE_CFB1:
- iv = cipher->IV;
+ iv = (u_int8_t *)cipher->IV;
for (i = numBlocks; i > 0; i--) {
memcpy(outBuffer, input, 16);
for (k = 0; k < 128; k++) {
diff -r 08ada53f2073 -r 093031d1530f sys/crypto/rijndael/rijndael-api-fst.h
--- a/sys/crypto/rijndael/rijndael-api-fst.h Mon Aug 18 00:28:11 2003 +0000
+++ b/sys/crypto/rijndael/rijndael-api-fst.h Mon Aug 18 02:36:17 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rijndael-api-fst.h,v 1.5 2003/07/16 05:08:09 itojun Exp $ */
+/* $NetBSD: rijndael-api-fst.h,v 1.6 2003/08/18 02:36:17 elric Exp $ */
/**
* rijndael-api-fst.h
@@ -83,8 +83,9 @@
/* The structure for cipher information */
typedef struct { /* changed order of the components */
+ u_int32_t IV[RIJNDAEL_MAX_IV_SIZE / sizeof(u_int32_t)];
+ /* A possible Initialization Vector for ciphering */
BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
- BYTE IV[RIJNDAEL_MAX_IV_SIZE]; /* A possible Initialization Vector for ciphering */
} cipherInstance;
/* Function prototypes */
Home |
Main Index |
Thread Index |
Old Index