From: yangyangtiantianlonglong Date: Wed, 16 Feb 2022 15:33:17 +0000 (+0800) Subject: doc: Refactored the example in crypto.pod X-Git-Tag: openssl-3.2.0-alpha1~2928 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a4f446008938775c2bea3001c4c8e7a674992ad;p=thirdparty%2Fopenssl.git doc: Refactored the example in crypto.pod Added return value and error code in the sample Reviewed-by: Tomas Mraz Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/17721) --- diff --git a/doc/man7/crypto.pod b/doc/man7/crypto.pod index 33a321ef605..c3e1664be41 100644 --- a/doc/man7/crypto.pod +++ b/doc/man7/crypto.pod @@ -380,6 +380,7 @@ encryption/decryption, signatures, message authentication codes, etc. #include #include #include + #include int main(void) { @@ -390,6 +391,7 @@ encryption/decryption, signatures, message authentication codes, etc. }; unsigned int len = 0; unsigned char *outdigest = NULL; + int ret = 1; /* Create a context for the digest operation */ ctx = EVP_MD_CTX_new(); @@ -430,11 +432,16 @@ encryption/decryption, signatures, message authentication codes, etc. /* 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