X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=inline;f=apps%2Fdgst.c;h=69211d34aca1bf16e9075d7c49eef699bd2c6145;hb=4b45c6e52b208deff7da333d1c7f84bcd3986609;hp=adfa2a63ba969d076611df40a2dcd7355a5f21a3;hpb=333b070ec06d7a67538ee9d5312656a19e802dc1;p=oweals%2Fopenssl.git diff --git a/apps/dgst.c b/apps/dgst.c index adfa2a63ba..69211d34ac 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -139,10 +139,7 @@ int dgst_main(int argc, char **argv) int engine_impl = 0; prog = opt_progname(argv[0]); - if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) { - BIO_printf(bio_err, "%s: out of memory\n", prog); - goto end; - } + buf = app_malloc(BUFSIZE, "I/O buffer"); md = EVP_get_digestbyname(prog); prog = opt_init(argc, argv, dgst_options); @@ -394,11 +391,7 @@ int dgst_main(int argc, char **argv) goto end; } siglen = EVP_PKEY_size(sigkey); - sigbuf = OPENSSL_malloc(siglen); - if (!sigbuf) { - BIO_printf(bio_err, "Out of memory\n"); - goto end; - } + sigbuf = app_malloc(siglen, "signature buffer"); siglen = BIO_read(sigbio, sigbuf, siglen); BIO_free(sigbio); if (siglen <= 0) { @@ -448,10 +441,7 @@ int dgst_main(int argc, char **argv) } } end: - if (buf != NULL) { - OPENSSL_cleanse(buf, BUFSIZE); - OPENSSL_free(buf); - } + OPENSSL_clear_free(buf, BUFSIZE); BIO_free(in); if (passin) OPENSSL_free(passin);