Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: openssl/demos/cms/cms_comp.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/demos/cms/cakey.pem ('k') | openssl/demos/cms/cms_ddec.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Simple S/MIME compress example */
2 #include <openssl/pem.h>
3 #include <openssl/cms.h>
4 #include <openssl/err.h>
5
6 int main(int argc, char **argv)
7 {
8 BIO *in = NULL, *out = NULL;
9 CMS_ContentInfo *cms = NULL;
10 int ret = 1;
11
12 /*
13 * On OpenSSL 0.9.9 only:
14 * for streaming set CMS_STREAM
15 */
16 int flags = CMS_STREAM;
17
18 OpenSSL_add_all_algorithms();
19 ERR_load_crypto_strings();
20
21 /* Open content being compressed */
22
23 in = BIO_new_file("comp.txt", "r");
24
25 if (!in)
26 goto err;
27
28 /* compress content */
29 cms = CMS_compress(in, NID_zlib_compression, flags);
30
31 if (!cms)
32 goto err;
33
34 out = BIO_new_file("smcomp.txt", "w");
35 if (!out)
36 goto err;
37
38 /* Write out S/MIME message */
39 if (!SMIME_write_CMS(out, cms, in, flags))
40 goto err;
41
42 ret = 0;
43
44 err:
45
46 if (ret)
47 {
48 fprintf(stderr, "Error Compressing Data\n");
49 ERR_print_errors_fp(stderr);
50 }
51
52 if (cms)
53 CMS_ContentInfo_free(cms);
54 if (in)
55 BIO_free(in);
56 if (out)
57 BIO_free(out);
58
59 return ret;
60
61 }
OLDNEW
« no previous file with comments | « openssl/demos/cms/cakey.pem ('k') | openssl/demos/cms/cms_ddec.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698