diff options
| author | tb <> | 2026-04-07 13:16:41 +0000 |
|---|---|---|
| committer | tb <> | 2026-04-07 13:16:41 +0000 |
| commit | 825b6076f1b1772665d1adce40e8087ee4e3d091 (patch) | |
| tree | a3807d8e6ee742d2eecf64e0431decd553d4d54e /src/lib/libcrypto | |
| parent | e783182e57d664df5859c6b6cbd65563cdc26528 (diff) | |
| download | openbsd-825b6076f1b1772665d1adce40e8087ee4e3d091.tar.gz openbsd-825b6076f1b1772665d1adce40e8087ee4e3d091.tar.bz2 openbsd-825b6076f1b1772665d1adce40e8087ee4e3d091.zip | |
Rename labellen to label_len
Requested by jsing, ok beck
Diffstat (limited to 'src/lib/libcrypto')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 26 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_pmeth.c | 22 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 2aea9c4848..aca00a9ec8 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_ameth.c,v 1.64 2026/04/07 13:15:29 tb Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.65 2026/04/07 13:16:41 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -994,15 +994,15 @@ rsa_alg_set_oaep_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) | |||
| 994 | ASN1_STRING *astr = NULL; | 994 | ASN1_STRING *astr = NULL; |
| 995 | ASN1_OCTET_STRING *ostr = NULL; | 995 | ASN1_OCTET_STRING *ostr = NULL; |
| 996 | unsigned char *label; | 996 | unsigned char *label; |
| 997 | int labellen; | 997 | int label_len; |
| 998 | int ret = 0; | 998 | int ret = 0; |
| 999 | 999 | ||
| 1000 | if (EVP_PKEY_CTX_get_rsa_oaep_md(pkey_ctx, &md) <= 0) | 1000 | if (EVP_PKEY_CTX_get_rsa_oaep_md(pkey_ctx, &md) <= 0) |
| 1001 | goto err; | 1001 | goto err; |
| 1002 | if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkey_ctx, &mgf1md) <= 0) | 1002 | if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkey_ctx, &mgf1md) <= 0) |
| 1003 | goto err; | 1003 | goto err; |
| 1004 | labellen = EVP_PKEY_CTX_get0_rsa_oaep_label(pkey_ctx, &label); | 1004 | label_len = EVP_PKEY_CTX_get0_rsa_oaep_label(pkey_ctx, &label); |
| 1005 | if (labellen < 0) | 1005 | if (label_len < 0) |
| 1006 | goto err; | 1006 | goto err; |
| 1007 | 1007 | ||
| 1008 | if ((oaep = RSA_OAEP_PARAMS_new()) == NULL) | 1008 | if ((oaep = RSA_OAEP_PARAMS_new()) == NULL) |
| @@ -1015,12 +1015,12 @@ rsa_alg_set_oaep_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) | |||
| 1015 | 1015 | ||
| 1016 | /* XXX - why do we not set oaep->maskHash here? */ | 1016 | /* XXX - why do we not set oaep->maskHash here? */ |
| 1017 | 1017 | ||
| 1018 | if (labellen > 0) { | 1018 | if (label_len > 0) { |
| 1019 | if ((oaep->pSourceFunc = X509_ALGOR_new()) == NULL) | 1019 | if ((oaep->pSourceFunc = X509_ALGOR_new()) == NULL) |
| 1020 | goto err; | 1020 | goto err; |
| 1021 | if ((ostr = ASN1_OCTET_STRING_new()) == NULL) | 1021 | if ((ostr = ASN1_OCTET_STRING_new()) == NULL) |
| 1022 | goto err; | 1022 | goto err; |
| 1023 | if (!ASN1_OCTET_STRING_set(ostr, label, labellen)) | 1023 | if (!ASN1_OCTET_STRING_set(ostr, label, label_len)) |
| 1024 | goto err; | 1024 | goto err; |
| 1025 | if (!X509_ALGOR_set0_by_nid(oaep->pSourceFunc, NID_pSpecified, | 1025 | if (!X509_ALGOR_set0_by_nid(oaep->pSourceFunc, NID_pSpecified, |
| 1026 | V_ASN1_OCTET_STRING, ostr)) | 1026 | V_ASN1_OCTET_STRING, ostr)) |
| @@ -1117,7 +1117,7 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) | |||
| 1117 | int nid; | 1117 | int nid; |
| 1118 | int rv = -1; | 1118 | int rv = -1; |
| 1119 | unsigned char *label = NULL; | 1119 | unsigned char *label = NULL; |
| 1120 | int labellen = 0; | 1120 | int label_len = 0; |
| 1121 | const EVP_MD *mgf1md = NULL, *md = NULL; | 1121 | const EVP_MD *mgf1md = NULL, *md = NULL; |
| 1122 | RSA_OAEP_PARAMS *oaep; | 1122 | RSA_OAEP_PARAMS *oaep; |
| 1123 | 1123 | ||
| @@ -1164,14 +1164,14 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) | |||
| 1164 | goto err; | 1164 | goto err; |
| 1165 | } | 1165 | } |
| 1166 | 1166 | ||
| 1167 | if ((labellen = ASN1_STRING_length(parameter)) == 0) { | 1167 | if ((label_len = ASN1_STRING_length(parameter)) == 0) { |
| 1168 | RSAerror(RSA_R_INVALID_LABEL); | 1168 | RSAerror(RSA_R_INVALID_LABEL); |
| 1169 | goto err; | 1169 | goto err; |
| 1170 | } | 1170 | } |
| 1171 | 1171 | ||
| 1172 | if ((label = calloc(1, labellen)) == NULL) | 1172 | if ((label = calloc(1, label_len)) == NULL) |
| 1173 | goto err; | 1173 | goto err; |
| 1174 | memcpy(label, ASN1_STRING_get0_data(parameter), labellen); | 1174 | memcpy(label, ASN1_STRING_get0_data(parameter), label_len); |
| 1175 | } | 1175 | } |
| 1176 | 1176 | ||
| 1177 | if (EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) <= 0) | 1177 | if (EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) <= 0) |
| @@ -1180,16 +1180,16 @@ rsa_cms_decrypt(CMS_RecipientInfo *ri) | |||
| 1180 | goto err; | 1180 | goto err; |
| 1181 | if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkctx, mgf1md) <= 0) | 1181 | if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkctx, mgf1md) <= 0) |
| 1182 | goto err; | 1182 | goto err; |
| 1183 | if (EVP_PKEY_CTX_set0_rsa_oaep_label(pkctx, label, labellen) <= 0) | 1183 | if (EVP_PKEY_CTX_set0_rsa_oaep_label(pkctx, label, label_len) <= 0) |
| 1184 | goto err; | 1184 | goto err; |
| 1185 | label = NULL; | 1185 | label = NULL; |
| 1186 | labellen = 0; | 1186 | label_len = 0; |
| 1187 | 1187 | ||
| 1188 | rv = 1; | 1188 | rv = 1; |
| 1189 | 1189 | ||
| 1190 | err: | 1190 | err: |
| 1191 | RSA_OAEP_PARAMS_free(oaep); | 1191 | RSA_OAEP_PARAMS_free(oaep); |
| 1192 | freezero(label, labellen); | 1192 | freezero(label, label_len); |
| 1193 | 1193 | ||
| 1194 | return rv; | 1194 | return rv; |
| 1195 | } | 1195 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index b1b8e8c675..0b7cd005a9 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_pmeth.c,v 1.45 2026/04/07 13:15:29 tb Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.46 2026/04/07 13:16:41 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -97,7 +97,7 @@ typedef struct { | |||
| 97 | unsigned char *tbuf; | 97 | unsigned char *tbuf; |
| 98 | /* OAEP label */ | 98 | /* OAEP label */ |
| 99 | unsigned char *oaep_label; | 99 | unsigned char *oaep_label; |
| 100 | size_t oaep_labellen; | 100 | size_t oaep_label_len; |
| 101 | } RSA_PKEY_CTX; | 101 | } RSA_PKEY_CTX; |
| 102 | 102 | ||
| 103 | /* True if PSS parameters are restricted */ | 103 | /* True if PSS parameters are restricted */ |
| @@ -150,10 +150,10 @@ pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
| 150 | dctx->mgf1md = sctx->mgf1md; | 150 | dctx->mgf1md = sctx->mgf1md; |
| 151 | if (sctx->oaep_label != NULL) { | 151 | if (sctx->oaep_label != NULL) { |
| 152 | free(dctx->oaep_label); | 152 | free(dctx->oaep_label); |
| 153 | if ((dctx->oaep_label = calloc(1, sctx->oaep_labellen)) == NULL) | 153 | if ((dctx->oaep_label = calloc(1, sctx->oaep_label_len)) == NULL) |
| 154 | return 0; | 154 | return 0; |
| 155 | memcpy(dctx->oaep_label, sctx->oaep_label, sctx->oaep_labellen); | 155 | memcpy(dctx->oaep_label, sctx->oaep_label, sctx->oaep_label_len); |
| 156 | dctx->oaep_labellen = sctx->oaep_labellen; | 156 | dctx->oaep_label_len = sctx->oaep_label_len; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | return 1; | 159 | return 1; |
| @@ -357,7 +357,7 @@ pkey_rsa_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | |||
| 357 | if (!setup_tbuf(rctx, ctx)) | 357 | if (!setup_tbuf(rctx, ctx)) |
| 358 | return -1; | 358 | return -1; |
| 359 | if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen, | 359 | if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen, |
| 360 | in, inlen, rctx->oaep_label, rctx->oaep_labellen, | 360 | in, inlen, rctx->oaep_label, rctx->oaep_label_len, |
| 361 | rctx->md, rctx->mgf1md)) | 361 | rctx->md, rctx->mgf1md)) |
| 362 | return -1; | 362 | return -1; |
| 363 | ret = RSA_public_encrypt(klen, rctx->tbuf, out, | 363 | 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, | |||
| 387 | if (ret <= 0) | 387 | if (ret <= 0) |
| 388 | return ret; | 388 | return ret; |
| 389 | ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf, | 389 | ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf, |
| 390 | ret, ret, rctx->oaep_label, rctx->oaep_labellen, rctx->md, | 390 | ret, ret, rctx->oaep_label, rctx->oaep_label_len, rctx->md, |
| 391 | rctx->mgf1md); | 391 | rctx->mgf1md); |
| 392 | } else { | 392 | } else { |
| 393 | ret = RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa, | 393 | 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) | |||
| 583 | RSAerror(RSA_R_INVALID_PADDING_MODE); | 583 | RSAerror(RSA_R_INVALID_PADDING_MODE); |
| 584 | return -2; | 584 | return -2; |
| 585 | } | 585 | } |
| 586 | freezero(rctx->oaep_label, rctx->oaep_labellen); | 586 | freezero(rctx->oaep_label, rctx->oaep_label_len); |
| 587 | if (p2 != NULL && p1 > 0) { | 587 | if (p2 != NULL && p1 > 0) { |
| 588 | rctx->oaep_label = p2; | 588 | rctx->oaep_label = p2; |
| 589 | rctx->oaep_labellen = p1; | 589 | rctx->oaep_label_len = p1; |
| 590 | } else { | 590 | } else { |
| 591 | rctx->oaep_label = NULL; | 591 | rctx->oaep_label = NULL; |
| 592 | rctx->oaep_labellen = 0; | 592 | rctx->oaep_label_len = 0; |
| 593 | } | 593 | } |
| 594 | return 1; | 594 | return 1; |
| 595 | 595 | ||
| @@ -599,7 +599,7 @@ pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
| 599 | return -2; | 599 | return -2; |
| 600 | } | 600 | } |
| 601 | *(unsigned char **)p2 = rctx->oaep_label; | 601 | *(unsigned char **)p2 = rctx->oaep_label; |
| 602 | return rctx->oaep_labellen; | 602 | return rctx->oaep_label_len; |
| 603 | 603 | ||
| 604 | case EVP_PKEY_CTRL_DIGESTINIT: | 604 | case EVP_PKEY_CTRL_DIGESTINIT: |
| 605 | case EVP_PKEY_CTRL_PKCS7_SIGN: | 605 | case EVP_PKEY_CTRL_PKCS7_SIGN: |
