summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2024-07-09 16:48:39 +0000
committertb <>2024-07-09 16:48:39 +0000
commitfa333ee4feaa608fe18e845547d1aa8236d4a338 (patch)
tree7b47ef07e80e5d1d416fbc6982d391ce864def86 /src/lib
parentd18b9b385bf350bff246bf3e3ddc21de33457869 (diff)
downloadopenbsd-fa333ee4feaa608fe18e845547d1aa8236d4a338.tar.gz
openbsd-fa333ee4feaa608fe18e845547d1aa8236d4a338.tar.bz2
openbsd-fa333ee4feaa608fe18e845547d1aa8236d4a338.zip
Replace local typedef with spelling out the struct name
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 837416c640..3ea7329f36 100644
--- a/src/lib/libcrypto/kdf/tls1_prf.c
+++ b/src/lib/libcrypto/kdf/tls1_prf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls1_prf.c,v 1.16 2024/07/09 16:47:36 tb Exp $ */ 1/* $OpenBSD: tls1_prf.c,v 1.17 2024/07/09 16:48:39 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4 * 2016. 4 * 2016.
@@ -74,18 +74,18 @@ static int tls1_prf_alg(const EVP_MD *md,
74 74
75#define TLS1_PRF_MAXBUF 1024 75#define TLS1_PRF_MAXBUF 1024
76 76
77typedef struct { 77struct tls1_prf_ctx {
78 const EVP_MD *md; 78 const EVP_MD *md;
79 unsigned char *sec; 79 unsigned char *sec;
80 size_t seclen; 80 size_t seclen;
81 unsigned char seed[TLS1_PRF_MAXBUF]; 81 unsigned char seed[TLS1_PRF_MAXBUF];
82 size_t seedlen; 82 size_t seedlen;
83} TLS1_PRF_PKEY_CTX; 83};
84 84
85static int 85static int
86pkey_tls1_prf_init(EVP_PKEY_CTX *ctx) 86pkey_tls1_prf_init(EVP_PKEY_CTX *ctx)
87{ 87{
88 TLS1_PRF_PKEY_CTX *kctx; 88 struct tls1_prf_ctx *kctx;
89 89
90 if ((kctx = calloc(1, sizeof(*kctx))) == NULL) { 90 if ((kctx = calloc(1, sizeof(*kctx))) == NULL) {
91 KDFerror(ERR_R_MALLOC_FAILURE); 91 KDFerror(ERR_R_MALLOC_FAILURE);
@@ -99,7 +99,7 @@ pkey_tls1_prf_init(EVP_PKEY_CTX *ctx)
99static void 99static void
100pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx) 100pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx)
101{ 101{
102 TLS1_PRF_PKEY_CTX *kctx = ctx->data; 102 struct tls1_prf_ctx *kctx = ctx->data;
103 freezero(kctx->sec, kctx->seclen); 103 freezero(kctx->sec, kctx->seclen);
104 explicit_bzero(kctx->seed, kctx->seedlen); 104 explicit_bzero(kctx->seed, kctx->seedlen);
105 free(kctx); 105 free(kctx);
@@ -108,7 +108,7 @@ pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx)
108static int 108static int
109pkey_tls1_prf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) 109pkey_tls1_prf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
110{ 110{
111 TLS1_PRF_PKEY_CTX *kctx = ctx->data; 111 struct tls1_prf_ctx *kctx = ctx->data;
112 switch (type) { 112 switch (type) {
113 case EVP_PKEY_CTRL_TLS_MD: 113 case EVP_PKEY_CTRL_TLS_MD:
114 kctx->md = p2; 114 kctx->md = p2;
@@ -159,7 +159,7 @@ pkey_tls1_prf_ctrl_str(EVP_PKEY_CTX *ctx,
159 return 0; 159 return 0;
160 } 160 }
161 if (strcmp(type, "md") == 0) { 161 if (strcmp(type, "md") == 0) {
162 TLS1_PRF_PKEY_CTX *kctx = ctx->data; 162 struct tls1_prf_ctx *kctx = ctx->data;
163 163
164 const EVP_MD *md = EVP_get_digestbyname(value); 164 const EVP_MD *md = EVP_get_digestbyname(value);
165 if (md == NULL) { 165 if (md == NULL) {
@@ -190,7 +190,7 @@ static int
190pkey_tls1_prf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, 190pkey_tls1_prf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
191 size_t *keylen) 191 size_t *keylen)
192{ 192{
193 TLS1_PRF_PKEY_CTX *kctx = ctx->data; 193 struct tls1_prf_ctx *kctx = ctx->data;
194 if (kctx->md == NULL) { 194 if (kctx->md == NULL) {
195 KDFerror(KDF_R_MISSING_MESSAGE_DIGEST); 195 KDFerror(KDF_R_MISSING_MESSAGE_DIGEST);
196 return 0; 196 return 0;