diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-06-15 15:46:23 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-06-15 15:46:23 +0000 |
commit | 9b1b3bd2db8731b288d8ca2c903df3e60216c2aa (patch) | |
tree | b06654f9b1e7f1acf44f74259118ed2c46c3e37a /lib/libssl | |
parent | 747480fce8007121c9bbc3d26b6f08325c386d0b (diff) |
Simplify EVP_MD_CTX_create() by just using calloc(). Also, use 0 rather
than '\0' for several memset().
ok beck@ miod@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/src/crypto/evp/digest.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/libssl/src/crypto/evp/digest.c b/lib/libssl/src/crypto/evp/digest.c index 4071d71e1e1..f598e78911d 100644 --- a/lib/libssl/src/crypto/evp/digest.c +++ b/lib/libssl/src/crypto/evp/digest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: digest.c,v 1.17 2014/06/12 15:49:29 deraadt Exp $ */ +/* $OpenBSD: digest.c,v 1.18 2014/06/15 15:46:22 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -120,18 +120,13 @@ void EVP_MD_CTX_init(EVP_MD_CTX *ctx) { - memset(ctx, '\0', sizeof *ctx); + memset(ctx, 0, sizeof *ctx); } EVP_MD_CTX * EVP_MD_CTX_create(void) { - EVP_MD_CTX *ctx = malloc(sizeof *ctx); - - if (ctx) - EVP_MD_CTX_init(ctx); - - return ctx; + return calloc(1, sizeof(EVP_MD_CTX)); } int @@ -367,7 +362,7 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) * functional reference we held for this reason. */ ENGINE_finish(ctx->engine); #endif - memset(ctx, '\0', sizeof *ctx); + memset(ctx, 0, sizeof *ctx); return 1; } |