aboutsummaryrefslogtreecommitdiff
path: root/lib/hcrypto/mdtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hcrypto/mdtest.c')
-rw-r--r--lib/hcrypto/mdtest.c72
1 files changed, 22 insertions, 50 deletions
diff --git a/lib/hcrypto/mdtest.c b/lib/hcrypto/mdtest.c
index d301c5c4a422..7ad93e3560e1 100644
--- a/lib/hcrypto/mdtest.c
+++ b/lib/hcrypto/mdtest.c
@@ -39,7 +39,6 @@
#ifdef KRB5
#include <krb5-types.h>
#endif
-#include <md2.h>
#include <md4.h>
#include <md5.h>
#include <sha.h>
@@ -51,68 +50,60 @@ struct hash_foo {
const char *name;
size_t psize;
size_t hsize;
- void (*init)(void*);
- void (*update)(void*, const void*, size_t);
- void (*final)(void*, void*);
+ int (*init)(void*);
+ int (*update)(void*, const void*, size_t);
+ int (*final)(void*, void*);
const EVP_MD * (*evp)(void);
-} md2 = {
- "MD2",
- sizeof(MD2_CTX),
- 16,
- (void (*)(void*))MD2_Init,
- (void (*)(void*,const void*, size_t))MD2_Update,
- (void (*)(void*, void*))MD2_Final,
- EVP_md2
-}, md4 = {
+} md4 = {
"MD4",
sizeof(MD4_CTX),
16,
- (void (*)(void*))MD4_Init,
- (void (*)(void*,const void*, size_t))MD4_Update,
- (void (*)(void*, void*))MD4_Final,
+ (int (*)(void*))MD4_Init,
+ (int (*)(void*,const void*, size_t))MD4_Update,
+ (int (*)(void*, void*))MD4_Final,
EVP_md4
}, md5 = {
"MD5",
sizeof(MD5_CTX),
16,
- (void (*)(void*))MD5_Init,
- (void (*)(void*,const void*, size_t))MD5_Update,
- (void (*)(void*, void*))MD5_Final,
+ (int (*)(void*))MD5_Init,
+ (int (*)(void*,const void*, size_t))MD5_Update,
+ (int (*)(void*, void*))MD5_Final,
EVP_md5
}, sha1 = {
"SHA-1",
sizeof(struct sha),
20,
- (void (*)(void*))SHA1_Init,
- (void (*)(void*,const void*, size_t))SHA1_Update,
- (void (*)(void*, void*))SHA1_Final,
+ (int (*)(void*))SHA1_Init,
+ (int (*)(void*,const void*, size_t))SHA1_Update,
+ (int (*)(void*, void*))SHA1_Final,
EVP_sha1
};
struct hash_foo sha256 = {
"SHA-256",
sizeof(SHA256_CTX),
32,
- (void (*)(void*))SHA256_Init,
- (void (*)(void*,const void*, size_t))SHA256_Update,
- (void (*)(void*, void*))SHA256_Final,
+ (int (*)(void*))SHA256_Init,
+ (int (*)(void*,const void*, size_t))SHA256_Update,
+ (int (*)(void*, void*))SHA256_Final,
EVP_sha256
};
struct hash_foo sha384 = {
"SHA-384",
sizeof(SHA384_CTX),
48,
- (void (*)(void*))SHA384_Init,
- (void (*)(void*,const void*, size_t))SHA384_Update,
- (void (*)(void*, void*))SHA384_Final,
+ (int (*)(void*))SHA384_Init,
+ (int (*)(void*,const void*, size_t))SHA384_Update,
+ (int (*)(void*, void*))SHA384_Final,
EVP_sha384
};
struct hash_foo sha512 = {
"SHA-512",
sizeof(SHA512_CTX),
64,
- (void (*)(void*))SHA512_Init,
- (void (*)(void*,const void*, size_t))SHA512_Update,
- (void (*)(void*, void*))SHA512_Final,
+ (int (*)(void*))SHA512_Init,
+ (int (*)(void*,const void*, size_t))SHA512_Update,
+ (int (*)(void*, void*))SHA512_Final,
EVP_sha512
};
@@ -121,24 +112,6 @@ struct test {
unsigned char hash[64];
};
-struct test md2_tests[] = {
- {"",
- "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69\x27\x73" },
- {"a",
- "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0\xb5\xd1" },
- {"abc",
- "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde\xd6\xbb" },
- {"message digest",
- "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe\x06\xb0" },
- {"abcdefghijklmnopqrstuvwxyz",
- "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47\x94\x0b" },
- {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
- "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03\x38\xcd" },
- {"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3\xef\xd8" },
- {NULL, { 0 } }
-};
-
struct test md4_tests[] = {
{"",
{0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59,
@@ -338,7 +311,6 @@ int
main (void)
{
return
- hash_test(&md2, md2_tests) +
hash_test(&md4, md4_tests) +
hash_test(&md5, md5_tests) +
hash_test(&sha1, sha1_tests) +