summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/kdf/tls1_prf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/kdf/tls1_prf.c b/src/lib/libcrypto/kdf/tls1_prf.c
index e9ca8e1278..5b6ea97241 100644
--- a/src/lib/libcrypto/kdf/tls1_prf.c
+++ b/src/lib/libcrypto/kdf/tls1_prf.c
@@ -38,7 +38,7 @@ static int pkey_tls1_prf_init(EVP_PKEY_CTX *ctx)
38 TLS1_PRF_PKEY_CTX *kctx; 38 TLS1_PRF_PKEY_CTX *kctx;
39 39
40 if ((kctx = OPENSSL_zalloc(sizeof(*kctx))) == NULL) { 40 if ((kctx = OPENSSL_zalloc(sizeof(*kctx))) == NULL) {
41 KDFerr(KDF_F_PKEY_TLS1_PRF_INIT, ERR_R_MALLOC_FAILURE); 41 KDFerror(ERR_R_MALLOC_FAILURE);
42 return 0; 42 return 0;
43 } 43 }
44 ctx->data = kctx; 44 ctx->data = kctx;
@@ -94,7 +94,7 @@ static int pkey_tls1_prf_ctrl_str(EVP_PKEY_CTX *ctx,
94 const char *type, const char *value) 94 const char *type, const char *value)
95{ 95{
96 if (value == NULL) { 96 if (value == NULL) {
97 KDFerr(KDF_F_PKEY_TLS1_PRF_CTRL_STR, KDF_R_VALUE_MISSING); 97 KDFerror(KDF_R_VALUE_MISSING);
98 return 0; 98 return 0;
99 } 99 }
100 if (strcmp(type, "md") == 0) { 100 if (strcmp(type, "md") == 0) {
@@ -102,7 +102,7 @@ static int pkey_tls1_prf_ctrl_str(EVP_PKEY_CTX *ctx,
102 102
103 const EVP_MD *md = EVP_get_digestbyname(value); 103 const EVP_MD *md = EVP_get_digestbyname(value);
104 if (md == NULL) { 104 if (md == NULL) {
105 KDFerr(KDF_F_PKEY_TLS1_PRF_CTRL_STR, KDF_R_INVALID_DIGEST); 105 KDFerror(KDF_R_INVALID_DIGEST);
106 return 0; 106 return 0;
107 } 107 }
108 kctx->md = md; 108 kctx->md = md;
@@ -117,7 +117,7 @@ static int pkey_tls1_prf_ctrl_str(EVP_PKEY_CTX *ctx,
117 if (strcmp(type, "hexseed") == 0) 117 if (strcmp(type, "hexseed") == 0)
118 return EVP_PKEY_CTX_hex2ctrl(ctx, EVP_PKEY_CTRL_TLS_SEED, value); 118 return EVP_PKEY_CTX_hex2ctrl(ctx, EVP_PKEY_CTRL_TLS_SEED, value);
119 119
120 KDFerr(KDF_F_PKEY_TLS1_PRF_CTRL_STR, KDF_R_UNKNOWN_PARAMETER_TYPE); 120 KDFerror(KDF_R_UNKNOWN_PARAMETER_TYPE);
121 return -2; 121 return -2;
122} 122}
123 123
@@ -126,15 +126,15 @@ static int pkey_tls1_prf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
126{ 126{
127 TLS1_PRF_PKEY_CTX *kctx = ctx->data; 127 TLS1_PRF_PKEY_CTX *kctx = ctx->data;
128 if (kctx->md == NULL) { 128 if (kctx->md == NULL) {
129 KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_MESSAGE_DIGEST); 129 KDFerror(KDF_R_MISSING_MESSAGE_DIGEST);
130 return 0; 130 return 0;
131 } 131 }
132 if (kctx->sec == NULL) { 132 if (kctx->sec == NULL) {
133 KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_SECRET); 133 KDFerror(KDF_R_MISSING_SECRET);
134 return 0; 134 return 0;
135 } 135 }
136 if (kctx->seedlen == 0) { 136 if (kctx->seedlen == 0) {
137 KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_SEED); 137 KDFerror(KDF_R_MISSING_SEED);
138 return 0; 138 return 0;
139 } 139 }
140 return tls1_prf_alg(kctx->md, kctx->sec, kctx->seclen, 140 return tls1_prf_alg(kctx->md, kctx->sec, kctx->seclen,
@@ -258,7 +258,7 @@ static int tls1_prf_alg(const EVP_MD *md,
258 return 0; 258 return 0;
259 259
260 if ((tmp = OPENSSL_malloc(olen)) == NULL) { 260 if ((tmp = OPENSSL_malloc(olen)) == NULL) {
261 KDFerr(KDF_F_TLS1_PRF_ALG, ERR_R_MALLOC_FAILURE); 261 KDFerror(ERR_R_MALLOC_FAILURE);
262 return 0; 262 return 0;
263 } 263 }
264 if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1), 264 if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),