summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-11-18 14:45:10 +0000
committertb <>2022-11-18 14:45:10 +0000
commit54b961b017cbfded9bc4892699ccbc35bebf5c6f (patch)
tree48e2b4585e54a8205c6dbeb0131ead3e7cfc4d15
parent5673137f00930926e8191aab226a21afaea9ad31 (diff)
downloadopenbsd-54b961b017cbfded9bc4892699ccbc35bebf5c6f.tar.gz
openbsd-54b961b017cbfded9bc4892699ccbc35bebf5c6f.tar.bz2
openbsd-54b961b017cbfded9bc4892699ccbc35bebf5c6f.zip
Change the pkey.ptr from char * to void *
Now that EVP_PKEY is opaque, there is no reason to keep the ptr member of the pkey union as a weird char pointer, a void pointer will do. This avoids a few stupid casts and simplifies an upcoming diff. ok jsing
-rw-r--r--src/lib/libcrypto/cmac/cm_ameth.c6
-rw-r--r--src/lib/libcrypto/cmac/cm_pmeth.c5
-rw-r--r--src/lib/libcrypto/evp/evp_locl.h4
-rw-r--r--src/lib/libcrypto/evp/p_lib.c4
-rw-r--r--src/lib/libcrypto/hmac/hm_ameth.c6
-rw-r--r--src/lib/libcrypto/hmac/hm_pmeth.c4
6 files changed, 13 insertions, 16 deletions
diff --git a/src/lib/libcrypto/cmac/cm_ameth.c b/src/lib/libcrypto/cmac/cm_ameth.c
index 26956465ee..1bc20082c1 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.8 2021/12/12 21:30:13 tb Exp $ */ 1/* $OpenBSD: cm_ameth.c,v 1.9 2022/11/18 14:45:10 tb 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 */
@@ -73,9 +73,7 @@ cmac_size(const EVP_PKEY *pkey)
73static void 73static void
74cmac_key_free(EVP_PKEY *pkey) 74cmac_key_free(EVP_PKEY *pkey)
75{ 75{
76 CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr; 76 CMAC_CTX_free(pkey->pkey.ptr);
77
78 CMAC_CTX_free(cmctx);
79} 77}
80 78
81const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { 79const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
diff --git a/src/lib/libcrypto/cmac/cm_pmeth.c b/src/lib/libcrypto/cmac/cm_pmeth.c
index d9059ca4a8..91f7e34c29 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.8 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: cm_pmeth.c,v 1.9 2022/11/18 14:45:10 tb 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 */
@@ -148,8 +148,7 @@ pkey_cmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
148 break; 148 break;
149 149
150 case EVP_PKEY_CTRL_MD: 150 case EVP_PKEY_CTRL_MD:
151 if (ctx->pkey && !CMAC_CTX_copy(ctx->data, 151 if (ctx->pkey && !CMAC_CTX_copy(ctx->data, ctx->pkey->pkey.ptr))
152 (CMAC_CTX *)ctx->pkey->pkey.ptr))
153 return 0; 152 return 0;
154 if (!CMAC_Init(cmctx, NULL, 0, NULL, NULL)) 153 if (!CMAC_Init(cmctx, NULL, 0, NULL, NULL))
155 return 0; 154 return 0;
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h
index 37fc55eb9c..2bfcc6448e 100644
--- a/src/lib/libcrypto/evp/evp_locl.h
+++ b/src/lib/libcrypto/evp/evp_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_locl.h,v 1.30 2022/11/10 16:37:52 jsing Exp $ */ 1/* $OpenBSD: evp_locl.h,v 1.31 2022/11/18 14:45:10 tb 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 2000. 3 * project 2000.
4 */ 4 */
@@ -93,7 +93,7 @@ struct evp_pkey_st {
93 const EVP_PKEY_ASN1_METHOD *ameth; 93 const EVP_PKEY_ASN1_METHOD *ameth;
94 ENGINE *engine; 94 ENGINE *engine;
95 union { 95 union {
96 char *ptr; 96 void *ptr;
97#ifndef OPENSSL_NO_RSA 97#ifndef OPENSSL_NO_RSA
98 struct rsa_st *rsa; /* RSA */ 98 struct rsa_st *rsa; /* RSA */
99#endif 99#endif
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 2e0830b96e..ec3949b4c1 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.30 2022/11/10 14:46:44 jsing Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.31 2022/11/18 14:45:10 tb 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 *
@@ -388,7 +388,7 @@ EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, size_t len,
388 goto err; 388 goto err;
389 } 389 }
390 390
391 ret->pkey.ptr = (char *)cmctx; 391 ret->pkey.ptr = cmctx;
392 392
393 return ret; 393 return ret;
394 394
diff --git a/src/lib/libcrypto/hmac/hm_ameth.c b/src/lib/libcrypto/hmac/hm_ameth.c
index 84bb5f0c07..86e42bdfab 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.12 2021/12/12 21:30:14 tb Exp $ */ 1/* $OpenBSD: hm_ameth.c,v 1.13 2022/11/18 14:45:10 tb 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 */
@@ -82,7 +82,7 @@ hmac_size(const EVP_PKEY *pkey)
82static void 82static void
83hmac_key_free(EVP_PKEY *pkey) 83hmac_key_free(EVP_PKEY *pkey)
84{ 84{
85 ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr; 85 ASN1_OCTET_STRING *os = pkey->pkey.ptr;
86 86
87 if (os) { 87 if (os) {
88 if (os->data) 88 if (os->data)
@@ -132,7 +132,7 @@ static int
132old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) 132old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
133{ 133{
134 int inc; 134 int inc;
135 ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr; 135 ASN1_OCTET_STRING *os = pkey->pkey.ptr;
136 136
137 if (pder) { 137 if (pder) {
138 if (!*pder) { 138 if (!*pder) {
diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c
index 4017f570b8..3ba5b47027 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.13 2022/03/30 07:17:48 tb Exp $ */ 1/* $OpenBSD: hm_pmeth.c,v 1.14 2022/11/18 14:45:10 tb 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 */
@@ -202,7 +202,7 @@ pkey_hmac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
202 break; 202 break;
203 203
204 case EVP_PKEY_CTRL_DIGESTINIT: 204 case EVP_PKEY_CTRL_DIGESTINIT:
205 key = (ASN1_OCTET_STRING *)ctx->pkey->pkey.ptr; 205 key = ctx->pkey->pkey.ptr;
206 if (!HMAC_Init_ex(&hctx->ctx, key->data, key->length, hctx->md, 206 if (!HMAC_Init_ex(&hctx->ctx, key->data, key->length, hctx->md,
207 ctx->engine)) 207 ctx->engine))
208 return 0; 208 return 0;