Commit d0d1814b authored by Niels Möller's avatar Niels Möller
Browse files

*** empty log message ***

Rev: ChangeLog:1.202
Rev: src/abstract_crypto.c:1.14
Rev: src/abstract_crypto.h:1.28
Rev: src/testsuite/.cvsignore:1.5
Rev: src/testsuite/md5-test.m4:1.1
Rev: src/testsuite/sha1-test.m4:1.1
Rev: src/testsuite/twofish-test.m4:1.2
parent bbadabd4
2000-05-29 Niels Mller <nisse@lysator.liu.se>
* src/testsuite/macros.m4 (TS_STRING): Ignore newlines in hex
literals.
(TS_TEST_STRING_EQ): Construct values only once.
(TS_TEST_HMAC): New macro.
* src/testsuite/Makefile.am (TS_PROGS): Added sha1-test and
m5-test.
* src/testsuite/sha1-test.m4: New file.
* src/testsuite/md5-test.m4: New file.
* src/digit_table.c (main): There's no hex digit with the value
16.
* src/abstract_crypto.c (mac_string): New function.
2000-05-28 Niels Mller <nisse@cuckoo.localdomain>
* src/werror.c (werror_hexdump): Include an ascii column in the
......
......@@ -75,7 +75,6 @@ struct crypto_algorithm *crypto_invert(struct crypto_algorithm *inner)
return &algorithm->super;
}
struct lsh_string *
hash_string(struct hash_algorithm *a,
struct lsh_string *in,
......@@ -94,6 +93,29 @@ hash_string(struct hash_algorithm *a,
return out;
}
struct lsh_string *
mac_string(struct mac_algorithm *a,
struct lsh_string *key,
int kfree,
struct lsh_string *in,
int ifree)
{
struct mac_instance *mac = MAKE_MAC(a, key->length, key->data);
struct lsh_string *out = lsh_string_alloc(mac->mac_size);
HASH_UPDATE(mac, in->length, in->data);
HASH_DIGEST(mac, out->data);
KILL(mac);
if (kfree)
lsh_string_alloc(key);
if (ifree)
lsh_string_free(in);
return out;
}
struct lsh_string *
crypt_string(struct crypto_instance *c,
struct lsh_string *in,
......
......@@ -209,6 +209,13 @@ hash_string(struct hash_algorithm *a,
struct lsh_string *in,
int free);
struct lsh_string *
mac_string(struct mac_algorithm *a,
struct lsh_string *key,
int kfree,
struct lsh_string *in,
int ifree);
struct lsh_string *
crypt_string(struct crypto_instance *c,
struct lsh_string *in,
......
......@@ -5,6 +5,10 @@ des-test
des-test.c
foo
foo.pub
md5-test
md5-test.c
sha1-test
sha1-test.c
spki-tag-test
spki-tag-test.c
twofish-test
......
......@@ -5,6 +5,10 @@
/des-test.c
/foo
/foo.pub
/md5-test
/md5-test.c
/sha1-test
/sha1-test.c
/spki-tag-test
/spki-tag-test.c
/twofish-test
......
/* Test vectors from RFC 1321 */
TS_TEST_HASH(MD5-1, &md5_algorithm,
"",
#D41D8CD98F00B204 E9800998ECF8427E#)
TS_TEST_HASH(MD5-2, &md5_algorithm,
"a",
#0CC175B9C0F1B6A8 31C399E269772661#)
TS_TEST_HASH(MD5-3, &md5_algorithm,
"abc",
#900150983cd24fb0 D6963F7D28E17F72#)
TS_TEST_HASH(MD5-4, &md5_algorithm,
"message digest",
#F96B697D7CB7938D 525A2F31AAF161D0#)
TS_TEST_HASH(MD5-5, &md5_algorithm,
"abcdefghijklmnopqrstuvwxyz",
#C3FCD3D76192E400 7DFB496CCA67E13B#)
TS_TEST_HASH(MD5-6, &md5_algorithm,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
#D174AB98D277D9F5 A5611C2C9F419D9F#)
TS_TEST_HASH(MD5-7, &md5_algorithm,
"1234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890",
#57EDF4A22BE3C955 AC49DA2E2107B67A#)
/* Test vectors for md5 from RFC-2202 */
TS_TEST_HMAC(HMAC-MD5-1, &md5_algorithm,
#0b0b0b0b0b0b0b0b 0b0b0b0b0b0b0b0b#,
"Hi There",
#9294727A3638BB1C 13F48EF8158BFC9D#)
TS_TEST_HMAC(HMAC-MD5-2, &md5_algorithm,
"Jefe",
"what do ya want for nothing?",
#750C783E6AB0B503 EAA86E310A5DB738#)
TS_TEST_HMAC(HMAC-MD5-3, &md5_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
#DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDD#,
#56BE34521D144C88 DBB8C733F0E8B3F6#)
TS_TEST_HMAC(HMAC-MD5-4, &md5_algorithm,
#0102030405060708 090A0B0C0D0E0F10 1112131415161718 19#,
#CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCD#,
#697EAF0ACA3A3AEA 3A75164746FFAA79#)
TS_TEST_HMAC(HMAC-MD5-5, &md5_algorithm,
#0C0C0C0C0C0C0C0C 0C0C0C0C0C0C0C0C#,
"Test With Truncation",
#56461EF2342EDC00 F9BAB995690EFD4C#)
TS_TEST_HMAC(HMAC-MD5-6, &md5_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
"Test Using Larger Than Block-Size Key - Hash Key First",
#6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd#)
TS_TEST_HMAC(HMAC-MD5-7, &md5_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
"Test Using Larger Than Block-Size Key an"
"d Larger Than One Block-Size Data",
#6f630fad67cda0ee1fb1f562db3aa53e#)
TS_TEST_HASH(SHA1, &sha1_algorithm,
"abc",
#A9993E364706816A BA3E25717850C26C 9CD0D89D#)
/* Test vectors for sha1 from RFC-2202, and some more */
TS_TEST_HMAC(HMAC-SHA1-0, &sha1_algorithm,
#0b0b0b0b0b0b0b0b 0b0b0b0b0b0b0b0b#,
"Hi There",
#675B0B3A1B4DDF4E 124872DA6C2F632B FED957E9#)
TS_TEST_HMAC(HMAC-SHA1-1, &sha1_algorithm,
#0b0b0b0b0b0b0b0b 0b0b0b0b0b0b0b0b 0b0b0b0b#,
"Hi There",
#B617318655057264 E28BC0B6FB378C8E F146BE00#)
TS_TEST_HMAC(HMAC-SHA1-2, &sha1_algorithm,
"Jefe",
"what do ya want for nothing?",
#EFFCDF6AE5EB2FA2 D27416D5F184DF9C 259A7C79#)
TS_TEST_HMAC(HMAC-SHA1-3a, &sha1_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
#DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDD#,
#D730594D167E35D5 956FD8003D0DB3D3 F46DC7BB#)
TS_TEST_HMAC(HMAC-SHA1-3, &sha1_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA AAAAAAAA#,
#DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD
DDDD#,
#125D7342B9AC11CD 91A39AF48AA17B4F 63F175D3#)
TS_TEST_HMAC(HMAC-SHA1-4, &sha1_algorithm,
#0102030405060708 090A0B0C0D0E0F10 1112131415161718 19#,
#CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCD CDCDCDCDCDCDCDCD
CDCD#,
#4C9007F4026250C6 BC8414F9BF50C86C 2D7235DA#)
TS_TEST_HMAC(HMAC-SHA1-5, &sha1_algorithm,
#0C0C0C0C0C0C0C0C 0C0C0C0C0C0C0C0C 0C0C0C0C#,
"Test With Truncation",
#4C1A03424B55E07F E7F27BE1D58BB932 4A9A5A04#)
TS_TEST_HMAC(HMAC-SHA1-6, &sha1_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
"Test Using Larger Than Block-Size Key - Hash Key First",
#AA4AE5E15272D00E 95705637CE8A3B55 ED402112#)
TS_TEST_HMAC(HMAC-SHA1-7, &sha1_algorithm,
#AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA#,
"Test Using Larger Than Block-Size Key an"
"d Larger Than One Block-Size Data",
#E8E99D0F45237D78 6D6BBAA7965C7808 BBFF1A91#)
......@@ -9,7 +9,8 @@ TS_TEST_CRYPTO(
#CFD1D2E5A9BE9CDF 501F13B892BD2248#)
TS_TEST_CRYPTO(Twofish 256, make_twofish_algorithm(32),
#0123456789ABCDEF FEDCBA9876543210 0011223344556677 8899AABBCCDDEEFF#,
#0123456789ABCDEF FEDCBA9876543210 0011223344556677
8899AABBCCDDEEFF#,
#0000000000000000 0000000000000000#,
#37527BE0052334B8 9F0CFCCAE87CFA20#)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment