Make SM2 functions private
authorJack Lloyd <jack.lloyd@ribose.com>
Fri, 6 Apr 2018 13:45:41 +0000 (09:45 -0400)
committerMatt Caswell <matt@openssl.org>
Mon, 4 Jun 2018 10:59:40 +0000 (11:59 +0100)
Address issue #5670

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)

crypto/ec/ec_pmeth.c
crypto/err/openssl.ec
crypto/include/internal/sm2.h [moved from include/openssl/sm2.h with 100% similarity]
crypto/include/internal/sm2err.h [moved from include/openssl/sm2err.h with 100% similarity]
crypto/sm2/sm2_crypt.c
crypto/sm2/sm2_err.c
crypto/sm2/sm2_sign.c
crypto/sm2/sm2_za.c
test/build.info
test/sm2_crypt_internal_test.c [moved from test/sm2crypttest.c with 99% similarity]
test/sm2_sign_internal_test.c [moved from test/sm2sigtest.c with 99% similarity]

index b4105c20f2c901579e00e00663cbbd29922285c5..eefe2d0cd5fe5f274ecbedbdd7b506cf7821fe12 100644 (file)
@@ -17,7 +17,7 @@
 #include "internal/evp_int.h"
 
 #if !defined(OPENSSL_NO_SM2)
-# include <openssl/sm2.h>
+# include "internal/sm2.h"
 #endif
 
 /* EC pkey context structure */
index f45e230749989da271f80e3e4a360bb8b66a17fe..7fc5788434c13410f037b3ad125b415c7d98f19c 100644 (file)
@@ -32,7 +32,7 @@ L CMS           include/openssl/cms.h           crypto/cms/cms_err.c
 L CT            include/openssl/ct.h            crypto/ct/ct_err.c
 L ASYNC         include/openssl/async.h         crypto/async/async_err.c
 L KDF           include/openssl/kdf.h           crypto/kdf/kdf_err.c
-L SM2           include/openssl/sm2.h           crypto/sm2/sm2_err.c
+L SM2           crypto/include/internal/sm2.h   crypto/sm2/sm2_err.c
 L OSSL_STORE    include/openssl/store.h         crypto/store/store_err.c
 
 # additional header files to be scanned for function names
index a31c40fc7acbefbb89683249cd46dd820010cb8f..c3abd969eb71b6d78a690e8b08fa4774be7f9d0b 100644 (file)
@@ -9,7 +9,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/sm2.h>
+#include "internal/sm2.h"
 #include <openssl/evp.h>
 #include <openssl/bn.h>
 #include <openssl/asn1.h>
index 0c051f68b6ead011d20771f65b82c75f0349d9db..6f244a5eb055f821161674aeea41a65e39be7c86 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <openssl/err.h>
-#include <openssl/sm2err.h>
+#include "internal/sm2err.h"
 
 #ifndef OPENSSL_NO_ERR
 
index e12eca12fb432944540b80297c5569e910e18917..ddfd318ed904e0c764811d8840996a00a1b1aa89 100644 (file)
@@ -9,7 +9,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/sm2.h>
+#include "internal/sm2.h"
 #include <openssl/evp.h>
 #include <openssl/bn.h>
 #include <string.h>
index f76fe0fcadcc0c47807bdf492c12c5f5d19b96d7..cf355238b284c9ad8ca6eb37e85b098e61fc7579 100644 (file)
@@ -9,7 +9,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/sm2.h>
+#include "internal/sm2.h"
 #include <openssl/evp.h>
 #include <openssl/bn.h>
 #include <string.h>
index 000153d510bccc5bd4bd3b44171fc5591a9507b8..ee302e233cf05b4e7a87e5618668eafc71c542b8 100644 (file)
@@ -28,7 +28,6 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
           aborttest test_test \
           sanitytest exdatatest bntest \
           ectest ecstresstest ecdsatest gmdifftest pbelutest ideatest \
-          sm2sigtest sm2crypttest \
           md2test \
           hmactest \
           rc2test rc4test rc5test \
@@ -89,14 +88,6 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
   INCLUDE[ecdsatest]=../include
   DEPEND[ecdsatest]=../libcrypto libtestutil.a
 
-  SOURCE[sm2sigtest]=sm2sigtest.c
-  INCLUDE[sm2sigtest]=../include
-  DEPEND[sm2sigtest]=../libcrypto libtestutil.a
-
-  SOURCE[sm2crypttest]=sm2crypttest.c
-  INCLUDE[sm2crypttest]=../include
-  DEPEND[sm2crypttest]=../libcrypto libtestutil.a
-
   SOURCE[gmdifftest]=gmdifftest.c
   INCLUDE[gmdifftest]=../include
   DEPEND[gmdifftest]=../libcrypto libtestutil.a
@@ -448,6 +439,9 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
     IF[{- !$disabled{siphash} -}]
       PROGRAMS_NO_INST=siphash_internal_test
     ENDIF
+    IF[{- !$disabled{sm2} -}]
+      PROGRAMS_NO_INST=sm2_crypt_internal_test sm2_sign_internal_test
+    ENDIF
     IF[{- !$disabled{sm4} -}]
       PROGRAMS_NO_INST=sm4_internal_test
     ENDIF
@@ -491,6 +485,14 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
     INCLUDE[siphash_internal_test]=.. ../include ../crypto/include
     DEPEND[siphash_internal_test]=../libcrypto.a libtestutil.a
 
+    SOURCE[sm2_sign_internal_test]=sm2_sign_internal_test.c
+    INCLUDE[sm2_sign_internal_test]=../include ../crypto/include
+    DEPEND[sm2_sign_internal_test]=../libcrypto.a libtestutil.a
+
+    SOURCE[sm2_crypt_internal_test]=sm2_crypt_internal_test.c
+    INCLUDE[sm2_crypt_internal_test]=../include ../crypto/include
+    DEPEND[sm2_crypt_internal_test]=../libcrypto.a libtestutil.a
+
     SOURCE[sm4_internal_test]=sm4_internal_test.c
     INCLUDE[sm4_internal_test]=.. ../include ../crypto/include
     DEPEND[sm4_internal_test]=../libcrypto.a libtestutil.a
similarity index 99%
rename from test/sm2crypttest.c
rename to test/sm2_crypt_internal_test.c
index cd72cb09388487437c8fe0b99ca7573115397605..5325fa3fc558c09af88c9466de82d21f58bdcf32 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef OPENSSL_NO_SM2
 
-# include <openssl/sm2.h>
+# include "internal/sm2.h"
 
 static RAND_METHOD fake_rand;
 static const RAND_METHOD *saved_rand;
similarity index 99%
rename from test/sm2sigtest.c
rename to test/sm2_sign_internal_test.c
index 33be78315be7622fc25cee36f3c3ac48fd55a3b9..87f0d733824e11dedb2624382d43cb7b01611bf9 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef OPENSSL_NO_SM2
 
-# include <openssl/sm2.h>
+# include "internal/sm2.h"
 
 static RAND_METHOD fake_rand;
 static const RAND_METHOD *saved_rand;