From 4b39dd3dc4173a41555734c8ac223e9d7999ecd2 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 7 Apr 2026 13:16:41 +0000 Subject: [PATCH] Rename labellen to label_len Requested by jsing, ok beck --- lib/libcrypto/rsa/rsa_ameth.c | 26 +++++++++++++------------- lib/libcrypto/rsa/rsa_pmeth.c | 22 +++++++++++----------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/libcrypto/rsa/rsa_ameth.c b/lib/libcrypto/rsa/rsa_ameth.c index 2aea9c48482..aca00a9ec8c 100644 --- a/lib/libcrypto/rsa/rsa_ameth.c +++ b/lib/libcrypto/rsa/rsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ameth.c,v 1.64 2026/04/07 13:15:29 tb Exp $ */ +/* $OpenBSD: rsa_ameth.c,v 1.65 2026/04/07 13:16:41 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -994,15 +994,15 @@ rsa_alg_set_oaep_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) ASN1_STRING *astr = NULL; ASN1_OCTET_STRING *ostr = NULL; unsigned char *label; - int labellen; + int label_len; int ret = 0; if (EVP_PKEY_CTX_get_rsa_oaep_md(pkey_ctx, &md) <= 0) goto err; if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkey_ctx, &mgf1md) <= 0) goto err; - labellen = EVP_PKEY_CTX_get0_rsa_oaep_label(pkey_ctx, &label); - if (labellen < 0) + label_len = EVP_PKEY_CTX_get0_rsa_oaep_label(pkey_ctx, &label); + if (label_len < 0) goto err; if ((oaep = RSA_OAEP_PARAMS_new()) == NULL) @@ -1015,12 +1015,12 @@ rsa_alg_set_oaep_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) /* XXX - why do we not set oaep->maskHash here? */ - if (labellen > 0) { + if (label_len > 0) { if ((oaep->pSourceFunc = X509_ALGOR_new()) == NULL) goto err; if ((ostr = ASN1_OCTET_STRING_new()) == NULL) goto err; - if (!ASN1_OCTET_STRING_set(ostr, label, labellen)) + if (!ASN1_OCTET_STRING_set(ostr, label, label_len)) goto err; if (!X509_ALGOR_set0_by_nid(oaep->pSourceFunc, NID_pSpecified, V_ASN1_OCTET_STRING, ostr)) @@ -1117,7 +1117,7 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) int nid; int rv = -1; unsigned char *label = NULL; - int labellen = 0; + int label_len = 0; const EVP_MD *mgf1md = NULL, *md = NULL; RSA_OAEP_PARAMS *oaep; @@ -1164,14 +1164,14 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) goto err; } - if ((labellen = ASN1_STRING_length(parameter)) == 0) { + if ((label_len = ASN1_STRING_length(parameter)) == 0) { RSAerror(RSA_R_INVALID_LABEL); goto err; } - if ((label = calloc(1, labellen)) == NULL) + if ((label = calloc(1, label_len)) == NULL) goto err; - memcpy(label, ASN1_STRING_get0_data(parameter), labellen); + memcpy(label, ASN1_STRING_get0_data(parameter), label_len); } if (EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) <= 0) @@ -1180,16 +1180,16 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) goto err; if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkctx, mgf1md) <= 0) goto err; - if (EVP_PKEY_CTX_set0_rsa_oaep_label(pkctx, label, labellen) <= 0) + if (EVP_PKEY_CTX_set0_rsa_oaep_label(pkctx, label, label_len) <= 0) goto err; label = NULL; - labellen = 0; + label_len = 0; rv = 1; err: RSA_OAEP_PARAMS_free(oaep); - freezero(label, labellen); + freezero(label, label_len); return rv; } diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c index b1b8e8c6753..0b7cd005a97 100644 --- a/lib/libcrypto/rsa/rsa_pmeth.c +++ b/lib/libcrypto/rsa/rsa_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pmeth.c,v 1.45 2026/04/07 13:15:29 tb Exp $ */ +/* $OpenBSD: rsa_pmeth.c,v 1.46 2026/04/07 13:16:41 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -97,7 +97,7 @@ typedef struct { unsigned char *tbuf; /* OAEP label */ unsigned char *oaep_label; - size_t oaep_labellen; + size_t oaep_label_len; } RSA_PKEY_CTX; /* True if PSS parameters are restricted */ @@ -150,10 +150,10 @@ pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) dctx->mgf1md = sctx->mgf1md; if (sctx->oaep_label != NULL) { free(dctx->oaep_label); - if ((dctx->oaep_label = calloc(1, sctx->oaep_labellen)) == NULL) + if ((dctx->oaep_label = calloc(1, sctx->oaep_label_len)) == NULL) return 0; - memcpy(dctx->oaep_label, sctx->oaep_label, sctx->oaep_labellen); - dctx->oaep_labellen = sctx->oaep_labellen; + memcpy(dctx->oaep_label, sctx->oaep_label, sctx->oaep_label_len); + dctx->oaep_label_len = sctx->oaep_label_len; } return 1; @@ -357,7 +357,7 @@ pkey_rsa_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, if (!setup_tbuf(rctx, ctx)) return -1; if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen, - in, inlen, rctx->oaep_label, rctx->oaep_labellen, + in, inlen, rctx->oaep_label, rctx->oaep_label_len, rctx->md, rctx->mgf1md)) return -1; ret = RSA_public_encrypt(klen, rctx->tbuf, out, @@ -387,7 +387,7 @@ pkey_rsa_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, if (ret <= 0) return ret; ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf, - ret, ret, rctx->oaep_label, rctx->oaep_labellen, rctx->md, + ret, ret, rctx->oaep_label, rctx->oaep_label_len, rctx->md, rctx->mgf1md); } else { ret = RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa, @@ -583,13 +583,13 @@ pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) RSAerror(RSA_R_INVALID_PADDING_MODE); return -2; } - freezero(rctx->oaep_label, rctx->oaep_labellen); + freezero(rctx->oaep_label, rctx->oaep_label_len); if (p2 != NULL && p1 > 0) { rctx->oaep_label = p2; - rctx->oaep_labellen = p1; + rctx->oaep_label_len = p1; } else { rctx->oaep_label = NULL; - rctx->oaep_labellen = 0; + rctx->oaep_label_len = 0; } return 1; @@ -599,7 +599,7 @@ pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return -2; } *(unsigned char **)p2 = rctx->oaep_label; - return rctx->oaep_labellen; + return rctx->oaep_label_len; case EVP_PKEY_CTRL_DIGESTINIT: case EVP_PKEY_CTRL_PKCS7_SIGN: