Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/crypto/rijndael check and panic if key with wrong dir is...



details:   https://anonhg.NetBSD.org/src/rev/21947f46f5a0
branches:  trunk
changeset: 551003:21947f46f5a0
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Aug 27 02:44:19 2003 +0000

description:
check and panic if key with wrong dir is passed

diffstat:

 sys/crypto/rijndael/rijndael.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 5a70f643975b -r 21947f46f5a0 sys/crypto/rijndael/rijndael.c
--- a/sys/crypto/rijndael/rijndael.c    Wed Aug 27 02:42:09 2003 +0000
+++ b/sys/crypto/rijndael/rijndael.c    Wed Aug 27 02:44:19 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rijndael.c,v 1.3 2003/08/26 20:07:59 thorpej Exp $     */
+/*     $NetBSD: rijndael.c,v 1.4 2003/08/27 02:44:19 itojun Exp $      */
 
 /**             
  * rijndael-alg-fst.c 
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rijndael.c,v 1.3 2003/08/26 20:07:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rijndael.c,v 1.4 2003/08/27 02:44:19 itojun Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -52,6 +52,8 @@
 rijndael_decrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst)
 {
 
+       if (!ctx->decrypt)
+               panic("rijndael_decrypt: decryption context is passed");
        rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
 }
 
@@ -59,5 +61,7 @@
 rijndael_encrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst)
 {
 
+       if (ctx->decrypt)
+               panic("rijndael_encrypt: decryption context is passed");
        rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);
 }



Home | Main Index | Thread Index | Old Index