diff options
author | slontis <shane.lontis@oracle.com> | 2023-03-20 14:48:33 +1000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-04-24 14:39:19 +0200 |
commit | 09ff84bd2752cac649f57cfbf95b49dbce1c69ee (patch) | |
tree | 9a3dbf4aa9835f2be7d874cde743f6dfa1de6293 /demos/mac | |
parent | a80840c663e3409203b0235764e53d8624f74cb8 (diff) |
Fixup demo exit status magic numbers
The demo code is quite often block copied for new demos,
so this PR changes demos to use EXIT_SUCCESS & EXIT_FAILURE
instead of using 0 and 1.
Internal functions use the normal notation of 0 = error, 1 = success,
but the value returned by main() must use EXIT_SUCCESS and EXIT_FAILURE.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20545)
Diffstat (limited to 'demos/mac')
-rw-r--r-- | demos/mac/cmac-aes256.c | 8 | ||||
-rw-r--r-- | demos/mac/gmac.c | 8 | ||||
-rw-r--r-- | demos/mac/hmac-sha512.c | 8 | ||||
-rw-r--r-- | demos/mac/poly1305.c | 8 | ||||
-rw-r--r-- | demos/mac/siphash.c | 8 |
5 files changed, 20 insertions, 20 deletions
diff --git a/demos/mac/cmac-aes256.c b/demos/mac/cmac-aes256.c index 9b91a404a8..0431508b98 100644 --- a/demos/mac/cmac-aes256.c +++ b/demos/mac/cmac-aes256.c @@ -65,7 +65,7 @@ static const char *propq = NULL; int main(void) { - int rv = EXIT_FAILURE; + int ret = EXIT_FAILURE; OSSL_LIB_CTX *library_context = NULL; EVP_MAC *mac = NULL; EVP_MAC_CTX *mctx = NULL; @@ -141,14 +141,14 @@ int main(void) goto end; } - rv = EXIT_SUCCESS; + ret = EXIT_SUCCESS; end: - if (rv != EXIT_SUCCESS) + if (ret != EXIT_SUCCESS) ERR_print_errors_fp(stderr); /* OpenSSL free functions will ignore NULL arguments */ OPENSSL_free(out); EVP_MAC_CTX_free(mctx); EVP_MAC_free(mac); OSSL_LIB_CTX_free(library_context); - return rv; + return ret; } diff --git a/demos/mac/gmac.c b/demos/mac/gmac.c index da757ae729..86bd472085 100644 --- a/demos/mac/gmac.c +++ b/demos/mac/gmac.c @@ -57,7 +57,7 @@ static char *propq = NULL; int main(int argc, char **argv) { - int rv = EXIT_FAILURE; + int ret = EXIT_FAILURE; EVP_MAC *mac = NULL; EVP_MAC_CTX *mctx = NULL; unsigned char out[16]; @@ -134,12 +134,12 @@ int main(int argc, char **argv) goto end; } - rv = EXIT_SUCCESS; + ret = EXIT_SUCCESS; end: EVP_MAC_CTX_free(mctx); EVP_MAC_free(mac); OSSL_LIB_CTX_free(library_context); - if (rv != EXIT_SUCCESS) + if (ret != EXIT_SUCCESS) ERR_print_errors_fp(stderr); - return rv; + return ret; } diff --git a/demos/mac/hmac-sha512.c b/demos/mac/hmac-sha512.c index c258b90ee3..4bdac63e55 100644 --- a/demos/mac/hmac-sha512.c +++ b/demos/mac/hmac-sha512.c @@ -75,7 +75,7 @@ static const char *propq = NULL; int main(void) { - int rv = EXIT_FAILURE; + int ret = EXIT_FAILURE; OSSL_LIB_CTX *library_context = NULL; EVP_MAC *mac = NULL; EVP_MAC_CTX *mctx = NULL; @@ -152,9 +152,9 @@ int main(void) goto end; } - rv = EXIT_SUCCESS; + ret = EXIT_SUCCESS; end: - if (rv != EXIT_SUCCESS) + if (ret != EXIT_SUCCESS) ERR_print_errors_fp(stderr); /* OpenSSL free functions will ignore NULL arguments */ OPENSSL_free(out); @@ -162,5 +162,5 @@ end: EVP_MAC_CTX_free(mctx); EVP_MAC_free(mac); OSSL_LIB_CTX_free(library_context); - return rv; + return ret; } diff --git a/demos/mac/poly1305.c b/demos/mac/poly1305.c index 1aa95e583d..bd2a6da0a2 100644 --- a/demos/mac/poly1305.c +++ b/demos/mac/poly1305.c @@ -83,7 +83,7 @@ static char *propq = NULL; int main(int argc, char **argv) { - int rv = EXIT_FAILURE; + int ret = EXIT_FAILURE; EVP_CIPHER *aes = NULL; EVP_CIPHER_CTX *aesctx = NULL; EVP_MAC *mac = NULL; @@ -196,14 +196,14 @@ int main(int argc, char **argv) goto end; } - rv = EXIT_SUCCESS; + ret = EXIT_SUCCESS; end: EVP_CIPHER_CTX_free(aesctx); EVP_CIPHER_free(aes); EVP_MAC_CTX_free(mctx); EVP_MAC_free(mac); OSSL_LIB_CTX_free(library_context); - if (rv != EXIT_SUCCESS) + if (ret != EXIT_SUCCESS) ERR_print_errors_fp(stderr); - return rv; + return ret; } diff --git a/demos/mac/siphash.c b/demos/mac/siphash.c index 4d36a9d486..5487e35c8e 100644 --- a/demos/mac/siphash.c +++ b/demos/mac/siphash.c @@ -44,7 +44,7 @@ static char *propq = NULL; int main(int argc, char **argv) { - int rv = EXIT_FAILURE; + int ret = EXIT_FAILURE; EVP_MAC *mac = NULL; EVP_MAC_CTX *mctx = NULL; unsigned char out[8]; @@ -118,12 +118,12 @@ int main(int argc, char **argv) goto end; } - rv = EXIT_SUCCESS; + ret = EXIT_SUCCESS; end: EVP_MAC_CTX_free(mctx); EVP_MAC_free(mac); OSSL_LIB_CTX_free(library_context); - if (rv != EXIT_SUCCESS) + if (ret != EXIT_SUCCESS) ERR_print_errors_fp(stderr); - return rv; + return ret; } |