[kex.c kexdh.c kexgex.c key.c mac.c]
     use EVP_MD_size(evp_md) and not evp_md->md_size; ok steveks@
This commit is contained in:
Damien Miller 2002-02-05 11:54:07 +11:00
parent c516e928cd
commit 3672e4bc7a
6 changed files with 18 additions and 16 deletions

View File

@ -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 $

4
kex.c
View File

@ -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 <openssl/crypto.h>
@ -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);

View File

@ -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 <openssl/crypto.h>
#include <openssl/bn.h>
@ -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;
}

View File

@ -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 <openssl/bn.h>
@ -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;
}

13
key.c
View File

@ -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 <openssl/evp.h>
@ -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)

4
mac.c
View File

@ -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 <openssl/hmac.h>
@ -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;
}