Changeset 97372 in vbox for trunk/src/libs/openssl-3.0.7/test/ffc_internal_test.c
- Timestamp:
- Nov 2, 2022 7:40:16 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 154372
- Location:
- trunk/src/libs/openssl-3.0.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/openssl-3.0.7
- Property svn:mergeinfo
-
old new 15 15 /vendor/openssl/3.0.2:150728-150729 16 16 /vendor/openssl/3.0.3:151497-151729 17 /vendor/openssl/current:147554-151496 17 /vendor/openssl/3.0.7:154371 18 /vendor/openssl/current:147554-154370
-
- Property svn:mergeinfo
-
trunk/src/libs/openssl-3.0.7/test/ffc_internal_test.c
r94320 r97372 1 1 /* 2 * Copyright 2019-202 1The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * Copyright (c) 2019-2020, Oracle and/or its affiliates. All rights reserved. 4 4 * … … 28 28 29 29 #include "internal/ffc.h" 30 #include "crypto/security_bits.h" 30 31 31 32 #ifndef OPENSSL_NO_DSA … … 599 600 if (!TEST_false(ossl_ffc_generate_private_key(ctx, params, N + 1, 112, priv))) 600 601 goto err; 602 /* s must be always set */ 603 if (!TEST_false(ossl_ffc_generate_private_key(ctx, params, N, 0, priv))) 604 goto err; 601 605 /* pass since 2s <= N <= len(q) */ 602 606 if (!TEST_true(ossl_ffc_generate_private_key(ctx, params, N, 112, priv))) … … 610 614 if (!TEST_true(ossl_ffc_validate_private_key(params->q, priv, &res))) 611 615 goto err; 612 613 /* N and s are ignored in this case */ 614 if (!TEST_true(ossl_ffc_generate_private_key(ctx, params, 0, 0, priv))) 616 /* N is ignored in this case */ 617 if (!TEST_true(ossl_ffc_generate_private_key(ctx, params, 0, 618 ossl_ifc_ffc_compute_security_bits(BN_num_bits(params->p)), 619 priv))) 620 goto err; 621 if (!TEST_int_le(BN_num_bits(priv), 225)) 615 622 goto err; 616 623 if (!TEST_true(ossl_ffc_validate_private_key(params->q, priv, &res))) … … 622 629 BN_free(priv); 623 630 BN_CTX_free(ctx); 631 return ret; 632 } 633 634 static int ffc_params_copy_test(void) 635 { 636 int ret = 0; 637 DH *dh = NULL; 638 FFC_PARAMS *params, copy; 639 640 ossl_ffc_params_init(©); 641 642 if (!TEST_ptr(dh = DH_new_by_nid(NID_ffdhe3072))) 643 goto err; 644 params = ossl_dh_get0_params(dh); 645 646 if (!TEST_int_eq(params->keylength, 275)) 647 goto err; 648 649 if (!TEST_true(ossl_ffc_params_copy(©, params))) 650 goto err; 651 652 if (!TEST_int_eq(copy.keylength, 275)) 653 goto err; 654 655 if (!TEST_true(ossl_ffc_params_cmp(©, params, 0))) 656 goto err; 657 658 ret = 1; 659 err: 660 ossl_ffc_params_cleanup(©); 661 DH_free(dh); 624 662 return ret; 625 663 } … … 639 677 ADD_TEST(ffc_private_validate_test); 640 678 ADD_ALL_TESTS(ffc_private_gen_test, 10); 679 ADD_TEST(ffc_params_copy_test); 641 680 #endif /* OPENSSL_NO_DH */ 642 681 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.