-/* $OpenBSD: malloc-wrapper.c,v 1.3 2014/04/20 14:32:19 jsing Exp $ */
+/* $OpenBSD: malloc-wrapper.c,v 1.4 2017/04/28 22:38:51 beck Exp $ */
/*
* Copyright (c) 2014 Bob Beck
*
ret = malloc(num);
if (ret && ptr && old_len > 0) {
memcpy(ret, ptr, old_len);
- explicit_bzero(ptr, old_len);
- free(ptr);
+ freezero(ptr, old_len);
}
return ret;
}
-/* $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.
*
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- explicit_bzero(buf, num);
- free(buf);
- }
+ freezero(buf, num);
+
return r;
}
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- explicit_bzero(buf, num);
- free(buf);
- }
+ freezero(buf, num);
+
return r;
}
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- explicit_bzero(buf, num);
- free(buf);
- }
+ freezero(buf, num);
+
return r;
}
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- explicit_bzero(buf, num);
- free(buf);
- }
+ freezero(buf, num);
+
return r;
}
-/* $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.
*
else
*siglen = i;
- explicit_bzero(s, (unsigned int)j + 1);
- free(s);
+ freezero(s, (unsigned int)j + 1);
+
return ret;
}
ret = 1;
err:
ASN1_OCTET_STRING_free(sig);
- if (s != NULL) {
- explicit_bzero(s, (unsigned int)siglen);
- free(s);
- }
+ freezero(s, siglen);
+
return ret;
}
-/* $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.
*
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);
}
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;
}
-/* $OpenBSD: x509_vfy.c,v 1.61 2017/02/05 02:33:21 beck Exp $ */
+/* $OpenBSD: x509_vfy.c,v 1.62 2017/04/28 22:38:51 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
/* Safety net, error returns must set ctx->error */
if (ok <= 0 && ctx->error == X509_V_OK)
ctx->error = X509_V_ERR_UNSPECIFIED;
-
- /*
- * Safety net, if user provided verify callback indicates sucess
- * make sure they have set error to X509_V_OK
- */
- if (ctx->verify_cb != null_callback && ok == 1)
- ctx->error = X509_V_OK;
-
- return(ctx->error == X509_V_OK);
+ return ok;
}
/* Given a STACK_OF(X509) find the issuer of cert (if any)