summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-09-06 12:01:35 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-09-06 12:01:35 +0000
commit8a283b30c6ad7e23b600fda0487279c10cd9dfce (patch)
treebb7e3e207126ba3685e38dc259fa4ec15af59d6e
parentee9c6baa713a6c3c0af47c247361c6c54f12a0b6 (diff)
adapt to sha2(3) API changes; ok millert@
-rw-r--r--bin/md5/md5.c30
-rw-r--r--sbin/isakmpd/hash.c36
-rw-r--r--usr.bin/ssh/md-sha256.c12
3 files changed, 37 insertions, 41 deletions
diff --git a/bin/md5/md5.c b/bin/md5/md5.c
index d429e8201d6..7b6575a1281 100644
--- a/bin/md5/md5.c
+++ b/bin/md5/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.49 2008/07/29 18:24:31 sobrado Exp $ */
+/* $OpenBSD: md5.c,v 1.50 2008/09/06 12:01:34 djm Exp $ */
/*
* Copyright (c) 2001,2003,2005-2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -60,9 +60,7 @@ union ANY_CTX {
MD5_CTX md5;
RMD160_CTX rmd160;
SHA1_CTX sha1;
- SHA256_CTX sha256;
- SHA384_CTX sha384;
- SHA512_CTX sha512;
+ SHA2_CTX sha2;
SUM_CTX sum;
SYSVSUM_CTX sysvsum;
};
@@ -160,30 +158,30 @@ struct hash_function {
&style_hash,
0,
NULL,
- (void (*)(void *))SHA256_Init,
- (void (*)(void *, const unsigned char *, unsigned int))SHA256_Update,
- (void (*)(unsigned char *, void *))SHA256_Final,
- (char *(*)(void *, char *))SHA256_End
+ (void (*)(void *))SHA256Init,
+ (void (*)(void *, const unsigned char *, unsigned int))SHA256Update,
+ (void (*)(unsigned char *, void *))SHA256Final,
+ (char *(*)(void *, char *))SHA256End
}, {
"SHA384",
SHA384_DIGEST_LENGTH,
&style_hash,
0,
NULL,
- (void (*)(void *))SHA384_Init,
- (void (*)(void *, const unsigned char *, unsigned int))SHA384_Update,
- (void (*)(unsigned char *, void *))SHA384_Final,
- (char *(*)(void *, char *))SHA384_End
+ (void (*)(void *))SHA384Init,
+ (void (*)(void *, const unsigned char *, unsigned int))SHA384Update,
+ (void (*)(unsigned char *, void *))SHA384Final,
+ (char *(*)(void *, char *))SHA384End
}, {
"SHA512",
SHA512_DIGEST_LENGTH,
&style_hash,
0,
NULL,
- (void (*)(void *))SHA512_Init,
- (void (*)(void *, const unsigned char *, unsigned int))SHA512_Update,
- (void (*)(unsigned char *, void *))SHA512_Final,
- (char *(*)(void *, char *))SHA512_End
+ (void (*)(void *))SHA512Init,
+ (void (*)(void *, const unsigned char *, unsigned int))SHA512Update,
+ (void (*)(unsigned char *, void *))SHA512Final,
+ (char *(*)(void *, char *))SHA512End
}, {
NULL,
}
diff --git a/sbin/isakmpd/hash.c b/sbin/isakmpd/hash.c
index 6309a4a4d4a..76c2f19783f 100644
--- a/sbin/isakmpd/hash.c
+++ b/sbin/isakmpd/hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hash.c,v 1.21 2006/06/10 20:10:02 hshoexer Exp $ */
+/* $OpenBSD: hash.c,v 1.22 2008/09/06 12:01:34 djm Exp $ */
/* $EOM: hash.c,v 1.10 1999/04/17 23:20:34 niklas Exp $ */
/*
@@ -46,9 +46,7 @@ void hmac_final(unsigned char *, struct hash *);
static union {
MD5_CTX md5ctx;
SHA1_CTX sha1ctx;
- SHA256_CTX sha256ctx;
- SHA384_CTX sha384ctx;
- SHA512_CTX sha512ctx;
+ SHA2_CTX sha2ctx;
} Ctx, Ctx2;
/* Temporary hash digest. */
@@ -74,27 +72,27 @@ static struct hash hashes[] = {
hmac_init,
hmac_final
}, {
- HASH_SHA2_256, 7, SHA2_256_SIZE, (void *)&Ctx.sha256ctx, digest,
- sizeof(SHA256_CTX), (void *)&Ctx2.sha256ctx,
- (void (*)(void *))SHA256_Init,
- (void (*)(void *, unsigned char *, unsigned int))SHA256_Update,
- (void (*)(u_int8_t *, void *))SHA256_Final,
+ HASH_SHA2_256, 7, SHA2_256_SIZE, (void *)&Ctx.sha2ctx, digest,
+ sizeof(SHA2_CTX), (void *)&Ctx2.sha2ctx,
+ (void (*)(void *))SHA256Init,
+ (void (*)(void *, unsigned char *, unsigned int))SHA256Update,
+ (void (*)(u_int8_t *, void *))SHA256Final,
hmac_init,
hmac_final
}, {
- HASH_SHA2_384, 8, SHA2_384_SIZE, (void *)&Ctx.sha384ctx, digest,
- sizeof(SHA384_CTX), (void *)&Ctx2.sha384ctx,
- (void (*)(void *))SHA384_Init,
- (void (*)(void *, unsigned char *, unsigned int))SHA384_Update,
- (void (*)(u_int8_t *, void *))SHA384_Final,
+ HASH_SHA2_384, 8, SHA2_384_SIZE, (void *)&Ctx.sha2ctx, digest,
+ sizeof(SHA2_CTX), (void *)&Ctx2.sha2ctx,
+ (void (*)(void *))SHA384Init,
+ (void (*)(void *, unsigned char *, unsigned int))SHA384Update,
+ (void (*)(u_int8_t *, void *))SHA384Final,
hmac_init,
hmac_final
}, {
- HASH_SHA2_512, 9, SHA2_512_SIZE, (void *)&Ctx.sha512ctx, digest,
- sizeof(SHA512_CTX), (void *)&Ctx2.sha512ctx,
- (void (*)(void *))SHA512_Init,
- (void (*)(void *, unsigned char *, unsigned int))SHA512_Update,
- (void (*)(u_int8_t *, void *))SHA512_Final,
+ HASH_SHA2_512, 9, SHA2_512_SIZE, (void *)&Ctx.sha2ctx, digest,
+ sizeof(SHA2_CTX), (void *)&Ctx2.sha2ctx,
+ (void (*)(void *))SHA512Init,
+ (void (*)(void *, unsigned char *, unsigned int))SHA512Update,
+ (void (*)(u_int8_t *, void *))SHA512Final,
hmac_init,
hmac_final
}
diff --git a/usr.bin/ssh/md-sha256.c b/usr.bin/ssh/md-sha256.c
index 98597c49762..0d337baa8a5 100644
--- a/usr.bin/ssh/md-sha256.c
+++ b/usr.bin/ssh/md-sha256.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md-sha256.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: md-sha256.c,v 1.6 2008/09/06 12:01:34 djm Exp $ */
/*
* Copyright (c) 2005 Damien Miller <djm@openbsd.org>
*
@@ -29,28 +29,28 @@ const EVP_MD *evp_ssh_sha256(void);
static int
ssh_sha256_init(EVP_MD_CTX *ctxt)
{
- SHA256_Init(ctxt->md_data);
+ SHA256Init(ctxt->md_data);
return (1);
}
static int
ssh_sha256_update(EVP_MD_CTX *ctxt, const void *data, unsigned long len)
{
- SHA256_Update(ctxt->md_data, data, len);
+ SHA256Update(ctxt->md_data, data, len);
return (1);
}
static int
ssh_sha256_final(EVP_MD_CTX *ctxt, unsigned char *digest)
{
- SHA256_Final(digest, ctxt->md_data);
+ SHA256Final(digest, ctxt->md_data);
return (1);
}
static int
ssh_sha256_cleanup(EVP_MD_CTX *ctxt)
{
- memset(ctxt->md_data, 0, sizeof(SHA256_CTX));
+ memset(ctxt->md_data, 0, sizeof(SHA2_CTX));
return (1);
}
@@ -67,7 +67,7 @@ evp_ssh_sha256(void)
ssh_sha256.final = ssh_sha256_final;
ssh_sha256.cleanup = ssh_sha256_cleanup;
ssh_sha256.block_size = SHA256_BLOCK_LENGTH;
- ssh_sha256.ctx_size = sizeof(SHA256_CTX);
+ ssh_sha256.ctx_size = sizeof(SHA2_CTX);
return (&ssh_sha256);
}