From 98020023a46e4c32a468bf16e826da09e5547d37 Mon Sep 17 00:00:00 2001 From: Todd Short Date: Mon, 19 Mar 2018 13:21:13 -0400 Subject: [PATCH] Fix no-sm3 (and no-sm2) Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/5677) --- Configure | 1 + crypto/ec/ec_curve.c | 2 ++ include/openssl/sm2.h | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/Configure b/Configure index a85beeaf6e..0934088d2d 100755 --- a/Configure +++ b/Configure @@ -486,6 +486,7 @@ my @disable_cascades = ( "tests" => [ "external-tests" ], "comp" => [ "zlib" ], "ec" => [ "tls1_3", "sm2" ], + "sm3" => [ "sm2" ], sub { !$disabled{"unit-test"} } => [ "heartbeats" ], sub { !$disabled{"msan"} } => [ "asm" ], diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c index 01d56543db..46cbe22e05 100644 --- a/crypto/ec/ec_curve.c +++ b/crypto/ec/ec_curve.c @@ -2997,8 +2997,10 @@ static const ec_list_element curve_list[] = { "RFC 5639 curve over a 512 bit prime field"}, {NID_brainpoolP512t1, &_EC_brainpoolP512t1.h, 0, "RFC 5639 curve over a 512 bit prime field"}, +#ifndef OPENSSL_NO_SM2 {NID_sm2, &_EC_sm2p256v1.h, 0, "SM2 curve over a 256 bit prime field"}, +#endif }; #define curve_list_length OSSL_NELEM(curve_list) diff --git a/include/openssl/sm2.h b/include/openssl/sm2.h index a3c055b199..24ee7657b8 100644 --- a/include/openssl/sm2.h +++ b/include/openssl/sm2.h @@ -15,6 +15,10 @@ # ifndef OPENSSL_NO_SM2 +# ifdef __cplusplus +extern "C" { +# endif + # include /* The default user id as specified in GM/T 0009-2012 */ @@ -74,5 +78,9 @@ int SM2_decrypt(const EC_KEY *key, int ERR_load_SM2_strings(void); +# ifdef __cplusplus +} +# endif + # endif /* OPENSSL_NO_SM2 */ #endif -- 2.25.1