diff options
| author | djm <> | 2012-10-13 21:23:57 +0000 |
|---|---|---|
| committer | djm <> | 2012-10-13 21:23:57 +0000 |
| commit | 0f4e59be0458751f14ec603610fb285ff9737a1c (patch) | |
| tree | 51d00d308f46148b4b341133936e44706703ad8b /src/lib/libcrypto/ecdh/ecdhtest.c | |
| parent | 050e39dc2dfd5d05183a7283530fcaf13f832ba2 (diff) | |
| download | openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.tar.gz openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.tar.bz2 openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.zip | |
import OpenSSL-1.0.1c
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ecdhtest.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/libcrypto/ecdh/ecdhtest.c b/src/lib/libcrypto/ecdh/ecdhtest.c index 212a87efa4..823d7baa65 100644 --- a/src/lib/libcrypto/ecdh/ecdhtest.c +++ b/src/lib/libcrypto/ecdh/ecdhtest.c | |||
| @@ -158,11 +158,13 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) | |||
| 158 | if (!EC_POINT_get_affine_coordinates_GFp(group, | 158 | if (!EC_POINT_get_affine_coordinates_GFp(group, |
| 159 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; | 159 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; |
| 160 | } | 160 | } |
| 161 | #ifndef OPENSSL_NO_EC2M | ||
| 161 | else | 162 | else |
| 162 | { | 163 | { |
| 163 | if (!EC_POINT_get_affine_coordinates_GF2m(group, | 164 | if (!EC_POINT_get_affine_coordinates_GF2m(group, |
| 164 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; | 165 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; |
| 165 | } | 166 | } |
| 167 | #endif | ||
| 166 | #ifdef NOISY | 168 | #ifdef NOISY |
| 167 | BIO_puts(out," pri 1="); | 169 | BIO_puts(out," pri 1="); |
| 168 | BN_print(out,a->priv_key); | 170 | BN_print(out,a->priv_key); |
| @@ -183,11 +185,13 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) | |||
| 183 | if (!EC_POINT_get_affine_coordinates_GFp(group, | 185 | if (!EC_POINT_get_affine_coordinates_GFp(group, |
| 184 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; | 186 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; |
| 185 | } | 187 | } |
| 188 | #ifndef OPENSSL_NO_EC2M | ||
| 186 | else | 189 | else |
| 187 | { | 190 | { |
| 188 | if (!EC_POINT_get_affine_coordinates_GF2m(group, | 191 | if (!EC_POINT_get_affine_coordinates_GF2m(group, |
| 189 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; | 192 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; |
| 190 | } | 193 | } |
| 194 | #endif | ||
| 191 | 195 | ||
| 192 | #ifdef NOISY | 196 | #ifdef NOISY |
| 193 | BIO_puts(out," pri 2="); | 197 | BIO_puts(out," pri 2="); |
| @@ -324,6 +328,7 @@ int main(int argc, char *argv[]) | |||
| 324 | if (!test_ecdh_curve(NID_X9_62_prime256v1, "NIST Prime-Curve P-256", ctx, out)) goto err; | 328 | if (!test_ecdh_curve(NID_X9_62_prime256v1, "NIST Prime-Curve P-256", ctx, out)) goto err; |
| 325 | if (!test_ecdh_curve(NID_secp384r1, "NIST Prime-Curve P-384", ctx, out)) goto err; | 329 | if (!test_ecdh_curve(NID_secp384r1, "NIST Prime-Curve P-384", ctx, out)) goto err; |
| 326 | if (!test_ecdh_curve(NID_secp521r1, "NIST Prime-Curve P-521", ctx, out)) goto err; | 330 | if (!test_ecdh_curve(NID_secp521r1, "NIST Prime-Curve P-521", ctx, out)) goto err; |
| 331 | #ifndef OPENSSL_NO_EC2M | ||
| 327 | /* NIST BINARY CURVES TESTS */ | 332 | /* NIST BINARY CURVES TESTS */ |
| 328 | if (!test_ecdh_curve(NID_sect163k1, "NIST Binary-Curve K-163", ctx, out)) goto err; | 333 | if (!test_ecdh_curve(NID_sect163k1, "NIST Binary-Curve K-163", ctx, out)) goto err; |
| 329 | if (!test_ecdh_curve(NID_sect163r2, "NIST Binary-Curve B-163", ctx, out)) goto err; | 334 | if (!test_ecdh_curve(NID_sect163r2, "NIST Binary-Curve B-163", ctx, out)) goto err; |
| @@ -335,6 +340,7 @@ int main(int argc, char *argv[]) | |||
| 335 | if (!test_ecdh_curve(NID_sect409r1, "NIST Binary-Curve B-409", ctx, out)) goto err; | 340 | if (!test_ecdh_curve(NID_sect409r1, "NIST Binary-Curve B-409", ctx, out)) goto err; |
| 336 | if (!test_ecdh_curve(NID_sect571k1, "NIST Binary-Curve K-571", ctx, out)) goto err; | 341 | if (!test_ecdh_curve(NID_sect571k1, "NIST Binary-Curve K-571", ctx, out)) goto err; |
| 337 | if (!test_ecdh_curve(NID_sect571r1, "NIST Binary-Curve B-571", ctx, out)) goto err; | 342 | if (!test_ecdh_curve(NID_sect571r1, "NIST Binary-Curve B-571", ctx, out)) goto err; |
| 343 | #endif | ||
| 338 | 344 | ||
| 339 | ret = 0; | 345 | ret = 0; |
| 340 | 346 | ||
