summaryrefslogtreecommitdiffstats
path: root/demos/smime/smsign2.c
diff options
context:
space:
mode:
authorJames Muir <james@openssl.org>2023-11-10 20:02:00 +0100
committerTomas Mraz <tomas@openssl.org>2023-11-15 08:43:23 +0100
commit86db958835d1f8ba9ce49a9f93b5309c3d13b91c (patch)
tree39e47920c615243afc3dd7df206a54ec05fa1045 /demos/smime/smsign2.c
parentImport repro from #22708 as a test case (diff)
downloadopenssl-86db958835d1f8ba9ce49a9f93b5309c3d13b91c.tar.xz
openssl-86db958835d1f8ba9ce49a9f93b5309c3d13b91c.zip
demos: tidy up makefiles, fix warnings
Update makefiles so that consistent patterns are used. Object files are compiled from source using an implicit rule (but using our CFLAGS); for linking, we give an explicit rule. Ensure that "make test" works in each subdirectory (even if it does not actually run any applications). The top-level demo makefile now works. The makefiles are not make-agnostic. e.g. they use the variable $(RM) in "clean" recipes, which is defined in gnu-make but may not be defined in others. Part of #17806 Testing: $ cd demo $ make test Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22698)
Diffstat (limited to 'demos/smime/smsign2.c')
-rw-r--r--demos/smime/smsign2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/demos/smime/smsign2.c b/demos/smime/smsign2.c
index 4e62c6b82c..5ad86f15f8 100644
--- a/demos/smime/smsign2.c
+++ b/demos/smime/smsign2.c
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
-/* S/MIME signing example: 2 signers. OpenSSL 0.9.9 only */
+/* S/MIME signing example: 2 signers */
#include <openssl/pem.h>
#include <openssl/pkcs7.h>
#include <openssl/err.h>
@@ -30,7 +30,8 @@ int main(int argc, char **argv)
scert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
- BIO_reset(tbio);
+ if (BIO_reset(tbio) < 0)
+ goto err;
skey = PEM_read_bio_PrivateKey(tbio, NULL, 0, NULL);
@@ -43,7 +44,8 @@ int main(int argc, char **argv)
scert2 = PEM_read_bio_X509(tbio, NULL, 0, NULL);
- BIO_reset(tbio);
+ if (BIO_reset(tbio) < 0)
+ goto err;
skey2 = PEM_read_bio_PrivateKey(tbio, NULL, 0, NULL);
@@ -77,8 +79,9 @@ int main(int argc, char **argv)
if (!SMIME_write_PKCS7(out, p7, in, PKCS7_STREAM))
goto err;
- ret = EXIT_SUCCESS;
+ printf("Success\n");
+ ret = EXIT_SUCCESS;
err:
if (ret != EXIT_SUCCESS) {
fprintf(stderr, "Error Signing Data\n");