GeezerVison is showing github.com — deps: upgrade openssl sources to openssl-3.5.2 · nodejs/node@33b06df
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/CHANGES.md +7Lines changed: 7 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,6 +28,13 @@ OpenSSL Releases | 28 | 28 | OpenSSL 3.5 | 29 | 29 | ----------- | 30 | 30 |
| | 31 | +### Changes between 3.5.1 and 3.5.2 [5 Aug 2025] | | 32 | + | | 33 | + * The FIPS provider now performs a PCT on key import for RSA, EC and ECX. | | 34 | + This is mandated by FIPS 140-3 IG 10.3.A additional comment 1. | | 35 | + | | 36 | + *Dr Paul Dale* | | 37 | + | 31 | 38 | ### Changes between 3.5.0 and 3.5.1 [1 Jul 2025] | 32 | 39 |
| 33 | 40 | * Fix x509 application adds trusted use instead of rejected use. | |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/NEWS.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,10 @@ OpenSSL Releases | 23 | 23 | OpenSSL 3.5 | 24 | 24 | ----------- | 25 | 25 |
| | 26 | +### Major changes between OpenSSL 3.5.1 and OpenSSL 3.5.2 [5 Aug 2025] | | 27 | + | | 28 | + * none | | 29 | + | 26 | 30 | ### Major changes between OpenSSL 3.5.0 and OpenSSL 3.5.1 [1 Jul 2025] | 27 | 31 |
| 28 | 32 | OpenSSL 3.5.1 is a security patch release. The most severe CVE fixed in this | |
Collapse file Copy file name to clipboard +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | MAJOR=3 | 2 | 2 | MINOR=5 | 3 | | -PATCH=1 | | 3 | +PATCH=2 | 4 | 4 | PRE_RELEASE_TAG= | 5 | 5 | BUILD_METADATA= | 6 | | -RELEASE_DATE="1 Jul 2025" | | 6 | +RELEASE_DATE="5 Aug 2025" | 7 | 7 | SHLIB_VERSION=3 |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/apps/asn1parse.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,8 +40,8 @@ const OPTIONS asn1parse_options[] = { | 40 | 40 | {"length", OPT_LENGTH, 'p', "length of section in file"}, | 41 | 41 | {"strparse", OPT_STRPARSE, 'p', | 42 | 42 | "offset; a series of these can be used to 'dig'"}, | 43 | | - {"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"}, | 44 | 43 | {OPT_MORE_STR, 0, 0, "into multiple ASN1 blob wrappings"}, | | 44 | + {"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"}, | 45 | 45 | {"genconf", OPT_GENCONF, 's', "file to generate ASN1 structure from"}, | 46 | 46 | {"strictpem", OPT_STRICTPEM, 0, | 47 | 47 | "equivalent to '-inform pem' (obsolete)"}, | |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/apps/rand.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright 1998-2022 The OpenSSL Project Authors. All Rights Reserved. | | 2 | + * Copyright 1998-2025 The OpenSSL Project Authors. All Rights Reserved. | 3 | 3 | * | 4 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use | 5 | 5 | * this file except in compliance with the License. You can obtain a copy | @@ -199,7 +199,7 @@ int rand_main(int argc, char **argv) | 199 | 199 | int chunk; | 200 | 200 |
| 201 | 201 | chunk = scaled_num > buflen ? (int)buflen : (int)scaled_num; | 202 | | - r = RAND_bytes(buf, chunk); | | 202 | + r = RAND_bytes_ex(app_get0_libctx(), buf, chunk, 0); | 203 | 203 | if (r <= 0) | 204 | 204 | goto end; | 205 | 205 | if (format != FORMAT_TEXT) { | |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/crypto/dh/dh_check.c +32-4Lines changed: 32 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. | | 2 | + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. | 3 | 3 | * | 4 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use | 5 | 5 | * this file except in compliance with the License. You can obtain a copy | | 16 | 16 | #include <stdio.h> | 17 | 17 | #include "internal/cryptlib.h" | 18 | 18 | #include <openssl/bn.h> | | 19 | +#include <openssl/self_test.h> | 19 | 20 | #include "dh_local.h" | 20 | 21 | #include "crypto/dh.h" | 21 | 22 |
| @@ -329,17 +330,27 @@ int ossl_dh_check_priv_key(const DH *dh, const BIGNUM *priv_key, int *ret) | 329 | 330 | * FFC pairwise check from SP800-56A R3. | 330 | 331 | * Section 5.6.2.1.4 Owner Assurance of Pair-wise Consistency | 331 | 332 | */ | 332 | | -int ossl_dh_check_pairwise(const DH *dh) | | 333 | +int ossl_dh_check_pairwise(const DH *dh, int return_on_null_numbers) | 333 | 334 | { | 334 | 335 | int ret = 0; | 335 | 336 | BN_CTX *ctx = NULL; | 336 | 337 | BIGNUM *pub_key = NULL; | | 338 | + OSSL_SELF_TEST *st = NULL; | | 339 | + OSSL_CALLBACK *stcb = NULL; | | 340 | + void *stcbarg = NULL; | 337 | 341 |
| 338 | 342 | if (dh->params.p == NULL | 339 | 343 | || dh->params.g == NULL | 340 | 344 | || dh->priv_key == NULL | 341 | 345 | || dh->pub_key == NULL) | 342 | | - return 0; | | 346 | + return return_on_null_numbers; | | 347 | + | | 348 | + OSSL_SELF_TEST_get_callback(dh->libctx, &stcb, &stcbarg); | | 349 | + st = OSSL_SELF_TEST_new(stcb, stcbarg); | | 350 | + if (st == NULL) | | 351 | + goto err; | | 352 | + OSSL_SELF_TEST_onbegin(st, OSSL_SELF_TEST_TYPE_PCT, | | 353 | + OSSL_SELF_TEST_DESC_PCT_DH); | 343 | 354 |
| 344 | 355 | ctx = BN_CTX_new_ex(dh->libctx); | 345 | 356 | if (ctx == NULL) | @@ -351,10 +362,27 @@ int ossl_dh_check_pairwise(const DH *dh) | 351 | 362 | /* recalculate the public key = (g ^ priv) mod p */ | 352 | 363 | if (!ossl_dh_generate_public_key(ctx, dh, dh->priv_key, pub_key)) | 353 | 364 | goto err; | | 365 | + | | 366 | +#ifdef FIPS_MODULE | | 367 | + { | | 368 | + int len; | | 369 | + unsigned char bytes[1024] = {0}; /* Max key size of 8192 bits */ | | 370 | + | | 371 | + if (BN_num_bytes(pub_key) > (int)sizeof(bytes)) | | 372 | + goto err; | | 373 | + len = BN_bn2bin(pub_key, bytes); | | 374 | + OSSL_SELF_TEST_oncorrupt_byte(st, bytes); | | 375 | + if (BN_bin2bn(bytes, len, pub_key) == NULL) | | 376 | + goto err; | | 377 | + } | | 378 | +#endif | 354 | 379 | /* check it matches the existing public_key */ | 355 | 380 | ret = BN_cmp(pub_key, dh->pub_key) == 0; | 356 | | -err: | | 381 | + err: | 357 | 382 | BN_free(pub_key); | 358 | 383 | BN_CTX_free(ctx); | | 384 | + | | 385 | + OSSL_SELF_TEST_onend(st, ret); | | 386 | + OSSL_SELF_TEST_free(st); | 359 | 387 | return ret; | 360 | 388 | } |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/crypto/encode_decode/decoder_lib.c +28Lines changed: 28 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -537,6 +537,14 @@ static void collect_extra_decoder(OSSL_DECODER *decoder, void *arg) | 537 | 537 | } | 538 | 538 | } | 539 | 539 |
| | 540 | +static int decoder_sk_cmp(const OSSL_DECODER_INSTANCE *const *a, | | 541 | + const OSSL_DECODER_INSTANCE *const *b) | | 542 | +{ | | 543 | + if ((*a)->score == (*b)->score) | | 544 | + return (*a)->order - (*b)->order; | | 545 | + return (*a)->score - (*b)->score; | | 546 | +} | | 547 | + | 540 | 548 | int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, | 541 | 549 | OSSL_LIB_CTX *libctx, const char *propq) | 542 | 550 | { | @@ -595,6 +603,26 @@ int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, | 595 | 603 | OSSL_DECODER_do_all_provided(libctx, collect_all_decoders, skdecoders); | 596 | 604 | numdecoders = sk_OSSL_DECODER_num(skdecoders); | 597 | 605 |
| | 606 | + /* | | 607 | + * If there are provided or default properties, sort the initial decoder list | | 608 | + * by property matching score so that the highest scored provider is selected | | 609 | + * first. | | 610 | + */ | | 611 | + if (propq != NULL || ossl_ctx_global_properties(libctx, 0) != NULL) { | | 612 | + int num_decoder_insts = sk_OSSL_DECODER_INSTANCE_num(ctx->decoder_insts); | | 613 | + int i; | | 614 | + OSSL_DECODER_INSTANCE *di; | | 615 | + sk_OSSL_DECODER_INSTANCE_compfunc old_cmp = | | 616 | + sk_OSSL_DECODER_INSTANCE_set_cmp_func(ctx->decoder_insts, decoder_sk_cmp); | | 617 | + | | 618 | + for (i = 0; i < num_decoder_insts; i++) { | | 619 | + di = sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts, i); | | 620 | + di->order = i; | | 621 | + } | | 622 | + sk_OSSL_DECODER_INSTANCE_sort(ctx->decoder_insts); | | 623 | + sk_OSSL_DECODER_INSTANCE_set_cmp_func(ctx->decoder_insts, old_cmp); | | 624 | + } | | 625 | + | 598 | 626 | memset(&data, 0, sizeof(data)); | 599 | 627 | data.ctx = ctx; | 600 | 628 | data.w_prev_start = 0; | |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/crypto/encode_decode/decoder_pkey.c +60-12Lines changed: 60 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -222,15 +222,21 @@ struct collect_data_st { | 222 | 222 | int total; /* number of matching results */ | 223 | 223 | char error_occurred; | 224 | 224 | char keytype_resolved; | | 225 | + OSSL_PROPERTY_LIST *pq; | 225 | 226 |
| 226 | 227 | STACK_OF(EVP_KEYMGMT) *keymgmts; | 227 | 228 | }; | 228 | 229 |
| 229 | | -static void collect_decoder_keymgmt(EVP_KEYMGMT *keymgmt, OSSL_DECODER *decoder, | 230 | | - void *provctx, struct collect_data_st *data) | | 230 | +/* | | 231 | + * Add decoder instance to the decoder context if it is compatible. Returns 1 | | 232 | + * if a decoder was added, 0 otherwise. | | 233 | + */ | | 234 | +static int collect_decoder_keymgmt(EVP_KEYMGMT *keymgmt, OSSL_DECODER *decoder, | | 235 | + void *provctx, struct collect_data_st *data) | 231 | 236 | { | 232 | 237 | void *decoderctx = NULL; | 233 | 238 | OSSL_DECODER_INSTANCE *di = NULL; | | 239 | + const OSSL_PROPERTY_LIST *props; | 234 | 240 |
| 235 | 241 | /* | 236 | 242 | * We already checked the EVP_KEYMGMT is applicable in check_keymgmt so we | @@ -239,17 +245,17 @@ static void collect_decoder_keymgmt(EVP_KEYMGMT *keymgmt, OSSL_DECODER *decoder, | 239 | 245 |
| 240 | 246 | if (keymgmt->name_id != decoder->base.id) | 241 | 247 | /* Mismatch is not an error, continue. */ | 242 | | - return; | | 248 | + return 0; | 243 | 249 |
| 244 | 250 | if ((decoderctx = decoder->newctx(provctx)) == NULL) { | 245 | 251 | data->error_occurred = 1; | 246 | | - return; | | 252 | + return 0; | 247 | 253 | } | 248 | 254 |
| 249 | 255 | if ((di = ossl_decoder_instance_new(decoder, decoderctx)) == NULL) { | 250 | 256 | decoder->freectx(decoderctx); | 251 | 257 | data->error_occurred = 1; | 252 | | - return; | | 258 | + return 0; | 253 | 259 | } | 254 | 260 |
| 255 | 261 | /* | @@ -263,7 +269,7 @@ static void collect_decoder_keymgmt(EVP_KEYMGMT *keymgmt, OSSL_DECODER *decoder, | 263 | 269 | || OPENSSL_strcasecmp(data->ctx->start_input_type, "PEM") != 0)) { | 264 | 270 | /* Mismatch is not an error, continue. */ | 265 | 271 | ossl_decoder_instance_free(di); | 266 | | - return; | | 272 | + return 0; | 267 | 273 | } | 268 | 274 |
| 269 | 275 | OSSL_TRACE_BEGIN(DECODER) { | @@ -275,13 +281,30 @@ static void collect_decoder_keymgmt(EVP_KEYMGMT *keymgmt, OSSL_DECODER *decoder, | 275 | 281 | OSSL_DECODER_get0_properties(decoder)); | 276 | 282 | } OSSL_TRACE_END(DECODER); | 277 | 283 |
| | 284 | + /* | | 285 | + * Get the property match score so the decoders can be prioritized later. | | 286 | + */ | | 287 | + props = ossl_decoder_parsed_properties(decoder); | | 288 | + if (data->pq != NULL && props != NULL) { | | 289 | + di->score = ossl_property_match_count(data->pq, props); | | 290 | + /* | | 291 | + * Mismatch of mandatory properties is not an error, the decoder is just | | 292 | + * ignored, continue. | | 293 | + */ | | 294 | + if (di->score < 0) { | | 295 | + ossl_decoder_instance_free(di); | | 296 | + return 0; | | 297 | + } | | 298 | + } | | 299 | + | 278 | 300 | if (!ossl_decoder_ctx_add_decoder_inst(data->ctx, di)) { | 279 | 301 | ossl_decoder_instance_free(di); | 280 | 302 | data->error_occurred = 1; | 281 | | - return; | | 303 | + return 0; | 282 | 304 | } | 283 | 305 |
| 284 | 306 | ++data->total; | | 307 | + return 1; | 285 | 308 | } | 286 | 309 |
| 287 | 310 | static void collect_decoder(OSSL_DECODER *decoder, void *arg) | @@ -321,7 +344,9 @@ static void collect_decoder(OSSL_DECODER *decoder, void *arg) | 321 | 344 | for (i = 0; i < end_i; ++i) { | 322 | 345 | keymgmt = sk_EVP_KEYMGMT_value(keymgmts, i); | 323 | 346 |
| 324 | | - collect_decoder_keymgmt(keymgmt, decoder, provctx, data); | | 347 | + /* Only add this decoder once */ | | 348 | + if (collect_decoder_keymgmt(keymgmt, decoder, provctx, data)) | | 349 | + break; | 325 | 350 | if (data->error_occurred) | 326 | 351 | return; | 327 | 352 | } | @@ -407,6 +432,8 @@ static int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, | 407 | 432 | struct decoder_pkey_data_st *process_data = NULL; | 408 | 433 | struct collect_data_st collect_data = { NULL }; | 409 | 434 | STACK_OF(EVP_KEYMGMT) *keymgmts = NULL; | | 435 | + OSSL_PROPERTY_LIST **plp; | | 436 | + OSSL_PROPERTY_LIST *pq = NULL, *p2 = NULL; | 410 | 437 |
| 411 | 438 | OSSL_TRACE_BEGIN(DECODER) { | 412 | 439 | const char *input_type = ctx->start_input_type; | @@ -442,6 +469,25 @@ static int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, | 442 | 469 | process_data->selection = ctx->selection; | 443 | 470 | process_data->keymgmts = keymgmts; | 444 | 471 |
| | 472 | + /* | | 473 | + * Collect passed and default properties to prioritize the decoders. | | 474 | + */ | | 475 | + if (propquery != NULL) | | 476 | + p2 = pq = ossl_parse_query(libctx, propquery, 1); | | 477 | + | | 478 | + plp = ossl_ctx_global_properties(libctx, 0); | | 479 | + if (plp != NULL && *plp != NULL) { | | 480 | + if (pq == NULL) { | | 481 | + pq = *plp; | | 482 | + } else { | | 483 | + p2 = ossl_property_merge(pq, *plp); | | 484 | + ossl_property_free(pq); | | 485 | + if (p2 == NULL) | | 486 | + goto err; | | 487 | + pq = p2; | | 488 | + } | | 489 | + } | | 490 | + | 445 | 491 | /* | 446 | 492 | * Enumerate all keymgmts into a stack. | 447 | 493 | * | @@ -457,10 +503,11 @@ static int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, | 457 | 503 | * upfront, as this ensures that the names for all loaded providers have | 458 | 504 | * been registered by the time we try to resolve the keytype string. | 459 | 505 | */ | 460 | | - collect_data.ctx = ctx; | 461 | | - collect_data.libctx = libctx; | 462 | | - collect_data.keymgmts = keymgmts; | 463 | | - collect_data.keytype = keytype; | | 506 | + collect_data.ctx = ctx; | | 507 | + collect_data.libctx = libctx; | | 508 | + collect_data.keymgmts = keymgmts; | | 509 | + collect_data.keytype = keytype; | | 510 | + collect_data.pq = pq; | 464 | 511 | EVP_KEYMGMT_do_all_provided(libctx, collect_keymgmt, &collect_data); | 465 | 512 |
| 466 | 513 | if (collect_data.error_occurred) | @@ -496,6 +543,7 @@ static int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, | 496 | 543 | ok = 1; | 497 | 544 | err: | 498 | 545 | decoder_clean_pkey_construct_arg(process_data); | | 546 | + ossl_property_free(p2); | 499 | 547 | return ok; | 500 | 548 | } | 501 | 549 |
| |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/crypto/encode_decode/encoder_local.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -109,6 +109,8 @@ struct ossl_decoder_instance_st { | 109 | 109 | const char *input_type; /* Never NULL */ | 110 | 110 | const char *input_structure; /* May be NULL */ | 111 | 111 | int input_type_id; | | 112 | + int order; /* For stable ordering of decoders wrt proqs */ | | 113 | + int score; /* For ordering decoders wrt proqs */ | 112 | 114 |
| 113 | 115 | unsigned int flag_input_structure_was_set : 1; | 114 | 116 | }; | |
Collapse file Copy file name to clipboardExpand all lines: deps/openssl/openssl/crypto/evp/asymcipher.c +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -261,10 +261,12 @@ int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | 261 | 261 |
| 262 | 262 | cipher = ctx->op.ciph.cipher; | 263 | 263 | desc = cipher->description != NULL ? cipher->description : ""; | | 264 | + ERR_set_mark(); | 264 | 265 | ret = cipher->encrypt(ctx->op.ciph.algctx, out, outlen, (out == NULL ? 0 : *outlen), in, inlen); | 265 | | - if (ret <= 0) | | 266 | + if (ret <= 0 && ERR_count_to_mark() == 0) | 266 | 267 | ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_ASYM_CIPHER_FAILURE, | 267 | 268 | "%s encrypt:%s", cipher->type_name, desc); | | 269 | + ERR_clear_last_mark(); | 268 | 270 | return ret; | 269 | 271 |
| 270 | 272 | legacy: | @@ -309,10 +311,12 @@ int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | 309 | 311 |
| 310 | 312 | cipher = ctx->op.ciph.cipher; | 311 | 313 | desc = cipher->description != NULL ? cipher->description : ""; | | 314 | + ERR_set_mark(); | 312 | 315 | ret = cipher->decrypt(ctx->op.ciph.algctx, out, outlen, (out == NULL ? 0 : *outlen), in, inlen); | 313 | | - if (ret <= 0) | | 316 | + if (ret <= 0 && ERR_count_to_mark() == 0) | 314 | 317 | ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_ASYM_CIPHER_FAILURE, | 315 | 318 | "%s decrypt:%s", cipher->type_name, desc); | | 319 | + ERR_clear_last_mark(); | 316 | 320 |
| 317 | 321 | return ret; | 318 | 322 |
| |
|