From 001d570e10bf848d5ae9372289014edc9f96a25c Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 4 Jul 2022 12:23:30 +0000 Subject: Sync with changes in dsa_meth.c pointed out by jsing --- src/lib/libcrypto/rsa/rsa_locl.h | 4 ++-- src/lib/libcrypto/rsa/rsa_meth.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: rsa_locl.h,v 1.12 2022/01/14 08:34:39 tb Exp $ */ +/* $OpenBSD: rsa_locl.h,v 1.13 2022/07/04 12:23:30 tb Exp $ */ __BEGIN_HIDDEN_DECLS @@ -9,7 +9,7 @@ __BEGIN_HIDDEN_DECLS #define pkey_ctx_is_pss(ctx) (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS) struct rsa_meth_st { - const char *name; + char *name; int (*rsa_pub_enc)(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); 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 @@ -/* $OpenBSD: rsa_meth.c,v 1.4 2022/01/07 09:55:32 tb Exp $ */ +/* $OpenBSD: rsa_meth.c,v 1.5 2022/07/04 12:23:30 tb Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -42,10 +42,11 @@ RSA_meth_new(const char *name, int flags) void RSA_meth_free(RSA_METHOD *meth) { - if (meth != NULL) { - free((char *)meth->name); - free(meth); - } + if (meth == NULL) + return; + + free(meth->name); + free(meth); } RSA_METHOD * @@ -67,12 +68,12 @@ RSA_meth_dup(const RSA_METHOD *meth) int RSA_meth_set1_name(RSA_METHOD *meth, const char *name) { - char *copy; + char *new_name; - if ((copy = strdup(name)) == NULL) + if ((new_name = strdup(name)) == NULL) return 0; - free((char *)meth->name); - meth->name = copy; + free(meth->name); + meth->name = new_name; return 1; } -- cgit v1.2.3-55-g6feb