Added return value and error code in the sample
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17721)
#include <stdio.h>
#include <openssl/evp.h>
#include <openssl/bio.h>
+ #include <openssl/err.h>
int main(void)
{
};
unsigned int len = 0;
unsigned char *outdigest = NULL;
+ int ret = 1;
/* Create a context for the digest operation */
ctx = EVP_MD_CTX_new();
/* Print out the digest result */
BIO_dump_fp(stdout, outdigest, len);
+ ret = 0;
+
err:
/* Clean up all the resources we allocated */
OPENSSL_free(outdigest);
EVP_MD_free(sha256);
EVP_MD_CTX_free(ctx);
+ if (ret != 0)
+ ERR_print_errors_fp(stderr);
+ return ret;
}
=head1 CONFIGURATION