EVP_DigestInit.3 (206048) | EVP_DigestInit.3 (215698) |
---|---|
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 | 1.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) |
2.\" 3.\" Standard preamble: 4.\" ======================================================================== | 2.\" 3.\" Standard preamble: 4.\" ======================================================================== |
5.de Sh \" Subsection heading 6.br 7.if t .Sp 8.ne 5 9.PP 10\fB\\$1\fR 11.PP 12.. | |
13.de Sp \" Vertical space (when we can't use .PP) 14.if t .sp .5v 15.if n .sp 16.. 17.de Vb \" Begin verbatim text 18.ft CW 19.nf 20.ne \\$1 21.. 22.de Ve \" End verbatim text 23.ft R 24.fi 25.. 26.\" Set up some character translations and predefined strings. \*(-- will 27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | 5.de Sp \" Vertical space (when we can't use .PP) 6.if t .sp .5v 7.if n .sp 8.. 9.de Vb \" Begin verbatim text 10.ft CW 11.nf 12.ne \\$1 13.. 14.de Ve \" End verbatim text 15.ft R 16.fi 17.. 18.\" Set up some character translations and predefined strings. \*(-- will 19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
28.\" double quote, and \*(R" will give a right double quote. | will give a 29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to 30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' 31.\" expand to `' in nroff, nothing in troff, for use with C<>. 32.tr \(*W-|\(bv\*(Tr | 20.\" double quote, and \*(R" will give a right double quote. \*(C+ will 21.\" give a nicer C++. Capital omega is used to do unbreakable dashes and 22.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, 23.\" nothing in troff, for use with C<>. 24.tr \(*W- |
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' 34.ie n \{\ 35. ds -- \(*W- 36. ds PI pi 37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch 38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch 39. ds L" "" 40. ds R" "" 41. ds C` "" 42. ds C' "" 43'br\} 44.el\{\ 45. ds -- \|\(em\| 46. ds PI \(*p 47. ds L" `` 48. ds R" '' 49'br\} 50.\" | 25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' 26.ie n \{\ 27. ds -- \(*W- 28. ds PI pi 29. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch 30. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch 31. ds L" "" 32. ds R" "" 33. ds C` "" 34. ds C' "" 35'br\} 36.el\{\ 37. ds -- \|\(em\| 38. ds PI \(*p 39. ds L" `` 40. ds R" '' 41'br\} 42.\" |
43.\" Escape single quotes in literal strings from groff's Unicode transform. 44.ie \n(.g .ds Aq \(aq 45.el .ds Aq ' 46.\" |
|
51.\" If the F register is turned on, we'll generate index entries on stderr for | 47.\" If the F register is turned on, we'll generate index entries on stderr for |
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | 48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
53.\" entries marked with X<> in POD. Of course, you'll have to process the 54.\" output yourself in some meaningful fashion. | 49.\" entries marked with X<> in POD. Of course, you'll have to process the 50.\" output yourself in some meaningful fashion. |
55.if \nF \{\ | 51.ie \nF \{\ |
56. de IX 57. tm Index:\\$1\t\\n%\t"\\$2" 58.. 59. nr % 0 60. rr F 61.\} | 52. de IX 53. tm Index:\\$1\t\\n%\t"\\$2" 54.. 55. nr % 0 56. rr F 57.\} |
58.el \{\ 59. de IX 60.. 61.\} |
|
62.\" | 62.\" |
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes 64.\" way too many mistakes in technical documents. 65.hy 0 66.if n .na 67.\" | |
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). 69.\" Fear. Run. Save yourself. No user-serviceable parts. 70. \" fudge factors for nroff and troff 71.if n \{\ 72. ds #H 0 73. ds #V .8m 74. ds #F .3m 75. ds #[ \f1 --- 48 unchanged lines hidden (view full) --- 124. ds Th \o'LP' 125. ds ae ae 126. ds Ae AE 127.\} 128.rm #[ #] #H #V #F C 129.\" ======================================================================== 130.\" 131.IX Title "EVP_DigestInit 3" | 63.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). 64.\" Fear. Run. Save yourself. No user-serviceable parts. 65. \" fudge factors for nroff and troff 66.if n \{\ 67. ds #H 0 68. ds #V .8m 69. ds #F .3m 70. ds #[ \f1 --- 48 unchanged lines hidden (view full) --- 119. ds Th \o'LP' 120. ds ae ae 121. ds Ae AE 122.\} 123.rm #[ #] #H #V #F C 124.\" ======================================================================== 125.\" 126.IX Title "EVP_DigestInit 3" |
132.TH EVP_DigestInit 3 "2010-03-24" "0.9.8n" "OpenSSL" | 127.TH EVP_DigestInit 3 "2010-11-16" "0.9.8p" "OpenSSL" 128.\" For nroff, turn off justification. Always turn off hyphenation; it makes 129.\" way too many mistakes in technical documents. 130.if n .ad l 131.nh |
133.SH "NAME" 134EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, 135EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, 136EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, 137EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, 138EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, 139EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj \- 140EVP digest routines 141.SH "SYNOPSIS" 142.IX Header "SYNOPSIS" 143.Vb 1 144\& #include <openssl/evp.h> | 132.SH "NAME" 133EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, 134EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, 135EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, 136EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, 137EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, 138EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj \- 139EVP digest routines 140.SH "SYNOPSIS" 141.IX Header "SYNOPSIS" 142.Vb 1 143\& #include <openssl/evp.h> |
145.Ve 146.PP 147.Vb 2 | 144\& |
148\& void EVP_MD_CTX_init(EVP_MD_CTX *ctx); 149\& EVP_MD_CTX *EVP_MD_CTX_create(void); | 145\& void EVP_MD_CTX_init(EVP_MD_CTX *ctx); 146\& EVP_MD_CTX *EVP_MD_CTX_create(void); |
150.Ve 151.PP 152.Vb 4 | 147\& |
153\& int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); 154\& int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); 155\& int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, 156\& unsigned int *s); | 148\& int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); 149\& int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); 150\& int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, 151\& unsigned int *s); |
157.Ve 158.PP 159.Vb 2 | 152\& |
160\& int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); 161\& void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); | 153\& int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); 154\& void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); |
162.Ve 163.PP 164.Vb 1 165\& int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); 166.Ve 167.PP 168.Vb 3 | 155\& 156\& int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); 157\& |
169\& int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); 170\& int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, 171\& unsigned int *s); | 158\& int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); 159\& int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, 160\& unsigned int *s); |
172.Ve 173.PP 174.Vb 1 175\& int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); 176.Ve 177.PP 178.Vb 1 | 161\& 162\& int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); 163\& |
179\& #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ | 164\& #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ |
180.Ve 181.PP 182.Vb 4 183\& #define EVP_MD_type(e) ((e)->type) 184\& #define EVP_MD_pkey_type(e) ((e)->pkey_type) 185\& #define EVP_MD_size(e) ((e)->md_size) 186\& #define EVP_MD_block_size(e) ((e)->block_size) 187.Ve 188.PP 189.Vb 4 190\& #define EVP_MD_CTX_md(e) (e)->digest) 191\& #define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest) 192\& #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) 193\& #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) 194.Ve 195.PP 196.Vb 9 | 165\& 166\& 167\& #define EVP_MD_type(e) ((e)\->type) 168\& #define EVP_MD_pkey_type(e) ((e)\->pkey_type) 169\& #define EVP_MD_size(e) ((e)\->md_size) 170\& #define EVP_MD_block_size(e) ((e)\->block_size) 171\& 172\& #define EVP_MD_CTX_md(e) (e)\->digest) 173\& #define EVP_MD_CTX_size(e) EVP_MD_size((e)\->digest) 174\& #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)\->digest) 175\& #define EVP_MD_CTX_type(e) EVP_MD_type((e)\->digest) 176\& |
197\& const EVP_MD *EVP_md_null(void); 198\& const EVP_MD *EVP_md2(void); 199\& const EVP_MD *EVP_md5(void); 200\& const EVP_MD *EVP_sha(void); 201\& const EVP_MD *EVP_sha1(void); 202\& const EVP_MD *EVP_dss(void); 203\& const EVP_MD *EVP_dss1(void); 204\& const EVP_MD *EVP_mdc2(void); 205\& const EVP_MD *EVP_ripemd160(void); | 177\& const EVP_MD *EVP_md_null(void); 178\& const EVP_MD *EVP_md2(void); 179\& const EVP_MD *EVP_md5(void); 180\& const EVP_MD *EVP_sha(void); 181\& const EVP_MD *EVP_sha1(void); 182\& const EVP_MD *EVP_dss(void); 183\& const EVP_MD *EVP_dss1(void); 184\& const EVP_MD *EVP_mdc2(void); 185\& const EVP_MD *EVP_ripemd160(void); |
206.Ve 207.PP 208.Vb 3 | 186\& |
209\& const EVP_MD *EVP_get_digestbyname(const char *name); 210\& #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) 211\& #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) 212.Ve 213.SH "DESCRIPTION" 214.IX Header "DESCRIPTION" 215The \s-1EVP\s0 digest routines are a high level interface to message digests. 216.PP --- 109 unchanged lines hidden (view full) --- 326The functions \fIEVP_DigestInit()\fR, \fIEVP_DigestFinal()\fR and \fIEVP_MD_CTX_copy()\fR are 327obsolete but are retained to maintain compatibility with existing code. New 328applications should use \fIEVP_DigestInit_ex()\fR, \fIEVP_DigestFinal_ex()\fR and 329\&\fIEVP_MD_CTX_copy_ex()\fR because they can efficiently reuse a digest context 330instead of initializing and cleaning it up on each call and allow non default 331implementations of digests to be specified. 332.PP 333In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use | 187\& const EVP_MD *EVP_get_digestbyname(const char *name); 188\& #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) 189\& #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) 190.Ve 191.SH "DESCRIPTION" 192.IX Header "DESCRIPTION" 193The \s-1EVP\s0 digest routines are a high level interface to message digests. 194.PP --- 109 unchanged lines hidden (view full) --- 304The functions \fIEVP_DigestInit()\fR, \fIEVP_DigestFinal()\fR and \fIEVP_MD_CTX_copy()\fR are 305obsolete but are retained to maintain compatibility with existing code. New 306applications should use \fIEVP_DigestInit_ex()\fR, \fIEVP_DigestFinal_ex()\fR and 307\&\fIEVP_MD_CTX_copy_ex()\fR because they can efficiently reuse a digest context 308instead of initializing and cleaning it up on each call and allow non default 309implementations of digests to be specified. 310.PP 311In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use |
334memory leaks will occur. | 312memory leaks will occur. |
335.SH "EXAMPLE" 336.IX Header "EXAMPLE" 337This example digests the data \*(L"Test Message\en\*(R" and \*(L"Hello World\en\*(R", using the 338digest name passed on the command line. 339.PP 340.Vb 2 341\& #include <stdio.h> 342\& #include <openssl/evp.h> | 313.SH "EXAMPLE" 314.IX Header "EXAMPLE" 315This example digests the data \*(L"Test Message\en\*(R" and \*(L"Hello World\en\*(R", using the 316digest name passed on the command line. 317.PP 318.Vb 2 319\& #include <stdio.h> 320\& #include <openssl/evp.h> |
343.Ve 344.PP 345.Vb 8 | 321\& |
346\& main(int argc, char *argv[]) 347\& { 348\& EVP_MD_CTX mdctx; 349\& const EVP_MD *md; 350\& char mess1[] = "Test Message\en"; 351\& char mess2[] = "Hello World\en"; 352\& unsigned char md_value[EVP_MAX_MD_SIZE]; 353\& int md_len, i; | 322\& main(int argc, char *argv[]) 323\& { 324\& EVP_MD_CTX mdctx; 325\& const EVP_MD *md; 326\& char mess1[] = "Test Message\en"; 327\& char mess2[] = "Hello World\en"; 328\& unsigned char md_value[EVP_MAX_MD_SIZE]; 329\& int md_len, i; |
354.Ve 355.PP 356.Vb 1 | 330\& |
357\& OpenSSL_add_all_digests(); | 331\& OpenSSL_add_all_digests(); |
358.Ve 359.PP 360.Vb 4 | 332\& |
361\& if(!argv[1]) { 362\& printf("Usage: mdtest digestname\en"); 363\& exit(1); 364\& } | 333\& if(!argv[1]) { 334\& printf("Usage: mdtest digestname\en"); 335\& exit(1); 336\& } |
365.Ve 366.PP 367.Vb 1 | 337\& |
368\& md = EVP_get_digestbyname(argv[1]); | 338\& md = EVP_get_digestbyname(argv[1]); |
369.Ve 370.PP 371.Vb 4 | 339\& |
372\& if(!md) { 373\& printf("Unknown message digest %s\en", argv[1]); 374\& exit(1); 375\& } | 340\& if(!md) { 341\& printf("Unknown message digest %s\en", argv[1]); 342\& exit(1); 343\& } |
376.Ve 377.PP 378.Vb 6 | 344\& |
379\& EVP_MD_CTX_init(&mdctx); 380\& EVP_DigestInit_ex(&mdctx, md, NULL); 381\& EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); 382\& EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); 383\& EVP_DigestFinal_ex(&mdctx, md_value, &md_len); 384\& EVP_MD_CTX_cleanup(&mdctx); | 345\& EVP_MD_CTX_init(&mdctx); 346\& EVP_DigestInit_ex(&mdctx, md, NULL); 347\& EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); 348\& EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); 349\& EVP_DigestFinal_ex(&mdctx, md_value, &md_len); 350\& EVP_MD_CTX_cleanup(&mdctx); |
385.Ve 386.PP 387.Vb 4 | 351\& |
388\& printf("Digest is: "); 389\& for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); 390\& printf("\en"); 391\& } 392.Ve 393.SH "BUGS" 394.IX Header "BUGS" 395The link between digests and signing algorithms results in a situation where --- 19 unchanged lines hidden --- | 352\& printf("Digest is: "); 353\& for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); 354\& printf("\en"); 355\& } 356.Ve 357.SH "BUGS" 358.IX Header "BUGS" 359The link between digests and signing algorithms results in a situation where --- 19 unchanged lines hidden --- |