diff options
author | jsing <> | 2014-06-21 13:42:14 +0000 |
---|---|---|
committer | jsing <> | 2014-06-21 13:42:14 +0000 |
commit | 13487d6ff5ba78e217edd743efcdd9a1be05aa21 (patch) | |
tree | 630b9b1b9589f6fa12e705f2da2d35788b2dcbb7 | |
parent | 08ade2d2f3bc84d98839ae9064475c6fca84a29f (diff) | |
download | openbsd-13487d6ff5ba78e217edd743efcdd9a1be05aa21.tar.gz openbsd-13487d6ff5ba78e217edd743efcdd9a1be05aa21.tar.bz2 openbsd-13487d6ff5ba78e217edd743efcdd9a1be05aa21.zip |
More KNF.
-rw-r--r-- | src/lib/libcrypto/cmac/cm_ameth.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/cmac/cm_pmeth.c | 11 | ||||
-rw-r--r-- | src/lib/libcrypto/cmac/cmac.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/cmac/cmac.h | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hm_ameth.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hm_pmeth.c | 15 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 29 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.h | 28 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/cmac/cm_ameth.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/cmac/cm_pmeth.c | 11 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/cmac/cmac.c | 10 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/cmac/cmac.h | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/hmac/hm_ameth.c | 9 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/hmac/hm_pmeth.c | 15 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/hmac/hmac.c | 29 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/hmac/hmac.h | 28 |
16 files changed, 112 insertions, 122 deletions
diff --git a/src/lib/libcrypto/cmac/cm_ameth.c b/src/lib/libcrypto/cmac/cm_ameth.c index a793e65262..763d161cfe 100644 --- a/src/lib/libcrypto/cmac/cm_ameth.c +++ b/src/lib/libcrypto/cmac/cm_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cm_ameth.c,v 1.4 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cm_ameth.c,v 1.5 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2010. | 3 | * project 2010. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -77,8 +77,7 @@ cmac_key_free(EVP_PKEY *pkey) | |||
77 | CMAC_CTX_free(cmctx); | 77 | CMAC_CTX_free(cmctx); |
78 | } | 78 | } |
79 | 79 | ||
80 | const EVP_PKEY_ASN1_METHOD | 80 | const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { |
81 | cmac_asn1_meth = { | ||
82 | .pkey_id = EVP_PKEY_CMAC, | 81 | .pkey_id = EVP_PKEY_CMAC, |
83 | .pkey_base_id = EVP_PKEY_CMAC, | 82 | .pkey_base_id = EVP_PKEY_CMAC, |
84 | 83 | ||
diff --git a/src/lib/libcrypto/cmac/cm_pmeth.c b/src/lib/libcrypto/cmac/cm_pmeth.c index 3010f91aca..5bb391d053 100644 --- a/src/lib/libcrypto/cmac/cm_pmeth.c +++ b/src/lib/libcrypto/cmac/cm_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cm_pmeth.c,v 1.5 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cm_pmeth.c,v 1.6 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2010. | 3 | * project 2010. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -100,12 +100,12 @@ pkey_cmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | EVP_PKEY_assign(pkey, EVP_PKEY_CMAC, cmkey); | 102 | EVP_PKEY_assign(pkey, EVP_PKEY_CMAC, cmkey); |
103 | 103 | ||
104 | return 1; | 104 | return 1; |
105 | } | 105 | } |
106 | 106 | ||
107 | static int | 107 | static int |
108 | int_update(EVP_MD_CTX *ctx,const void *data,size_t count) | 108 | int_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
109 | { | 109 | { |
110 | if (!CMAC_Update(ctx->pctx->data, data, count)) | 110 | if (!CMAC_Update(ctx->pctx->data, data, count)) |
111 | return 0; | 111 | return 0; |
@@ -193,8 +193,7 @@ pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
193 | return -2; | 193 | return -2; |
194 | } | 194 | } |
195 | 195 | ||
196 | const EVP_PKEY_METHOD | 196 | const EVP_PKEY_METHOD cmac_pkey_meth = { |
197 | cmac_pkey_meth = { | ||
198 | .pkey_id = EVP_PKEY_CMAC, | 197 | .pkey_id = EVP_PKEY_CMAC, |
199 | .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM, | 198 | .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM, |
200 | 199 | ||
diff --git a/src/lib/libcrypto/cmac/cmac.c b/src/lib/libcrypto/cmac/cmac.c index b2f77c59bd..b717f786f1 100644 --- a/src/lib/libcrypto/cmac/cmac.c +++ b/src/lib/libcrypto/cmac/cmac.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cmac.c,v 1.6 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cmac.c,v 1.7 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -217,7 +217,7 @@ CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) | |||
217 | return 1; | 217 | return 1; |
218 | data += nleft; | 218 | data += nleft; |
219 | /* Else not final block so encrypt it */ | 219 | /* Else not final block so encrypt it */ |
220 | if (!EVP_Cipher(&ctx->cctx, ctx->tbl, ctx->last_block,bl)) | 220 | if (!EVP_Cipher(&ctx->cctx, ctx->tbl, ctx->last_block, bl)) |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | /* Encrypt all but one of the complete blocks left */ | 223 | /* Encrypt all but one of the complete blocks left */ |
@@ -257,7 +257,7 @@ CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) | |||
257 | out[i] = ctx->last_block[i] ^ ctx->k2[i]; | 257 | out[i] = ctx->last_block[i] ^ ctx->k2[i]; |
258 | } | 258 | } |
259 | if (!EVP_Cipher(&ctx->cctx, out, out, bl)) { | 259 | if (!EVP_Cipher(&ctx->cctx, out, out, bl)) { |
260 | OPENSSL_cleanse(out, bl); | 260 | OPENSSL_cleanse(out, bl); |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | return 1; | 263 | return 1; |
@@ -272,7 +272,7 @@ CMAC_resume(CMAC_CTX *ctx) | |||
272 | * which is the last IV (or all zeroes if no last encrypted block). | 272 | * which is the last IV (or all zeroes if no last encrypted block). |
273 | * The last block has not been modified since CMAC_final(). | 273 | * The last block has not been modified since CMAC_final(). |
274 | * So reinitialising using the last decrypted block will allow | 274 | * So reinitialising using the last decrypted block will allow |
275 | * CMAC to continue after calling CMAC_Final(). | 275 | * CMAC to continue after calling CMAC_Final(). |
276 | */ | 276 | */ |
277 | return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl); | 277 | return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl); |
278 | } | 278 | } |
diff --git a/src/lib/libcrypto/cmac/cmac.h b/src/lib/libcrypto/cmac/cmac.h index 10ae543f41..cb6d64b02f 100644 --- a/src/lib/libcrypto/cmac/cmac.h +++ b/src/lib/libcrypto/cmac/cmac.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cmac.h,v 1.2 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: cmac.h,v 1.3 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -70,8 +70,8 @@ void CMAC_CTX_free(CMAC_CTX *ctx); | |||
70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); | 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); |
71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); | 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); |
72 | 72 | ||
73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, |
74 | const EVP_CIPHER *cipher, ENGINE *impl); | 74 | const EVP_CIPHER *cipher, ENGINE *impl); |
75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); | 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); |
76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); | 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); |
77 | int CMAC_resume(CMAC_CTX *ctx); | 77 | int CMAC_resume(CMAC_CTX *ctx); |
diff --git a/src/lib/libcrypto/hmac/hm_ameth.c b/src/lib/libcrypto/hmac/hm_ameth.c index ef97918472..c3e9038c0c 100644 --- a/src/lib/libcrypto/hmac/hm_ameth.c +++ b/src/lib/libcrypto/hmac/hm_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hm_ameth.c,v 1.5 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hm_ameth.c,v 1.6 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2007. | 3 | * project 2007. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -134,14 +134,13 @@ old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) | |||
134 | if (inc) | 134 | if (inc) |
135 | *pder += os->length; | 135 | *pder += os->length; |
136 | } | 136 | } |
137 | 137 | ||
138 | return os->length; | 138 | return os->length; |
139 | } | 139 | } |
140 | 140 | ||
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | const EVP_PKEY_ASN1_METHOD | 143 | const EVP_PKEY_ASN1_METHOD hmac_asn1_meth = { |
144 | hmac_asn1_meth = { | ||
145 | .pkey_id = EVP_PKEY_HMAC, | 144 | .pkey_id = EVP_PKEY_HMAC, |
146 | .pkey_base_id = EVP_PKEY_HMAC, | 145 | .pkey_base_id = EVP_PKEY_HMAC, |
147 | 146 | ||
diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c index c1ada08a48..75b5ad469d 100644 --- a/src/lib/libcrypto/hmac/hm_pmeth.c +++ b/src/lib/libcrypto/hmac/hm_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hm_pmeth.c,v 1.5 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hm_pmeth.c,v 1.6 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2007. | 3 | * project 2007. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -100,7 +100,7 @@ pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
100 | 100 | ||
101 | if (!pkey_hmac_init(dst)) | 101 | if (!pkey_hmac_init(dst)) |
102 | return 0; | 102 | return 0; |
103 | sctx = src->data; | 103 | sctx = src->data; |
104 | dctx = dst->data; | 104 | dctx = dst->data; |
105 | dctx->md = sctx->md; | 105 | dctx->md = sctx->md; |
106 | HMAC_CTX_init(&dctx->ctx); | 106 | HMAC_CTX_init(&dctx->ctx); |
@@ -141,12 +141,12 @@ pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
141 | if (!hkey) | 141 | if (!hkey) |
142 | return 0; | 142 | return 0; |
143 | EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey); | 143 | EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey); |
144 | 144 | ||
145 | return 1; | 145 | return 1; |
146 | } | 146 | } |
147 | 147 | ||
148 | static int | 148 | static int |
149 | int_update(EVP_MD_CTX *ctx,const void *data,size_t count) | 149 | int_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
150 | { | 150 | { |
151 | HMAC_PKEY_CTX *hctx = ctx->pctx->data; | 151 | HMAC_PKEY_CTX *hctx = ctx->pctx->data; |
152 | 152 | ||
@@ -186,7 +186,7 @@ hmac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | |||
186 | return 1; | 186 | return 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int | 189 | static int |
190 | pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 190 | pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
191 | { | 191 | { |
192 | HMAC_PKEY_CTX *hctx = ctx->data; | 192 | HMAC_PKEY_CTX *hctx = ctx->data; |
@@ -240,8 +240,7 @@ pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
240 | return -2; | 240 | return -2; |
241 | } | 241 | } |
242 | 242 | ||
243 | const EVP_PKEY_METHOD | 243 | const EVP_PKEY_METHOD hmac_pkey_meth = { |
244 | hmac_pkey_meth = { | ||
245 | .pkey_id = EVP_PKEY_HMAC, | 244 | .pkey_id = EVP_PKEY_HMAC, |
246 | 245 | ||
247 | .init = pkey_hmac_init, | 246 | .init = pkey_hmac_init, |
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 0c29156d80..975fc4d1ec 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: hmac.c,v 1.19 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hmac.c,v 1.20 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -84,17 +84,18 @@ HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, | |||
84 | if (!EVP_DigestUpdate(&ctx->md_ctx, key, len)) | 84 | if (!EVP_DigestUpdate(&ctx->md_ctx, key, len)) |
85 | goto err; | 85 | goto err; |
86 | if (!EVP_DigestFinal_ex(&(ctx->md_ctx), ctx->key, | 86 | if (!EVP_DigestFinal_ex(&(ctx->md_ctx), ctx->key, |
87 | &ctx->key_length)) | 87 | &ctx->key_length)) |
88 | goto err; | 88 | goto err; |
89 | } else { | 89 | } else { |
90 | OPENSSL_assert(len>=0 && len<=(int)sizeof(ctx->key)); | 90 | OPENSSL_assert(len >= 0 && |
91 | memcpy(ctx->key,key,len); | 91 | len <= (int)sizeof(ctx->key)); |
92 | memcpy(ctx->key, key, len); | ||
92 | ctx->key_length = len; | 93 | ctx->key_length = len; |
93 | } | 94 | } |
94 | if (ctx->key_length != HMAC_MAX_MD_CBLOCK) | 95 | if (ctx->key_length != HMAC_MAX_MD_CBLOCK) |
95 | memset(&ctx->key[ctx->key_length], 0, | 96 | memset(&ctx->key[ctx->key_length], 0, |
96 | HMAC_MAX_MD_CBLOCK - ctx->key_length); | 97 | HMAC_MAX_MD_CBLOCK - ctx->key_length); |
97 | } | 98 | } |
98 | 99 | ||
99 | if (reset) { | 100 | if (reset) { |
100 | for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) | 101 | for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) |
@@ -122,14 +123,14 @@ int | |||
122 | HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) | 123 | HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) |
123 | { | 124 | { |
124 | if (key && md) | 125 | if (key && md) |
125 | HMAC_CTX_init(ctx); | 126 | HMAC_CTX_init(ctx); |
126 | return HMAC_Init_ex(ctx,key,len,md, NULL); | 127 | return HMAC_Init_ex(ctx, key, len, md, NULL); |
127 | } | 128 | } |
128 | 129 | ||
129 | int | 130 | int |
130 | HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) | 131 | HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) |
131 | { | 132 | { |
132 | return EVP_DigestUpdate(&ctx->md_ctx,data,len); | 133 | return EVP_DigestUpdate(&ctx->md_ctx, data, len); |
133 | } | 134 | } |
134 | 135 | ||
135 | int | 136 | int |
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h index 5631d465e9..f3418b3cb7 100644 --- a/src/lib/libcrypto/hmac/hmac.h +++ b/src/lib/libcrypto/hmac/hmac.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: hmac.h,v 1.11 2014/06/12 15:49:29 deraadt Exp $ */ | 1 | /* $OpenBSD: hmac.h,v 1.12 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -72,15 +72,14 @@ | |||
72 | extern "C" { | 72 | extern "C" { |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | typedef struct hmac_ctx_st | 75 | typedef struct hmac_ctx_st { |
76 | { | ||
77 | const EVP_MD *md; | 76 | const EVP_MD *md; |
78 | EVP_MD_CTX md_ctx; | 77 | EVP_MD_CTX md_ctx; |
79 | EVP_MD_CTX i_ctx; | 78 | EVP_MD_CTX i_ctx; |
80 | EVP_MD_CTX o_ctx; | 79 | EVP_MD_CTX o_ctx; |
81 | unsigned int key_length; | 80 | unsigned int key_length; |
82 | unsigned char key[HMAC_MAX_MD_CBLOCK]; | 81 | unsigned char key[HMAC_MAX_MD_CBLOCK]; |
83 | } HMAC_CTX; | 82 | } HMAC_CTX; |
84 | 83 | ||
85 | #define HMAC_size(e) (EVP_MD_size((e)->md)) | 84 | #define HMAC_size(e) (EVP_MD_size((e)->md)) |
86 | 85 | ||
@@ -91,14 +90,13 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx); | |||
91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ | 90 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ |
92 | 91 | ||
93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | 92 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, |
94 | const EVP_MD *md); /* deprecated */ | 93 | const EVP_MD *md); /* deprecated */ |
95 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 94 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, |
96 | const EVP_MD *md, ENGINE *impl); | 95 | ENGINE *impl); |
97 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); | 96 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); |
98 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 97 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | 98 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
100 | const unsigned char *d, size_t n, unsigned char *md, | 99 | const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len); |
101 | unsigned int *md_len); | ||
102 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); | 100 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); |
103 | 101 | ||
104 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | 102 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); |
diff --git a/src/lib/libssl/src/crypto/cmac/cm_ameth.c b/src/lib/libssl/src/crypto/cmac/cm_ameth.c index a793e65262..763d161cfe 100644 --- a/src/lib/libssl/src/crypto/cmac/cm_ameth.c +++ b/src/lib/libssl/src/crypto/cmac/cm_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cm_ameth.c,v 1.4 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cm_ameth.c,v 1.5 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2010. | 3 | * project 2010. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -77,8 +77,7 @@ cmac_key_free(EVP_PKEY *pkey) | |||
77 | CMAC_CTX_free(cmctx); | 77 | CMAC_CTX_free(cmctx); |
78 | } | 78 | } |
79 | 79 | ||
80 | const EVP_PKEY_ASN1_METHOD | 80 | const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { |
81 | cmac_asn1_meth = { | ||
82 | .pkey_id = EVP_PKEY_CMAC, | 81 | .pkey_id = EVP_PKEY_CMAC, |
83 | .pkey_base_id = EVP_PKEY_CMAC, | 82 | .pkey_base_id = EVP_PKEY_CMAC, |
84 | 83 | ||
diff --git a/src/lib/libssl/src/crypto/cmac/cm_pmeth.c b/src/lib/libssl/src/crypto/cmac/cm_pmeth.c index 3010f91aca..5bb391d053 100644 --- a/src/lib/libssl/src/crypto/cmac/cm_pmeth.c +++ b/src/lib/libssl/src/crypto/cmac/cm_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cm_pmeth.c,v 1.5 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cm_pmeth.c,v 1.6 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2010. | 3 | * project 2010. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -100,12 +100,12 @@ pkey_cmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | EVP_PKEY_assign(pkey, EVP_PKEY_CMAC, cmkey); | 102 | EVP_PKEY_assign(pkey, EVP_PKEY_CMAC, cmkey); |
103 | 103 | ||
104 | return 1; | 104 | return 1; |
105 | } | 105 | } |
106 | 106 | ||
107 | static int | 107 | static int |
108 | int_update(EVP_MD_CTX *ctx,const void *data,size_t count) | 108 | int_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
109 | { | 109 | { |
110 | if (!CMAC_Update(ctx->pctx->data, data, count)) | 110 | if (!CMAC_Update(ctx->pctx->data, data, count)) |
111 | return 0; | 111 | return 0; |
@@ -193,8 +193,7 @@ pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
193 | return -2; | 193 | return -2; |
194 | } | 194 | } |
195 | 195 | ||
196 | const EVP_PKEY_METHOD | 196 | const EVP_PKEY_METHOD cmac_pkey_meth = { |
197 | cmac_pkey_meth = { | ||
198 | .pkey_id = EVP_PKEY_CMAC, | 197 | .pkey_id = EVP_PKEY_CMAC, |
199 | .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM, | 198 | .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM, |
200 | 199 | ||
diff --git a/src/lib/libssl/src/crypto/cmac/cmac.c b/src/lib/libssl/src/crypto/cmac/cmac.c index b2f77c59bd..b717f786f1 100644 --- a/src/lib/libssl/src/crypto/cmac/cmac.c +++ b/src/lib/libssl/src/crypto/cmac/cmac.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cmac.c,v 1.6 2014/06/21 12:07:02 miod Exp $ */ | 1 | /* $OpenBSD: cmac.c,v 1.7 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -217,7 +217,7 @@ CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) | |||
217 | return 1; | 217 | return 1; |
218 | data += nleft; | 218 | data += nleft; |
219 | /* Else not final block so encrypt it */ | 219 | /* Else not final block so encrypt it */ |
220 | if (!EVP_Cipher(&ctx->cctx, ctx->tbl, ctx->last_block,bl)) | 220 | if (!EVP_Cipher(&ctx->cctx, ctx->tbl, ctx->last_block, bl)) |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | /* Encrypt all but one of the complete blocks left */ | 223 | /* Encrypt all but one of the complete blocks left */ |
@@ -257,7 +257,7 @@ CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) | |||
257 | out[i] = ctx->last_block[i] ^ ctx->k2[i]; | 257 | out[i] = ctx->last_block[i] ^ ctx->k2[i]; |
258 | } | 258 | } |
259 | if (!EVP_Cipher(&ctx->cctx, out, out, bl)) { | 259 | if (!EVP_Cipher(&ctx->cctx, out, out, bl)) { |
260 | OPENSSL_cleanse(out, bl); | 260 | OPENSSL_cleanse(out, bl); |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | return 1; | 263 | return 1; |
@@ -272,7 +272,7 @@ CMAC_resume(CMAC_CTX *ctx) | |||
272 | * which is the last IV (or all zeroes if no last encrypted block). | 272 | * which is the last IV (or all zeroes if no last encrypted block). |
273 | * The last block has not been modified since CMAC_final(). | 273 | * The last block has not been modified since CMAC_final(). |
274 | * So reinitialising using the last decrypted block will allow | 274 | * So reinitialising using the last decrypted block will allow |
275 | * CMAC to continue after calling CMAC_Final(). | 275 | * CMAC to continue after calling CMAC_Final(). |
276 | */ | 276 | */ |
277 | return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl); | 277 | return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl); |
278 | } | 278 | } |
diff --git a/src/lib/libssl/src/crypto/cmac/cmac.h b/src/lib/libssl/src/crypto/cmac/cmac.h index 10ae543f41..cb6d64b02f 100644 --- a/src/lib/libssl/src/crypto/cmac/cmac.h +++ b/src/lib/libssl/src/crypto/cmac/cmac.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cmac.h,v 1.2 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: cmac.h,v 1.3 2014/06/21 13:42:14 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -70,8 +70,8 @@ void CMAC_CTX_free(CMAC_CTX *ctx); | |||
70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); | 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); |
71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); | 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); |
72 | 72 | ||
73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, |
74 | const EVP_CIPHER *cipher, ENGINE *impl); | 74 | const EVP_CIPHER *cipher, ENGINE *impl); |
75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); | 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); |
76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); | 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); |
77 | int CMAC_resume(CMAC_CTX *ctx); | 77 | int CMAC_resume(CMAC_CTX *ctx); |
diff --git a/src/lib/libssl/src/crypto/hmac/hm_ameth.c b/src/lib/libssl/src/crypto/hmac/hm_ameth.c index ef97918472..c3e9038c0c 100644 --- a/src/lib/libssl/src/crypto/hmac/hm_ameth.c +++ b/src/lib/libssl/src/crypto/hmac/hm_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hm_ameth.c,v 1.5 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hm_ameth.c,v 1.6 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2007. | 3 | * project 2007. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -134,14 +134,13 @@ old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) | |||
134 | if (inc) | 134 | if (inc) |
135 | *pder += os->length; | 135 | *pder += os->length; |
136 | } | 136 | } |
137 | 137 | ||
138 | return os->length; | 138 | return os->length; |
139 | } | 139 | } |
140 | 140 | ||
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | const EVP_PKEY_ASN1_METHOD | 143 | const EVP_PKEY_ASN1_METHOD hmac_asn1_meth = { |
144 | hmac_asn1_meth = { | ||
145 | .pkey_id = EVP_PKEY_HMAC, | 144 | .pkey_id = EVP_PKEY_HMAC, |
146 | .pkey_base_id = EVP_PKEY_HMAC, | 145 | .pkey_base_id = EVP_PKEY_HMAC, |
147 | 146 | ||
diff --git a/src/lib/libssl/src/crypto/hmac/hm_pmeth.c b/src/lib/libssl/src/crypto/hmac/hm_pmeth.c index c1ada08a48..75b5ad469d 100644 --- a/src/lib/libssl/src/crypto/hmac/hm_pmeth.c +++ b/src/lib/libssl/src/crypto/hmac/hm_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hm_pmeth.c,v 1.5 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hm_pmeth.c,v 1.6 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2007. | 3 | * project 2007. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -100,7 +100,7 @@ pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
100 | 100 | ||
101 | if (!pkey_hmac_init(dst)) | 101 | if (!pkey_hmac_init(dst)) |
102 | return 0; | 102 | return 0; |
103 | sctx = src->data; | 103 | sctx = src->data; |
104 | dctx = dst->data; | 104 | dctx = dst->data; |
105 | dctx->md = sctx->md; | 105 | dctx->md = sctx->md; |
106 | HMAC_CTX_init(&dctx->ctx); | 106 | HMAC_CTX_init(&dctx->ctx); |
@@ -141,12 +141,12 @@ pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
141 | if (!hkey) | 141 | if (!hkey) |
142 | return 0; | 142 | return 0; |
143 | EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey); | 143 | EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey); |
144 | 144 | ||
145 | return 1; | 145 | return 1; |
146 | } | 146 | } |
147 | 147 | ||
148 | static int | 148 | static int |
149 | int_update(EVP_MD_CTX *ctx,const void *data,size_t count) | 149 | int_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
150 | { | 150 | { |
151 | HMAC_PKEY_CTX *hctx = ctx->pctx->data; | 151 | HMAC_PKEY_CTX *hctx = ctx->pctx->data; |
152 | 152 | ||
@@ -186,7 +186,7 @@ hmac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | |||
186 | return 1; | 186 | return 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int | 189 | static int |
190 | pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 190 | pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
191 | { | 191 | { |
192 | HMAC_PKEY_CTX *hctx = ctx->data; | 192 | HMAC_PKEY_CTX *hctx = ctx->data; |
@@ -240,8 +240,7 @@ pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
240 | return -2; | 240 | return -2; |
241 | } | 241 | } |
242 | 242 | ||
243 | const EVP_PKEY_METHOD | 243 | const EVP_PKEY_METHOD hmac_pkey_meth = { |
244 | hmac_pkey_meth = { | ||
245 | .pkey_id = EVP_PKEY_HMAC, | 244 | .pkey_id = EVP_PKEY_HMAC, |
246 | 245 | ||
247 | .init = pkey_hmac_init, | 246 | .init = pkey_hmac_init, |
diff --git a/src/lib/libssl/src/crypto/hmac/hmac.c b/src/lib/libssl/src/crypto/hmac/hmac.c index 0c29156d80..975fc4d1ec 100644 --- a/src/lib/libssl/src/crypto/hmac/hmac.c +++ b/src/lib/libssl/src/crypto/hmac/hmac.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: hmac.c,v 1.19 2014/06/21 12:00:01 miod Exp $ */ | 1 | /* $OpenBSD: hmac.c,v 1.20 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -84,17 +84,18 @@ HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, | |||
84 | if (!EVP_DigestUpdate(&ctx->md_ctx, key, len)) | 84 | if (!EVP_DigestUpdate(&ctx->md_ctx, key, len)) |
85 | goto err; | 85 | goto err; |
86 | if (!EVP_DigestFinal_ex(&(ctx->md_ctx), ctx->key, | 86 | if (!EVP_DigestFinal_ex(&(ctx->md_ctx), ctx->key, |
87 | &ctx->key_length)) | 87 | &ctx->key_length)) |
88 | goto err; | 88 | goto err; |
89 | } else { | 89 | } else { |
90 | OPENSSL_assert(len>=0 && len<=(int)sizeof(ctx->key)); | 90 | OPENSSL_assert(len >= 0 && |
91 | memcpy(ctx->key,key,len); | 91 | len <= (int)sizeof(ctx->key)); |
92 | memcpy(ctx->key, key, len); | ||
92 | ctx->key_length = len; | 93 | ctx->key_length = len; |
93 | } | 94 | } |
94 | if (ctx->key_length != HMAC_MAX_MD_CBLOCK) | 95 | if (ctx->key_length != HMAC_MAX_MD_CBLOCK) |
95 | memset(&ctx->key[ctx->key_length], 0, | 96 | memset(&ctx->key[ctx->key_length], 0, |
96 | HMAC_MAX_MD_CBLOCK - ctx->key_length); | 97 | HMAC_MAX_MD_CBLOCK - ctx->key_length); |
97 | } | 98 | } |
98 | 99 | ||
99 | if (reset) { | 100 | if (reset) { |
100 | for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) | 101 | for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) |
@@ -122,14 +123,14 @@ int | |||
122 | HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) | 123 | HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) |
123 | { | 124 | { |
124 | if (key && md) | 125 | if (key && md) |
125 | HMAC_CTX_init(ctx); | 126 | HMAC_CTX_init(ctx); |
126 | return HMAC_Init_ex(ctx,key,len,md, NULL); | 127 | return HMAC_Init_ex(ctx, key, len, md, NULL); |
127 | } | 128 | } |
128 | 129 | ||
129 | int | 130 | int |
130 | HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) | 131 | HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) |
131 | { | 132 | { |
132 | return EVP_DigestUpdate(&ctx->md_ctx,data,len); | 133 | return EVP_DigestUpdate(&ctx->md_ctx, data, len); |
133 | } | 134 | } |
134 | 135 | ||
135 | int | 136 | int |
diff --git a/src/lib/libssl/src/crypto/hmac/hmac.h b/src/lib/libssl/src/crypto/hmac/hmac.h index 5631d465e9..f3418b3cb7 100644 --- a/src/lib/libssl/src/crypto/hmac/hmac.h +++ b/src/lib/libssl/src/crypto/hmac/hmac.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: hmac.h,v 1.11 2014/06/12 15:49:29 deraadt Exp $ */ | 1 | /* $OpenBSD: hmac.h,v 1.12 2014/06/21 13:39:46 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -72,15 +72,14 @@ | |||
72 | extern "C" { | 72 | extern "C" { |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | typedef struct hmac_ctx_st | 75 | typedef struct hmac_ctx_st { |
76 | { | ||
77 | const EVP_MD *md; | 76 | const EVP_MD *md; |
78 | EVP_MD_CTX md_ctx; | 77 | EVP_MD_CTX md_ctx; |
79 | EVP_MD_CTX i_ctx; | 78 | EVP_MD_CTX i_ctx; |
80 | EVP_MD_CTX o_ctx; | 79 | EVP_MD_CTX o_ctx; |
81 | unsigned int key_length; | 80 | unsigned int key_length; |
82 | unsigned char key[HMAC_MAX_MD_CBLOCK]; | 81 | unsigned char key[HMAC_MAX_MD_CBLOCK]; |
83 | } HMAC_CTX; | 82 | } HMAC_CTX; |
84 | 83 | ||
85 | #define HMAC_size(e) (EVP_MD_size((e)->md)) | 84 | #define HMAC_size(e) (EVP_MD_size((e)->md)) |
86 | 85 | ||
@@ -91,14 +90,13 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx); | |||
91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ | 90 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ |
92 | 91 | ||
93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | 92 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, |
94 | const EVP_MD *md); /* deprecated */ | 93 | const EVP_MD *md); /* deprecated */ |
95 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 94 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, |
96 | const EVP_MD *md, ENGINE *impl); | 95 | ENGINE *impl); |
97 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); | 96 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); |
98 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 97 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | 98 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
100 | const unsigned char *d, size_t n, unsigned char *md, | 99 | const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len); |
101 | unsigned int *md_len); | ||
102 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); | 100 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); |
103 | 101 | ||
104 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | 102 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); |