diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-10-21 14:51:13 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-21 14:51:13 +0200 |
commit | 5209a846a9157e649fcdcb561f7eaf19c8c0e465 (patch) | |
tree | b0a7e52b5646c8eec182dbc391e7934b6804488c /source4/lib/crypto/md5test.c | |
parent | 625359b2e266105022309df8985720108ecd6f67 (diff) | |
parent | 2ee8d29d22bcb1c350ab59d71b0aee548489bc9c (diff) | |
download | samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.gz samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.bz2 samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
Conflicts:
source4/lib/registry/ldb.c
source4/rpc_server/winreg/rpc_winreg.c
Diffstat (limited to 'source4/lib/crypto/md5test.c')
-rw-r--r-- | source4/lib/crypto/md5test.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/source4/lib/crypto/md5test.c b/source4/lib/crypto/md5test.c deleted file mode 100644 index 702e0fcf41..0000000000 --- a/source4/lib/crypto/md5test.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - Unix SMB/CIFS implementation. - MD5 tests - Copyright (C) Stefan Metzmacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "includes.h" -#include "lib/crypto/crypto.h" - -struct torture_context; - -/* - This uses the test values from rfc1321 -*/ -bool torture_local_crypto_md5(struct torture_context *torture) -{ - bool ret = true; - uint32_t i; - struct { - const char *data; - const char *md5; - } testarray[] = { - { - .data = "", - .md5 = "d41d8cd98f00b204e9800998ecf8427e" - },{ - .data = "a", - .md5 = "0cc175b9c0f1b6a831c399e269772661" - },{ - .data = "abc", - .md5 = "900150983cd24fb0d6963f7d28e17f72" - },{ - .data = "message digest", - .md5 = "f96b697d7cb7938d525a2f31aaf161d0" - },{ - .data = "abcdefghijklmnopqrstuvwxyz", - .md5 = "c3fcd3d76192e4007dfb496cca67e13b" - },{ - .data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789", - .md5 = "d174ab98d277d9f5a5611c2c9f419d9f" - },{ - .data = "123456789012345678901234567890" - "123456789012345678901234567890" - "12345678901234567890", - .md5 = "57edf4a22be3c955ac49da2e2107b67a" - } - }; - - for (i=0; i < ARRAY_SIZE(testarray); i++) { - struct MD5Context ctx; - uint8_t md5[16]; - int e; - - DATA_BLOB data; - DATA_BLOB md5blob; - - data = data_blob_string_const(testarray[i].data); - md5blob = strhex_to_data_blob(testarray[i].md5); - - MD5Init(&ctx); - MD5Update(&ctx, data.data, data.length); - MD5Final(md5, &ctx); - - e = memcmp(md5blob.data, - md5, - MIN(md5blob.length, sizeof(md5))); - if (e != 0) { - printf("md5 test[%u]: failed\n", i); - dump_data(0, data.data, data.length); - dump_data(0, md5blob.data, md5blob.length); - dump_data(0, md5, sizeof(md5)); - ret = false; - } - talloc_free(md5blob.data); - } - - return ret; -} |