diff options
| author | tb <> | 2023-05-04 13:41:20 +0000 |
|---|---|---|
| committer | tb <> | 2023-05-04 13:41:20 +0000 |
| commit | c783c188defda634bc3ab4d33f2dfa24e8324668 (patch) | |
| tree | fc47ee856bac899165257bb867cca8974dc365e7 /src | |
| parent | 8a02aac9575eea91563def962198bdc21f7540e5 (diff) | |
| download | openbsd-c783c188defda634bc3ab4d33f2dfa24e8324668.tar.gz openbsd-c783c188defda634bc3ab4d33f2dfa24e8324668.tar.bz2 openbsd-c783c188defda634bc3ab4d33f2dfa24e8324668.zip | |
Remove x9_62_test_internal()
This test depends on RAND_set_rand_method() allowing stupid things like
making ECDSA signatures deterministic. This was gutted a long time ago
and the function should have followed its wrappers into the attic.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/ecdsa/ecdsatest.c | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c index 64815812b7..5f3edc5b2b 100644 --- a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c +++ b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdsatest.c,v 1.14 2022/09/02 11:47:25 tb Exp $ */ | 1 | /* $OpenBSD: ecdsatest.c,v 1.15 2023/05/04 13:41:20 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -83,79 +83,8 @@ | |||
| 83 | #endif | 83 | #endif |
| 84 | #include <openssl/err.h> | 84 | #include <openssl/err.h> |
| 85 | 85 | ||
| 86 | /* declaration of the test functions */ | ||
| 87 | int x9_62_test_internal(int nid, const char *r, const char *s); | ||
| 88 | int test_builtin(void); | 86 | int test_builtin(void); |
| 89 | 87 | ||
| 90 | /* some tests from the X9.62 draft */ | ||
| 91 | int | ||
| 92 | x9_62_test_internal(int nid, const char *r_in, const char *s_in) | ||
| 93 | { | ||
| 94 | EVP_MD_CTX *md_ctx = NULL; | ||
| 95 | const char message[] = "abc"; | ||
| 96 | unsigned char digest[20]; | ||
| 97 | unsigned int dgst_len = 0; | ||
| 98 | EC_KEY *key = NULL; | ||
| 99 | ECDSA_SIG *signature = NULL; | ||
| 100 | BIGNUM *r = NULL, *s = NULL; | ||
| 101 | int failed = 1; | ||
| 102 | |||
| 103 | if ((md_ctx = EVP_MD_CTX_new()) == NULL) | ||
| 104 | goto err; | ||
| 105 | |||
| 106 | if (!EVP_DigestInit(md_ctx, EVP_sha1())) | ||
| 107 | goto err; | ||
| 108 | if (!EVP_DigestUpdate(md_ctx, message, 3)) | ||
| 109 | goto err; | ||
| 110 | if (!EVP_DigestFinal(md_ctx, digest, &dgst_len)) | ||
| 111 | goto err; | ||
| 112 | |||
| 113 | printf("testing %s: ", OBJ_nid2sn(nid)); | ||
| 114 | |||
| 115 | if ((key = EC_KEY_new_by_curve_name(nid)) == NULL) | ||
| 116 | goto err; | ||
| 117 | if (!EC_KEY_generate_key(key)) | ||
| 118 | goto err; | ||
| 119 | |||
| 120 | printf("."); | ||
| 121 | fflush(stdout); | ||
| 122 | |||
| 123 | if ((signature = ECDSA_do_sign(digest, 20, key)) == NULL) | ||
| 124 | goto err; | ||
| 125 | |||
| 126 | printf("."); | ||
| 127 | fflush(stdout); | ||
| 128 | |||
| 129 | if (!BN_dec2bn(&r, r_in) || !BN_dec2bn(&s, s_in)) | ||
| 130 | goto err; | ||
| 131 | if (BN_cmp(ECDSA_SIG_get0_r(signature), r) || | ||
| 132 | BN_cmp(ECDSA_SIG_get0_s(signature), s)) | ||
| 133 | goto err; | ||
| 134 | |||
| 135 | printf("."); | ||
| 136 | fflush(stdout); | ||
| 137 | |||
| 138 | if (ECDSA_do_verify(digest, 20, signature, key) != 1) | ||
| 139 | goto err; | ||
| 140 | |||
| 141 | printf("."); | ||
| 142 | fflush(stdout); | ||
| 143 | |||
| 144 | printf(" ok\n"); | ||
| 145 | |||
| 146 | failed = 0; | ||
| 147 | |||
| 148 | err: | ||
| 149 | if (failed) | ||
| 150 | printf(" failed\n"); | ||
| 151 | EC_KEY_free(key); | ||
| 152 | ECDSA_SIG_free(signature); | ||
| 153 | BN_free(r); | ||
| 154 | BN_free(s); | ||
| 155 | EVP_MD_CTX_free(md_ctx); | ||
| 156 | return failed; | ||
| 157 | } | ||
| 158 | |||
| 159 | int | 88 | int |
| 160 | test_builtin(void) | 89 | test_builtin(void) |
| 161 | { | 90 | { |
