From 56efd82fd673bfdc68211c3fedb80c9ce8fdf05b Mon Sep 17 00:00:00 2001 From: beck <> Date: Fri, 28 Apr 2017 22:38:51 +0000 Subject: *** empty log message *** --- src/lib/libcrypto/rsa/rsa_eay.c | 26 +++++++++----------------- src/lib/libcrypto/rsa/rsa_saos.c | 12 +++++------- src/lib/libcrypto/rsa/rsa_sign.c | 16 +++++++--------- 3 files changed, 21 insertions(+), 33 deletions(-) (limited to 'src/lib/libcrypto/rsa') diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 90a3be8dd3..128269a81a 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_eay.c,v 1.46 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: rsa_eay.c,v 1.47 2017/04/28 22:38:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -244,10 +244,8 @@ err: BN_CTX_end(ctx); BN_CTX_free(ctx); } - if (buf != NULL) { - explicit_bzero(buf, num); - free(buf); - } + freezero(buf, num); + return r; } @@ -468,10 +466,8 @@ err: BN_CTX_end(ctx); BN_CTX_free(ctx); } - if (buf != NULL) { - explicit_bzero(buf, num); - free(buf); - } + freezero(buf, num); + return r; } @@ -597,10 +593,8 @@ err: BN_CTX_end(ctx); BN_CTX_free(ctx); } - if (buf != NULL) { - explicit_bzero(buf, num); - free(buf); - } + freezero(buf, num); + return r; } @@ -700,10 +694,8 @@ err: BN_CTX_end(ctx); BN_CTX_free(ctx); } - if (buf != NULL) { - explicit_bzero(buf, num); - free(buf); - } + freezero(buf, num); + return r; } diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index 179217c236..50522b972a 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_saos.c,v 1.20 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: rsa_saos.c,v 1.21 2017/04/28 22:38:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -96,8 +96,8 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, else *siglen = i; - explicit_bzero(s, (unsigned int)j + 1); - free(s); + freezero(s, (unsigned int)j + 1); + return ret; } @@ -137,9 +137,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, ret = 1; err: ASN1_OCTET_STRING_free(sig); - if (s != NULL) { - explicit_bzero(s, (unsigned int)siglen); - free(s); - } + freezero(s, siglen); + return ret; } diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 52cbc3dfe3..618ec155cc 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_sign.c,v 1.26 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: rsa_sign.c,v 1.27 2017/04/28 22:38:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -135,10 +135,9 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len, else *siglen = i; - if (type != NID_md5_sha1) { - explicit_bzero(tmps, (unsigned int)j + 1); - free(tmps); - } + if (type != NID_md5_sha1) + freezero(tmps, (unsigned int)j + 1); + return (ret); } @@ -234,10 +233,9 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, err: if (sig != NULL) X509_SIG_free(sig); - if (s != NULL) { - explicit_bzero(s, (unsigned int)siglen); - free(s); - } + + freezero(s, (unsigned int)siglen); + return ret; } -- cgit v1.2.3-55-g6feb