From: tb Date: Mon, 4 Jul 2022 12:23:30 +0000 (+0000) Subject: Sync with changes in dsa_meth.c X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d77d95a1a1f28bb00979a1ecc6cdb1a03c32f40a;p=openbsd Sync with changes in dsa_meth.c pointed out by jsing --- diff --git a/lib/libcrypto/rsa/rsa_locl.h b/lib/libcrypto/rsa/rsa_locl.h index 9eae2b3a24b..1a2412ad808 100644 --- a/lib/libcrypto/rsa/rsa_locl.h +++ b/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/lib/libcrypto/rsa/rsa_meth.c b/lib/libcrypto/rsa/rsa_meth.c index 8ae929dc3d8..d6be1ea0063 100644 --- a/lib/libcrypto/rsa/rsa_meth.c +++ b/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; }