summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-07-04 12:23:30 +0000
committertb <>2022-07-04 12:23:30 +0000
commit001d570e10bf848d5ae9372289014edc9f96a25c (patch)
tree65cb8fb0a7d0b85629c73dff7c030b06f1cba708 /src
parent00e824726e67ac60f4500af3e2eb04bc6165190b (diff)
downloadopenbsd-001d570e10bf848d5ae9372289014edc9f96a25c.tar.gz
openbsd-001d570e10bf848d5ae9372289014edc9f96a25c.tar.bz2
openbsd-001d570e10bf848d5ae9372289014edc9f96a25c.zip
Sync with changes in dsa_meth.c
pointed out by jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/rsa/rsa_locl.h4
-rw-r--r--src/lib/libcrypto/rsa/rsa_meth.c19
2 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_locl.h b/src/lib/libcrypto/rsa/rsa_locl.h
index 9eae2b3a24..1a2412ad80 100644
--- a/src/lib/libcrypto/rsa/rsa_locl.h
+++ b/src/lib/libcrypto/rsa/rsa_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_locl.h,v 1.12 2022/01/14 08:34:39 tb Exp $ */ 1/* $OpenBSD: rsa_locl.h,v 1.13 2022/07/04 12:23:30 tb Exp $ */
2 2
3__BEGIN_HIDDEN_DECLS 3__BEGIN_HIDDEN_DECLS
4 4
@@ -9,7 +9,7 @@ __BEGIN_HIDDEN_DECLS
9#define pkey_ctx_is_pss(ctx) (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS) 9#define pkey_ctx_is_pss(ctx) (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS)
10 10
11struct rsa_meth_st { 11struct rsa_meth_st {
12 const char *name; 12 char *name;
13 int (*rsa_pub_enc)(int flen, const unsigned char *from, 13 int (*rsa_pub_enc)(int flen, const unsigned char *from,
14 unsigned char *to, RSA *rsa, int padding); 14 unsigned char *to, RSA *rsa, int padding);
15 int (*rsa_pub_dec)(int flen, const unsigned char *from, 15 int (*rsa_pub_dec)(int flen, const unsigned char *from,
diff --git a/src/lib/libcrypto/rsa/rsa_meth.c b/src/lib/libcrypto/rsa/rsa_meth.c
index 8ae929dc3d..d6be1ea006 100644
--- a/src/lib/libcrypto/rsa/rsa_meth.c
+++ b/src/lib/libcrypto/rsa/rsa_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_meth.c,v 1.4 2022/01/07 09:55:32 tb Exp $ */ 1/* $OpenBSD: rsa_meth.c,v 1.5 2022/07/04 12:23:30 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -42,10 +42,11 @@ RSA_meth_new(const char *name, int flags)
42void 42void
43RSA_meth_free(RSA_METHOD *meth) 43RSA_meth_free(RSA_METHOD *meth)
44{ 44{
45 if (meth != NULL) { 45 if (meth == NULL)
46 free((char *)meth->name); 46 return;
47 free(meth); 47
48 } 48 free(meth->name);
49 free(meth);
49} 50}
50 51
51RSA_METHOD * 52RSA_METHOD *
@@ -67,12 +68,12 @@ RSA_meth_dup(const RSA_METHOD *meth)
67int 68int
68RSA_meth_set1_name(RSA_METHOD *meth, const char *name) 69RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
69{ 70{
70 char *copy; 71 char *new_name;
71 72
72 if ((copy = strdup(name)) == NULL) 73 if ((new_name = strdup(name)) == NULL)
73 return 0; 74 return 0;
74 free((char *)meth->name); 75 free(meth->name);
75 meth->name = copy; 76 meth->name = new_name;
76 return 1; 77 return 1;
77} 78}
78 79