aboutsummaryrefslogtreecommitdiff
path: root/demos/cms/cms_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/cms/cms_enc.c')
-rw-r--r--demos/cms/cms_enc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/demos/cms/cms_enc.c b/demos/cms/cms_enc.c
index 9ef7a395583d..1f69571a17fc 100644
--- a/demos/cms/cms_enc.c
+++ b/demos/cms/cms_enc.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -18,7 +18,7 @@ int main(int argc, char **argv)
X509 *rcert = NULL;
STACK_OF(X509) *recips = NULL;
CMS_ContentInfo *cms = NULL;
- int ret = 1;
+ int ret = EXIT_FAILURE;
/*
* On OpenSSL 1.0.0 and later only:
@@ -47,8 +47,8 @@ int main(int argc, char **argv)
goto err;
/*
- * sk_X509_pop_free will free up recipient STACK and its contents so set
- * rcert to NULL so it isn't freed up twice.
+ * OSSL_STACK_OF_X509_free() will free up recipient STACK and its contents
+ * so set rcert to NULL so it isn't freed up twice.
*/
rcert = NULL;
@@ -73,18 +73,18 @@ int main(int argc, char **argv)
if (!SMIME_write_CMS(out, cms, in, flags))
goto err;
- ret = 0;
+ printf("Encryption Successful\n");
+ ret = EXIT_SUCCESS;
err:
-
- if (ret) {
+ if (ret != EXIT_SUCCESS) {
fprintf(stderr, "Error Encrypting Data\n");
ERR_print_errors_fp(stderr);
}
CMS_ContentInfo_free(cms);
X509_free(rcert);
- sk_X509_pop_free(recips, X509_free);
+ OSSL_STACK_OF_X509_free(recips);
BIO_free(in);
BIO_free(out);
BIO_free(tbio);