-/* $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
#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,
-/* $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 <tb@openbsd.org>
*
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 *
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;
}