From c576914adfd66801565a743b211cd8256627c48d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Wed, 5 Sep 2001 19:05:36 +0200 Subject: [PATCH] *** empty log message *** Rev: src/nettle/ChangeLog:1.15 Rev: src/nettle/des-compat.h:1.1 Rev: src/nettle/testsuite/.cvsignore:1.6 Rev: src/nettle/testsuite/md5-compat-test.m4:1.1 --- ChangeLog | 14 +++++++++ des-compat.h | 33 +++++++++++++++++++++ testsuite/.cvsignore | 2 ++ testsuite/.gitignore | 2 ++ testsuite/md5-compat-test.m4 | 56 ++++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 des-compat.h create mode 100644 testsuite/md5-compat-test.m4 diff --git a/ChangeLog b/ChangeLog index e791e1eb..81aa8d1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-09-05 Niels M�ller <nisse@ehand.com> + + * testsuite/Makefile.am (TS_PROGS): Added md5-compat-test. + + * README: Copied introduction from the manual. + + * configure.in: Bumped version to 1.0. + + * Makefile.am (libnettleinclude_HEADERS): Added missing includes. + (libnettle_a_SOURCES): Added md5-compat.c and md5-compat.h. + + * md5-compat.c, md5-compat.h: New files, implementing an RFC + 1321-style interface. + 2001-09-02 Niels M�ller <nisse@cuckoo.hack.org> * twofish.c (twofish_decrypt): Fixed for();-bug in the block-loop. diff --git a/des-compat.h b/des-compat.h new file mode 100644 index 00000000..ce809624 --- /dev/null +++ b/des-compat.h @@ -0,0 +1,33 @@ +/* des-compat.h + * + * The des block cipher, libdes/openssl-style interface. + */ + +/* nettle, low-level cryptographics library + * + * Copyright (C) 2001 Niels M�ller + * + * The nettle library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The nettle library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the nettle library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NETTLE_DES_COMPAT_H_INCLUDED +#define NETTLE_DES_COMPAT_H_INCLUDED + +/* According to Assar, des_set_key, des_set_key_odd_parity, + * des_is_weak_key, plus the encryption functions (des_*_encrypt and + * des_cbc_cksum) would be a pretty useful subset. */ + +#endif /* NETTLE_DES_COMPAT_H_INCLUDED */ diff --git a/testsuite/.cvsignore b/testsuite/.cvsignore index 9e0be283..df65a880 100644 --- a/testsuite/.cvsignore +++ b/testsuite/.cvsignore @@ -11,6 +11,8 @@ cast128-test cast128-test.c des-test des-test.c +md5-compat-test +md5-compat-test.c md5-test md5-test.c serpent-test diff --git a/testsuite/.gitignore b/testsuite/.gitignore index ecbe74d0..27ff3834 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -11,6 +11,8 @@ /cast128-test.c /des-test /des-test.c +/md5-compat-test +/md5-compat-test.c /md5-test /md5-test.c /serpent-test diff --git a/testsuite/md5-compat-test.m4 b/testsuite/md5-compat-test.m4 new file mode 100644 index 00000000..7ad598aa --- /dev/null +++ b/testsuite/md5-compat-test.m4 @@ -0,0 +1,56 @@ +#include "md5-compat.h" + +BEGIN_TEST + +MD5_CTX ctx; +unsigned char digest[MD5_DIGEST_SIZE]; + +MD5Init(&ctx); +MD5Final(digest, &ctx); +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("D41D8CD98F00B204 E9800998ECF8427E"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "a", 1); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("0CC175B9C0F1B6A8 31C399E269772661"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "abc", 3); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("900150983cd24fb0 D6963F7D28E17F72"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "message digest", 14); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("F96B697D7CB7938D 525A2F31AAF161D0"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "abcdefghijklmnopqrstuvwxyz", 26); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("C3FCD3D76192E400 7DFB496CCA67E13B"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 62); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("D174AB98D277D9F5 A5611C2C9F419D9F"))) + FAIL; + +MD5Init(&ctx); +MD5Update(&ctx, "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + 80); +MD5Final(digest, &ctx); + +if (!MEMEQ(MD5_DIGEST_SIZE, digest, H("57EDF4A22BE3C955 AC49DA2E2107B67A"))) + FAIL; + -- GitLab