@@ -36,16 +36,39 @@ if test x"$has_libcrypto" = x"yes" && test x"$has_openssl_ec" = x; then
36
36
CPPFLAGS_TEMP="$CPPFLAGS"
37
37
CPPFLAGS="$CRYPTO_CPPFLAGS $CPPFLAGS"
38
38
AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
39
+ #include <openssl/bn.h>
39
40
#include <openssl/ec.h>
40
41
#include <openssl/ecdsa.h>
41
42
#include <openssl/obj_mac.h>] ] ,[ [
42
- EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_secp256k1);
43
- ECDSA_sign(0, NULL, 0, NULL, NULL, eckey);
43
+ # if OPENSSL_VERSION_NUMBER < 0x10100000L
44
+ void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) {(void)sig->r; (void)sig->s;}
45
+ # endif
46
+
47
+ unsigned int zero = 0;
48
+ const unsigned char *zero_ptr = (unsigned char*)&zero;
49
+ EC_KEY_free(EC_KEY_new_by_curve_name(NID_secp256k1));
50
+ EC_KEY *eckey = EC_KEY_new();
51
+ EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_secp256k1);
52
+ EC_KEY_set_group(eckey, group);
53
+ ECDSA_sign(0, NULL, 0, NULL, &zero, eckey);
44
54
ECDSA_verify(0, NULL, 0, NULL, 0, eckey);
55
+ o2i_ECPublicKey(&eckey, &zero_ptr, 0);
56
+ d2i_ECPrivateKey(&eckey, &zero_ptr, 0);
57
+ EC_KEY_check_key(eckey);
45
58
EC_KEY_free(eckey);
59
+ EC_GROUP_free(group);
46
60
ECDSA_SIG *sig_openssl;
47
61
sig_openssl = ECDSA_SIG_new();
62
+ d2i_ECDSA_SIG(&sig_openssl, &zero_ptr, 0);
63
+ i2d_ECDSA_SIG(sig_openssl, NULL);
64
+ ECDSA_SIG_get0(sig_openssl, NULL, NULL);
48
65
ECDSA_SIG_free(sig_openssl);
66
+ const BIGNUM *bignum = BN_value_one();
67
+ BN_is_negative(bignum);
68
+ BN_num_bits(bignum);
69
+ if (sizeof(zero) >= BN_num_bytes(bignum)) {
70
+ BN_bn2bin(bignum, (unsigned char*)&zero);
71
+ }
49
72
] ] ) ] ,[ has_openssl_ec=yes] ,[ has_openssl_ec=no] )
50
73
AC_MSG_RESULT ( [ $has_openssl_ec] )
51
74
CPPFLAGS="$CPPFLAGS_TEMP"
0 commit comments