1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-16 18:24:23 +00:00

Rename labellen to label_len

Requested by jsing, ok beck
This commit is contained in:
tb
2026-04-07 13:16:41 +00:00
parent 2fc71f321f
commit 4b39dd3dc4
2 changed files with 24 additions and 24 deletions

View File

@@ -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;
}

View File

@@ -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: