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);
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) {
}
}
end:
- if (buf != NULL) {
- OPENSSL_cleanse(buf, BUFSIZE);
- OPENSSL_free(buf);
- }
+ OPENSSL_clear_free(buf, BUFSIZE);
BIO_free(in);
- if (passin)
- OPENSSL_free(passin);
+ OPENSSL_free(passin);
BIO_free_all(out);
EVP_PKEY_free(sigkey);
- if (sigopts)
- sk_OPENSSL_STRING_free(sigopts);
- if (macopts)
- sk_OPENSSL_STRING_free(macopts);
- if (sigbuf)
- OPENSSL_free(sigbuf);
+ sk_OPENSSL_STRING_free(sigopts);
+ sk_OPENSSL_STRING_free(macopts);
+ OPENSSL_free(sigbuf);
BIO_free(bmd);
return (ret);
}