summaryrefslogtreecommitdiff
path: root/regress/unittests/sshbuf
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2014-06-11 06:27:16 +1000
committerDarren Tucker <dtucker@zip.com.au>2014-06-11 06:27:16 +1000
commit67508ac2563c33d582be181a3e777c65f549d22f (patch)
tree7d783949caa53394992cf8918a221043645d11c4 /regress/unittests/sshbuf
parent6482d90a65459a88c18c925368525855832272b3 (diff)
- (dtucker) [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c] Only do NISTP256 curve tests if OpenSSL has them.
Diffstat (limited to 'regress/unittests/sshbuf')
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_crypto.c4
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
index 53290a64c..4f3b5a8ea 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
@@ -44,6 +44,7 @@ sshbuf_getput_crypto_tests(void)
44 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00, 44 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00,
45 0x7f, 0xff, 0x11 45 0x7f, 0xff, 0x11
46 }; 46 };
47#ifdef OPENSSL_HAS_NISTP256
47 int ec256_nid = NID_X9_62_prime256v1; 48 int ec256_nid = NID_X9_62_prime256v1;
48 char *ec256_x = "0C828004839D0106AA59575216191357" 49 char *ec256_x = "0C828004839D0106AA59575216191357"
49 "34B451459DADB586677EF9DF55784999"; 50 "34B451459DADB586677EF9DF55784999";
@@ -62,6 +63,7 @@ sshbuf_getput_crypto_tests(void)
62 }; 63 };
63 EC_KEY *eck; 64 EC_KEY *eck;
64 EC_POINT *ecp; 65 EC_POINT *ecp;
66#endif
65 int r; 67 int r;
66 68
67#define MKBN(b, bnn) \ 69#define MKBN(b, bnn) \
@@ -345,6 +347,7 @@ sshbuf_getput_crypto_tests(void)
345 sshbuf_free(p1); 347 sshbuf_free(p1);
346 TEST_DONE(); 348 TEST_DONE();
347 349
350#ifdef OPENSSL_HAS_NISTP256
348 TEST_START("sshbuf_put_ec"); 351 TEST_START("sshbuf_put_ec");
349 eck = EC_KEY_new_by_curve_name(ec256_nid); 352 eck = EC_KEY_new_by_curve_name(ec256_nid);
350 ASSERT_PTR_NE(eck, NULL); 353 ASSERT_PTR_NE(eck, NULL);
@@ -396,5 +399,6 @@ sshbuf_getput_crypto_tests(void)
396 BN_free(bn); 399 BN_free(bn);
397 BN_free(bn2); 400 BN_free(bn2);
398 TEST_DONE(); 401 TEST_DONE();
402#endif
399} 403}
400 404
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
index eed2d6025..a5e577d3f 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
@@ -54,10 +54,12 @@ attempt_parse_blob(u_char *blob, size_t len)
54 bn = BN_new(); 54 bn = BN_new();
55 sshbuf_get_bignum2(p1, bn); 55 sshbuf_get_bignum2(p1, bn);
56 BN_clear_free(bn); 56 BN_clear_free(bn);
57#ifdef OPENSSL_HAS_NISTP256
57 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 58 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
58 ASSERT_PTR_NE(eck, NULL); 59 ASSERT_PTR_NE(eck, NULL);
59 sshbuf_get_eckey(p1, eck); 60 sshbuf_get_eckey(p1, eck);
60 EC_KEY_free(eck); 61 EC_KEY_free(eck);
62#endif
61 sshbuf_free(p1); 63 sshbuf_free(p1);
62} 64}
63 65