OLD | NEW |
1 =pod | 1 =pod |
2 | 2 |
3 =head1 NAME | 3 =head1 NAME |
4 | 4 |
5 HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message | 5 HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message |
6 authentication code | 6 authentication code |
7 | 7 |
8 =head1 SYNOPSIS | 8 =head1 SYNOPSIS |
9 | 9 |
10 #include <openssl/hmac.h> | 10 #include <openssl/hmac.h> |
11 | 11 |
12 unsigned char *HMAC(const EVP_MD *evp_md, const void *key, | 12 unsigned char *HMAC(const EVP_MD *evp_md, const void *key, |
13 int key_len, const unsigned char *d, int n, | 13 int key_len, const unsigned char *d, int n, |
14 unsigned char *md, unsigned int *md_len); | 14 unsigned char *md, unsigned int *md_len); |
15 | 15 |
16 void HMAC_CTX_init(HMAC_CTX *ctx); | 16 void HMAC_CTX_init(HMAC_CTX *ctx); |
17 | 17 |
18 void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, | 18 int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, |
19 const EVP_MD *md); | 19 const EVP_MD *md); |
20 void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, | 20 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, |
21 const EVP_MD *md, ENGINE *impl); | 21 const EVP_MD *md, ENGINE *impl); |
22 void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); | 22 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); |
23 void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 23 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
24 | 24 |
25 void HMAC_CTX_cleanup(HMAC_CTX *ctx); | 25 void HMAC_CTX_cleanup(HMAC_CTX *ctx); |
26 void HMAC_cleanup(HMAC_CTX *ctx); | 26 void HMAC_cleanup(HMAC_CTX *ctx); |
27 | 27 |
28 =head1 DESCRIPTION | 28 =head1 DESCRIPTION |
29 | 29 |
30 HMAC is a MAC (message authentication code), i.e. a keyed hash | 30 HMAC is a MAC (message authentication code), i.e. a keyed hash |
31 function used for message authentication, which is based on a hash | 31 function used for message authentication, which is based on a hash |
32 function. | 32 function. |
33 | 33 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 programs that expect it will cause them to stop working>. | 69 programs that expect it will cause them to stop working>. |
70 | 70 |
71 HMAC_Update() can be called repeatedly with chunks of the message to | 71 HMAC_Update() can be called repeatedly with chunks of the message to |
72 be authenticated (B<len> bytes at B<data>). | 72 be authenticated (B<len> bytes at B<data>). |
73 | 73 |
74 HMAC_Final() places the message authentication code in B<md>, which | 74 HMAC_Final() places the message authentication code in B<md>, which |
75 must have space for the hash function output. | 75 must have space for the hash function output. |
76 | 76 |
77 =head1 RETURN VALUES | 77 =head1 RETURN VALUES |
78 | 78 |
79 HMAC() returns a pointer to the message authentication code. | 79 HMAC() returns a pointer to the message authentication code or NULL if |
| 80 an error occurred. |
80 | 81 |
81 HMAC_CTX_init(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and | 82 HMAC_Init_ex(), HMAC_Update() and HMAC_Final() return 1 for success or 0 if |
82 HMAC_CTX_cleanup() do not return values. | 83 an error occurred. |
| 84 |
| 85 HMAC_CTX_init() and HMAC_CTX_cleanup() do not return values. |
83 | 86 |
84 =head1 CONFORMING TO | 87 =head1 CONFORMING TO |
85 | 88 |
86 RFC 2104 | 89 RFC 2104 |
87 | 90 |
88 =head1 SEE ALSO | 91 =head1 SEE ALSO |
89 | 92 |
90 L<sha(3)|sha(3)>, L<evp(3)|evp(3)> | 93 L<sha(3)|sha(3)>, L<evp(3)|evp(3)> |
91 | 94 |
92 =head1 HISTORY | 95 =head1 HISTORY |
93 | 96 |
94 HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() | 97 HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() |
95 are available since SSLeay 0.9.0. | 98 are available since SSLeay 0.9.0. |
96 | 99 |
97 HMAC_CTX_init(), HMAC_Init_ex() and HMAC_CTX_cleanup() are available | 100 HMAC_CTX_init(), HMAC_Init_ex() and HMAC_CTX_cleanup() are available |
98 since OpenSSL 0.9.7. | 101 since OpenSSL 0.9.7. |
99 | 102 |
| 103 HMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in |
| 104 versions of OpenSSL before 1.0.0. |
| 105 |
100 =cut | 106 =cut |
OLD | NEW |