diff options
author | jsing <> | 2015-09-13 14:15:00 +0000 |
---|---|---|
committer | jsing <> | 2015-09-13 14:15:00 +0000 |
commit | 759e6edbf75708ba15d1423ed0f65a15100fce7f (patch) | |
tree | cd163adfbe9e1b7507c7b7bff47285f6659031cd | |
parent | 533a2cdb71a16eafbc7aced4709154605f68cd6d (diff) | |
download | openbsd-759e6edbf75708ba15d1423ed0f65a15100fce7f.tar.gz openbsd-759e6edbf75708ba15d1423ed0f65a15100fce7f.tar.bz2 openbsd-759e6edbf75708ba15d1423ed0f65a15100fce7f.zip |
Use ECDH_size() and do some other clean up.
-rw-r--r-- | src/regress/lib/libcrypto/ecdh/ecdhtest.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/regress/lib/libcrypto/ecdh/ecdhtest.c b/src/regress/lib/libcrypto/ecdh/ecdhtest.c index eb7c9e3fa4..100381570c 100644 --- a/src/regress/lib/libcrypto/ecdh/ecdhtest.c +++ b/src/regress/lib/libcrypto/ecdh/ecdhtest.c | |||
@@ -100,14 +100,12 @@ KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) | |||
100 | static int | 100 | static int |
101 | test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) | 101 | test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) |
102 | { | 102 | { |
103 | EC_KEY *a = NULL; | 103 | BIGNUM *x_a = NULL, *y_a = NULL, *x_b = NULL, *y_b = NULL; |
104 | EC_KEY *b = NULL; | 104 | EC_KEY *a = NULL, *b = NULL; |
105 | BIGNUM *x_a = NULL, *y_a = NULL, | 105 | const EC_GROUP *group; |
106 | *x_b = NULL, *y_b = NULL; | ||
107 | char buf[12]; | ||
108 | unsigned char *abuf = NULL, *bbuf = NULL; | 106 | unsigned char *abuf = NULL, *bbuf = NULL; |
109 | int i, alen, blen, aout, bout, ret = 0; | 107 | int i, alen, blen, aout, bout, ret = 0; |
110 | const EC_GROUP *group; | 108 | char buf[12]; |
111 | 109 | ||
112 | a = EC_KEY_new_by_curve_name(nid); | 110 | a = EC_KEY_new_by_curve_name(nid); |
113 | b = EC_KEY_new_by_curve_name(nid); | 111 | b = EC_KEY_new_by_curve_name(nid); |
@@ -217,6 +215,7 @@ test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) | |||
217 | BIO_printf(out, " ok\n"); | 215 | BIO_printf(out, " ok\n"); |
218 | ret = 1; | 216 | ret = 1; |
219 | } | 217 | } |
218 | |||
220 | err: | 219 | err: |
221 | ERR_print_errors_fp(stderr); | 220 | ERR_print_errors_fp(stderr); |
222 | 221 | ||
@@ -365,7 +364,7 @@ ecdh_kat(BIO *out, const char *cname, int nid, | |||
365 | key2 = mk_eckey(nid, k2, k2_len); | 364 | key2 = mk_eckey(nid, k2, k2_len); |
366 | if (!key1 || !key2) | 365 | if (!key1 || !key2) |
367 | goto err; | 366 | goto err; |
368 | Ztmplen = (EC_GROUP_get_degree(EC_KEY_get0_group(key1)) + 7)/8; | 367 | Ztmplen = ECDH_size(key1); |
369 | if (Ztmplen != Zlen) | 368 | if (Ztmplen != Zlen) |
370 | goto err; | 369 | goto err; |
371 | Ztmp = malloc(Ztmplen); | 370 | Ztmp = malloc(Ztmplen); |