summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdh
diff options
context:
space:
mode:
authordjm <>2012-10-13 21:23:57 +0000
committerdjm <>2012-10-13 21:23:57 +0000
commit9b3472b7d4065659a32367dab0041d7ef4194093 (patch)
treef9ec86d879ac4a66f08398373cfe233c8d41851a /src/lib/libcrypto/ecdh
parente9d65189905c6e99c1062d65e26bf83eebb0a26a (diff)
parent5bb3399db864c8865e0df73bd1564407bac5d182 (diff)
downloadopenbsd-9b3472b7d4065659a32367dab0041d7ef4194093.tar.gz
openbsd-9b3472b7d4065659a32367dab0041d7ef4194093.tar.bz2
openbsd-9b3472b7d4065659a32367dab0041d7ef4194093.zip
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/ecdh')
-rw-r--r--src/lib/libcrypto/ecdh/ecdhtest.c6
-rw-r--r--src/lib/libcrypto/ecdh/ech_ossl.c2
2 files changed, 8 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
diff --git a/src/lib/libcrypto/ecdh/ech_ossl.c b/src/lib/libcrypto/ecdh/ech_ossl.c
index 2a40ff12df..4a30628fbc 100644
--- a/src/lib/libcrypto/ecdh/ech_ossl.c
+++ b/src/lib/libcrypto/ecdh/ech_ossl.c
@@ -157,6 +157,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
157 goto err; 157 goto err;
158 } 158 }
159 } 159 }
160#ifndef OPENSSL_NO_EC2M
160 else 161 else
161 { 162 {
162 if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx)) 163 if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx))
@@ -165,6 +166,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
165 goto err; 166 goto err;
166 } 167 }
167 } 168 }
169#endif
168 170
169 buflen = (EC_GROUP_get_degree(group) + 7)/8; 171 buflen = (EC_GROUP_get_degree(group) + 7)/8;
170 len = BN_num_bytes(x); 172 len = BN_num_bytes(x);