From 3672e4bc7ac19798f169ac7374c77a460d080e4a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 5 Feb 2002 11:54:07 +1100 Subject: [PATCH] - markus@cvs.openbsd.org 2002/01/25 22:07:40 [kex.c kexdh.c kexgex.c key.c mac.c] use EVP_MD_size(evp_md) and not evp_md->md_size; ok steveks@ --- ChangeLog | 5 ++++- kex.c | 4 ++-- kexdh.c | 4 ++-- kexgex.c | 4 ++-- key.c | 13 ++++++------- mac.c | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a79ab80c..f916ab787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,9 @@ [ssh-dss.c ssh-rsa.c] use static EVP_MAX_MD_SIZE buffers for EVP_DigestFinal; ok stevesk@ don't use evp_md->md_size, it's not public. + - markus@cvs.openbsd.org 2002/01/25 22:07:40 + [kex.c kexdh.c kexgex.c key.c mac.c] + use EVP_MD_size(evp_md) and not evp_md->md_size; ok steveks@ 20020130 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ @@ -7416,4 +7419,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1802 2002/02/05 00:53:43 djm Exp $ +$Id: ChangeLog,v 1.1803 2002/02/05 00:54:07 djm Exp $ diff --git a/kex.c b/kex.c index c74f1e4a2..b58b12f40 100644 --- a/kex.c +++ b/kex.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kex.c,v 1.42 2002/01/11 13:39:36 markus Exp $"); +RCSID("$OpenBSD: kex.c,v 1.43 2002/01/25 22:07:40 markus Exp $"); #include @@ -363,7 +363,7 @@ derive_key(Kex *kex, int id, int need, u_char *hash, BIGNUM *shared_secret) EVP_MD_CTX md; char c = id; int have; - int mdsz = evp_md->md_size; + int mdsz = EVP_MD_size(evp_md); u_char *digest = xmalloc(roundup(need, mdsz)); buffer_init(&b); diff --git a/kexdh.c b/kexdh.c index bc4700a2e..60d13a8b9 100644 --- a/kexdh.c +++ b/kexdh.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kexdh.c,v 1.12 2001/12/28 14:50:54 markus Exp $"); +RCSID("$OpenBSD: kexdh.c,v 1.13 2002/01/25 22:07:40 markus Exp $"); #include #include @@ -81,7 +81,7 @@ kex_dh_hash( buffer_free(&b); #ifdef DEBUG_KEX - dump_digest("hash", digest, evp_md->md_size); + dump_digest("hash", digest, EVP_MD_size(evp_md)); #endif return digest; } diff --git a/kexgex.c b/kexgex.c index 6b6d1d2ee..b50a7114f 100644 --- a/kexgex.c +++ b/kexgex.c @@ -24,7 +24,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kexgex.c,v 1.15 2001/12/28 14:50:54 markus Exp $"); +RCSID("$OpenBSD: kexgex.c,v 1.16 2002/01/25 22:07:40 markus Exp $"); #include @@ -92,7 +92,7 @@ kexgex_hash( buffer_free(&b); #ifdef DEBUG_KEXDH - dump_digest("hash", digest, evp_md->md_size); + dump_digest("hash", digest, EVP_MD_size(evp_md)); #endif return digest; } diff --git a/key.c b/key.c index 5288e2b6e..8b1057e8e 100644 --- a/key.c +++ b/key.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -RCSID("$OpenBSD: key.c,v 1.38 2001/12/27 18:22:16 markus Exp $"); +RCSID("$OpenBSD: key.c,v 1.39 2002/01/25 22:07:40 markus Exp $"); #include @@ -170,7 +170,7 @@ key_equal(Key *a, Key *b) } static u_char* -key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) +key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length) { EVP_MD *md = NULL; EVP_MD_CTX ctx; @@ -216,8 +216,7 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) retval = xmalloc(EVP_MAX_MD_SIZE); EVP_DigestInit(&ctx, md); EVP_DigestUpdate(&ctx, blob, len); - EVP_DigestFinal(&ctx, retval, NULL); - *dgst_raw_length = md->md_size; + EVP_DigestFinal(&ctx, retval, dgst_raw_length); memset(blob, 0, len); xfree(blob); } else { @@ -227,7 +226,7 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) } static char* -key_fingerprint_hex(u_char* dgst_raw, size_t dgst_raw_len) +key_fingerprint_hex(u_char* dgst_raw, u_int dgst_raw_len) { char *retval; int i; @@ -244,7 +243,7 @@ key_fingerprint_hex(u_char* dgst_raw, size_t dgst_raw_len) } static char* -key_fingerprint_bubblebabble(u_char* dgst_raw, size_t dgst_raw_len) +key_fingerprint_bubblebabble(u_char* dgst_raw, u_int dgst_raw_len) { char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', @@ -295,7 +294,7 @@ key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep) { char *retval = NULL; u_char *dgst_raw; - size_t dgst_raw_len; + u_int dgst_raw_len; dgst_raw = key_fingerprint_raw(k, dgst_type, &dgst_raw_len); if (!dgst_raw) diff --git a/mac.c b/mac.c index bb342cef4..b250af2aa 100644 --- a/mac.c +++ b/mac.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: mac.c,v 1.3 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: mac.c,v 1.4 2002/01/25 22:07:40 markus Exp $"); #include @@ -56,7 +56,7 @@ mac_init(Mac *mac, char *name) if (strcmp(name, macs[i].name) == 0) { if (mac != NULL) { mac->md = (*macs[i].mdfunc)(); - mac->key_len = mac->mac_len = mac->md->md_size; + mac->key_len = mac->mac_len = EVP_MD_size(mac->md); if (macs[i].truncatebits != 0) mac->mac_len = macs[i].truncatebits/8; }