Remove building with NOCRYPTO option
[minix.git] / crypto / external / bsd / openssl / dist / demos / cms / cms_uncomp.c
blob392f4b4502d62cb886acf601fd8db3ca7c3220ce
1 /* Simple S/MIME uncompression example */
2 #include <openssl/pem.h>
3 #include <openssl/cms.h>
4 #include <openssl/err.h>
6 int main(int argc, char **argv)
8 BIO *in = NULL, *out = NULL;
9 CMS_ContentInfo *cms = NULL;
10 int ret = 1;
12 OpenSSL_add_all_algorithms();
13 ERR_load_crypto_strings();
15 /* Open compressed content */
17 in = BIO_new_file("smcomp.txt", "r");
19 if (!in)
20 goto err;
22 /* Sign content */
23 cms = SMIME_read_CMS(in, NULL);
25 if (!cms)
26 goto err;
28 out = BIO_new_file("smuncomp.txt", "w");
29 if (!out)
30 goto err;
32 /* Uncompress S/MIME message */
33 if (!CMS_uncompress(cms, out, NULL, 0))
34 goto err;
36 ret = 0;
38 err:
40 if (ret) {
41 fprintf(stderr, "Error Uncompressing Data\n");
42 ERR_print_errors_fp(stderr);
45 if (cms)
46 CMS_ContentInfo_free(cms);
48 if (in)
49 BIO_free(in);
50 if (out)
51 BIO_free(out);
53 return ret;