Source-Changes-HG archive

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

[src/trunk]: src/regress/sys/crypto/cast128 regress test for shorter keys. s...



details:   https://anonhg.NetBSD.org/src/rev/61e333919332
branches:  trunk
changeset: 518304:61e333919332
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Nov 28 03:16:06 2001 +0000

description:
regress test for shorter keys.  sync with kame

diffstat:

 regress/sys/crypto/cast128/casttest.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 571ad7631e24 -r 61e333919332 regress/sys/crypto/cast128/casttest.c
--- a/regress/sys/crypto/cast128/casttest.c     Wed Nov 28 03:03:43 2001 +0000
+++ b/regress/sys/crypto/cast128/casttest.c     Wed Nov 28 03:16:06 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: casttest.c,v 1.3 2001/11/28 00:52:24 itojun Exp $      */
-/*     $KAME: casttest.c,v 1.2 2000/11/08 05:58:25 itojun Exp $        */
+/*     $NetBSD: casttest.c,v 1.4 2001/11/28 03:16:06 itojun Exp $      */
+/*     $KAME: casttest.c,v 1.5 2001/11/28 03:14:03 itojun Exp $        */
 
 /*
  * Copyright (C) 2000 WIDE Project.
@@ -158,12 +158,17 @@
 again:
 
        for (z = 0; z < 3; z++) {
+#if 0
                if (k_len[z] != 16)
                        continue;
+#endif
 
                set_cast128_subkey(subkey, k, k_len[z]);
 
-               cast128_encrypt_round16(out, in, subkey);
+               if (k_len[z] * 8 <= 80)
+                       cast128_encrypt_round12(out, in, subkey);
+               else
+                       cast128_encrypt_round16(out, in, subkey);
 
                if (memcmp(out, c[z], 8) != 0) {
                        printf("ecb cast error encrypting for keysize %d\n",
@@ -179,7 +184,10 @@
                        printf("\n");
                }
 
-               cast128_decrypt_round16(out, out, subkey);
+               if (k_len[z] * 8 <= 80)
+                       cast128_decrypt_round12(out, out, subkey);
+               else
+                       cast128_decrypt_round16(out, out, subkey);
                if (memcmp(out, in, 8) != 0) {
                        printf("ecb cast error decrypting for keysize %d\n",
                            k_len[z] * 8);



Home | Main Index | Thread Index | Old Index