Reorganize private crypto header files
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Fri, 27 Sep 2019 22:45:33 +0000 (00:45 +0200)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Sat, 28 Sep 2019 18:26:34 +0000 (20:26 +0200)
Currently, there are two different directories which contain internal
header files of libcrypto which are meant to be shared internally:

While header files in 'include/internal' are intended to be shared
between libcrypto and libssl, the files in 'crypto/include/internal'
are intended to be shared inside libcrypto only.

To make things complicated, the include search path is set up in such
a way that the directive #include "internal/file.h" could refer to
a file in either of these two directoroes. This makes it necessary
in some cases to add a '_int.h' suffix to some files to resolve this
ambiguity:

  #include "internal/file.h"      # located in 'include/internal'
  #include "internal/file_int.h"  # located in 'crypto/include/internal'

This commit moves the private crypto headers from

  'crypto/include/internal'  to  'include/crypto'

As a result, the include directives become unambiguous

  #include "internal/file.h"       # located in 'include/internal'
  #include "crypto/file.h"         # located in 'include/crypto'

hence the superfluous '_int.h' suffixes can be stripped.

The files 'store_int.h' and 'store.h' need to be treated specially;
they are joined into a single file.

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

365 files changed:
.gitignore
build.info
crypto/aria/aria.c
crypto/asn1/a_d2i_fp.c
crypto/asn1/a_mbstr.c
crypto/asn1/a_object.c
crypto/asn1/a_print.c
crypto/asn1/a_sign.c
crypto/asn1/a_strex.c
crypto/asn1/a_time.c
crypto/asn1/a_verify.c
crypto/asn1/ameth_lib.c
crypto/asn1/asn_mime.c
crypto/asn1/asn_moid.c
crypto/asn1/d2i_param.c
crypto/asn1/d2i_pr.c
crypto/asn1/d2i_pu.c
crypto/asn1/f_int.c
crypto/asn1/f_string.c
crypto/asn1/i2d_param.c
crypto/asn1/i2d_pr.c
crypto/asn1/p8_pkey.c
crypto/asn1/t_pkey.c
crypto/asn1/tasn_enc.c
crypto/asn1/tasn_prn.c
crypto/asn1/x_algor.c
crypto/asn1/x_sig.c
crypto/asn1_dsa.c
crypto/async/async.c
crypto/async/async_locl.h
crypto/bio/b_print.c
crypto/blake2/m_blake2b.c
crypto/blake2/m_blake2s.c
crypto/bn/bn_conv.c
crypto/bn/bn_dh.c
crypto/bn/bn_lcl.h
crypto/bn/bn_rand.c
crypto/bn/bn_rsa_fips186_4.c
crypto/bn/bn_srp.c
crypto/chacha/chacha_enc.c
crypto/cmac/cm_ameth.c
crypto/cms/cms_env.c
crypto/cms/cms_ess.c
crypto/cms/cms_kari.c
crypto/cms/cms_pwri.c
crypto/cms/cms_sd.c
crypto/cms/cms_smime.c
crypto/comp/c_zlib.c
crypto/conf/conf_lib.c
crypto/context.c
crypto/core_namemap.c
crypto/cryptlib.c
crypto/ctype.c
crypto/dh/dh_ameth.c
crypto/dh/dh_key.c
crypto/dh/dh_pmeth.c
crypto/dh/dh_rfc5114.c
crypto/dh/dh_rfc7919.c
crypto/dllmain.c
crypto/dsa/dsa_ameth.c
crypto/dsa/dsa_asn1.c
crypto/dsa/dsa_ossl.c
crypto/dsa/dsa_pmeth.c
crypto/dso/dso_locl.h
crypto/ec/ec2_smpl.c
crypto/ec/ec_ameth.c
crypto/ec/ec_asn1.c
crypto/ec/ec_cvt.c
crypto/ec/ec_lcl.h
crypto/ec/ec_mult.c
crypto/ec/ec_pmeth.c
crypto/ec/ecdsa_ossl.c
crypto/ec/ecp_nistz256.c
crypto/ec/ecx_meth.c
crypto/engine/eng_int.h
crypto/engine/eng_openssl.c
crypto/engine/eng_rdrand.c
crypto/engine/tb_asnmth.c
crypto/err/err.c
crypto/err/err_all.c
crypto/err/openssl.ec
crypto/ess/ess_asn1.c
crypto/ess/ess_lib.c
crypto/evp/bio_md.c
crypto/evp/bio_ok.c
crypto/evp/c_allc.c
crypto/evp/c_alld.c
crypto/evp/cmeth_lib.c
crypto/evp/digest.c
crypto/evp/e_aes.c
crypto/evp/e_aes_cbc_hmac_sha1.c
crypto/evp/e_aes_cbc_hmac_sha256.c
crypto/evp/e_aria.c
crypto/evp/e_bf.c
crypto/evp/e_camellia.c
crypto/evp/e_cast.c
crypto/evp/e_chacha20_poly1305.c
crypto/evp/e_des.c
crypto/evp/e_des3.c
crypto/evp/e_idea.c
crypto/evp/e_null.c
crypto/evp/e_rc2.c
crypto/evp/e_rc4.c
crypto/evp/e_rc4_hmac_md5.c
crypto/evp/e_rc5.c
crypto/evp/e_seed.c
crypto/evp/e_sm4.c
crypto/evp/e_xcbc_d.c
crypto/evp/encode.c
crypto/evp/evp_enc.c
crypto/evp/evp_fetch.c
crypto/evp/evp_lib.c
crypto/evp/evp_pbe.c
crypto/evp/evp_pkey.c
crypto/evp/evp_utils.c
crypto/evp/exchange.c
crypto/evp/kdf_lib.c
crypto/evp/kdf_meth.c
crypto/evp/keymgmt_lib.c
crypto/evp/keymgmt_meth.c
crypto/evp/m_md2.c
crypto/evp/m_md4.c
crypto/evp/m_md5.c
crypto/evp/m_md5_sha1.c
crypto/evp/m_mdc2.c
crypto/evp/m_null.c
crypto/evp/m_ripemd.c
crypto/evp/m_sha1.c
crypto/evp/m_sha3.c
crypto/evp/m_sigver.c
crypto/evp/m_wp.c
crypto/evp/mac_lib.c
crypto/evp/mac_meth.c
crypto/evp/names.c
crypto/evp/p5_crpt2.c
crypto/evp/p_lib.c
crypto/evp/p_sign.c
crypto/evp/p_verify.c
crypto/evp/pkey_kdf.c
crypto/evp/pkey_mac.c
crypto/evp/pmeth_fn.c
crypto/evp/pmeth_gn.c
crypto/evp/pmeth_lib.c
crypto/ex_data.c
crypto/hmac/hm_ameth.c
crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H [deleted file]
crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H [deleted file]
crypto/include/internal/aria.h [deleted file]
crypto/include/internal/asn1_dsa.h [deleted file]
crypto/include/internal/asn1_int.h [deleted file]
crypto/include/internal/async.h [deleted file]
crypto/include/internal/bn_conf.h.in [deleted file]
crypto/include/internal/bn_dh.h [deleted file]
crypto/include/internal/bn_int.h [deleted file]
crypto/include/internal/bn_srp.h [deleted file]
crypto/include/internal/chacha.h [deleted file]
crypto/include/internal/ciphermode_platform.h [deleted file]
crypto/include/internal/cms_int.h [deleted file]
crypto/include/internal/cryptlib_int.h [deleted file]
crypto/include/internal/ctype.h [deleted file]
crypto/include/internal/dso_conf.h.in [deleted file]
crypto/include/internal/ec_int.h [deleted file]
crypto/include/internal/engine.h [deleted file]
crypto/include/internal/err_int.h [deleted file]
crypto/include/internal/ess_int.h [deleted file]
crypto/include/internal/evp_int.h [deleted file]
crypto/include/internal/lhash.h [deleted file]
crypto/include/internal/md32_common.h [deleted file]
crypto/include/internal/modes_int.h [deleted file]
crypto/include/internal/objects.h [deleted file]
crypto/include/internal/poly1305.h [deleted file]
crypto/include/internal/rand_int.h [deleted file]
crypto/include/internal/sha.h [deleted file]
crypto/include/internal/siphash.h [deleted file]
crypto/include/internal/siv_int.h [deleted file]
crypto/include/internal/sm2.h [deleted file]
crypto/include/internal/sm2err.h [deleted file]
crypto/include/internal/sm4.h [deleted file]
crypto/include/internal/sparse_array.h [deleted file]
crypto/include/internal/store.h [deleted file]
crypto/include/internal/store_int.h [deleted file]
crypto/include/internal/x509_int.h [deleted file]
crypto/info.c
crypto/init.c
crypto/initthread.c
crypto/lhash/lhash.c
crypto/md4/md4_locl.h
crypto/md5/md5_locl.h
crypto/mem.c
crypto/modes/cbc128.c
crypto/modes/ccm128.c
crypto/modes/cfb128.c
crypto/modes/ctr128.c
crypto/modes/cts128.c
crypto/modes/gcm128.c
crypto/modes/ocb128.c
crypto/modes/ofb128.c
crypto/modes/siv128.c
crypto/modes/xts128.c
crypto/objects/o_names.c
crypto/objects/obj_dat.c
crypto/objects/obj_lib.c
crypto/ocsp/ocsp_ht.c
crypto/pem/pem_lib.c
crypto/pem/pem_pkey.c
crypto/pkcs12/p12_p8e.c
crypto/pkcs7/pk7_lib.c
crypto/poly1305/poly1305.c
crypto/poly1305/poly1305_ameth.c
crypto/ppccap.c
crypto/property/property.c
crypto/property/property_parse.c
crypto/property/property_string.c
crypto/provider_core.c
crypto/rand/drbg_lib.c
crypto/rand/rand_crng_test.c
crypto/rand/rand_lcl.h
crypto/rand/rand_lib.c
crypto/rand/rand_unix.c
crypto/rand/rand_vms.c
crypto/rand/rand_vxworks.c
crypto/rand/rand_win.c
crypto/ripemd/rmd_locl.h
crypto/rsa/rsa_ameth.c
crypto/rsa/rsa_crpt.c
crypto/rsa/rsa_lib.c
crypto/rsa/rsa_ossl.c
crypto/rsa/rsa_pmeth.c
crypto/rsa/rsa_sign.c
crypto/rsa/rsa_sp800_56b_check.c
crypto/rsa/rsa_sp800_56b_gen.c
crypto/s390xcap.c
crypto/sha/sha1dgst.c
crypto/sha/sha256.c
crypto/sha/sha512.c
crypto/sha/sha_locl.h
crypto/siphash/siphash.c
crypto/siphash/siphash_ameth.c
crypto/sm2/sm2_crypt.c
crypto/sm2/sm2_err.c
crypto/sm2/sm2_pmeth.c
crypto/sm2/sm2_sign.c
crypto/sm3/m_sm3.c
crypto/sm3/sm3_locl.h
crypto/sm4/sm4.c
crypto/sparse_array.c
crypto/srp/srp_lib.c
crypto/srp/srp_vfy.c
crypto/store/loader_file.c
crypto/store/store_init.c
crypto/store/store_lib.c
crypto/store/store_register.c
crypto/trace.c
crypto/ts/ts_rsp_sign.c
crypto/ts/ts_rsp_verify.c
crypto/x509/by_dir.c
crypto/x509/pcy_cache.c
crypto/x509/pcy_map.c
crypto/x509/t_x509.c
crypto/x509/v3_addr.c
crypto/x509/v3_asid.c
crypto/x509/v3_conf.c
crypto/x509/v3_crld.c
crypto/x509/v3_ncons.c
crypto/x509/v3_purp.c
crypto/x509/v3_skey.c
crypto/x509/v3_utl.c
crypto/x509/x509_cmp.c
crypto/x509/x509_ext.c
crypto/x509/x509_lu.c
crypto/x509/x509_obj.c
crypto/x509/x509_r2x.c
crypto/x509/x509_req.c
crypto/x509/x509_set.c
crypto/x509/x509_trs.c
crypto/x509/x509_vfy.c
crypto/x509/x509_vpm.c
crypto/x509/x509cset.c
crypto/x509/x509name.c
crypto/x509/x509rset.c
crypto/x509/x_all.c
crypto/x509/x_crl.c
crypto/x509/x_name.c
crypto/x509/x_pubkey.c
crypto/x509/x_req.c
crypto/x509/x_x509.c
crypto/x509/x_x509a.c
doc/internal/man3/DEFINE_SPARSE_ARRAY_OF.pod
doc/internal/man3/evp_keymgmt_export_to_provider.pod
doc/internal/man3/evp_keymgmt_freekey.pod
doc/internal/man3/ossl_init_thread_deregister.pod
doc/internal/man3/rand_bytes_ex.pod
include/crypto/__DECC_INCLUDE_EPILOGUE.H [new file with mode: 0644]
include/crypto/__DECC_INCLUDE_PROLOGUE.H [new file with mode: 0644]
include/crypto/aria.h [new file with mode: 0644]
include/crypto/asn1.h [new file with mode: 0644]
include/crypto/asn1_dsa.h [new file with mode: 0644]
include/crypto/async.h [new file with mode: 0644]
include/crypto/bn.h [new file with mode: 0644]
include/crypto/bn_conf.h.in [new file with mode: 0644]
include/crypto/bn_dh.h [new file with mode: 0644]
include/crypto/bn_srp.h [new file with mode: 0644]
include/crypto/chacha.h [new file with mode: 0644]
include/crypto/ciphermode_platform.h [new file with mode: 0644]
include/crypto/cms.h [new file with mode: 0644]
include/crypto/cryptlib.h [new file with mode: 0644]
include/crypto/ctype.h [new file with mode: 0644]
include/crypto/dso_conf.h.in [new file with mode: 0644]
include/crypto/ec.h [new file with mode: 0644]
include/crypto/engine.h [new file with mode: 0644]
include/crypto/err.h [new file with mode: 0644]
include/crypto/ess.h [new file with mode: 0644]
include/crypto/evp.h [new file with mode: 0644]
include/crypto/lhash.h [new file with mode: 0644]
include/crypto/md32_common.h [new file with mode: 0644]
include/crypto/modes.h [new file with mode: 0644]
include/crypto/objects.h [new file with mode: 0644]
include/crypto/poly1305.h [new file with mode: 0644]
include/crypto/rand.h [new file with mode: 0644]
include/crypto/sha.h [new file with mode: 0644]
include/crypto/siphash.h [new file with mode: 0644]
include/crypto/siv.h [new file with mode: 0644]
include/crypto/sm2.h [new file with mode: 0644]
include/crypto/sm2err.h [new file with mode: 0644]
include/crypto/sm4.h [new file with mode: 0644]
include/crypto/sparse_array.h [new file with mode: 0644]
include/crypto/store.h [new file with mode: 0644]
include/crypto/x509.h [new file with mode: 0644]
providers/build.info
providers/common/ciphers/cipher_gcm.c
providers/common/ciphers/cipher_tdes.c
providers/common/digests/sha2_prov.c
providers/common/include/internal/ciphers/ciphercommon.h
providers/common/kdfs/hkdf.c
providers/common/kdfs/kbkdf.c
providers/common/kdfs/pbkdf2.c
providers/common/kdfs/sskdf.c
providers/common/kdfs/tls1_prf.c
providers/default/ciphers/cipher_aria.h
providers/default/ciphers/cipher_aria_ccm.h
providers/default/ciphers/cipher_aria_gcm.h
providers/default/ciphers/cipher_des.c
providers/default/ciphers/cipher_sm4.h
providers/default/ciphers/cipher_tdes_wrap.c
providers/default/kdfs/scrypt.c
providers/default/kdfs/sshkdf.c
providers/default/kdfs/x942kdf.c
providers/default/macs/poly1305_prov.c
providers/default/macs/siphash_prov.c
providers/fips/fipsprov.c
test/asn1_dsa_internal_test.c
test/asn1_internal_test.c
test/bn_internal_test.c
test/build.info
test/chacha_internal_test.c
test/ctype_internal_test.c
test/drbgtest.c
test/evp_extra_test.c
test/modes_internal_test.c
test/poly1305_internal_test.c
test/shlibloadtest.c
test/siphash_internal_test.c
test/sm2_internal_test.c
test/sm4_internal_test.c
test/sparse_array_test.c

index 9fdd588e4f9374d3c381084b8611f1ccb33aa764..50f461533e3b69a2f1a64e7a5f4df04995880298 100644 (file)
@@ -26,7 +26,7 @@ Makefile
 
 # Auto generated headers
 /crypto/buildinf.h
-/crypto/include/internal/*_conf.h
+/include/crypto/*_conf.h
 /openssl/include/opensslconf.h
 /util/domd
 
index a0ecb21881637a2c998a8cfbae4e244a36cbe379..83dc6ed164e3ca11300b68da73a9d13509f70854 100644 (file)
@@ -3,20 +3,20 @@
 SUBDIRS=crypto ssl apps test util tools fuzz engines providers
 
 LIBS=libcrypto libssl
-INCLUDE[libcrypto]=. crypto/include include
+INCLUDE[libcrypto]=. include
 INCLUDE[libssl]=. include
 DEPEND[libssl]=libcrypto
 
 # Empty DEPEND "indices" means the dependencies are expected to be built
 # unconditionally before anything else.
-DEPEND[]=include/openssl/opensslconf.h crypto/include/internal/bn_conf.h \
-         crypto/include/internal/dso_conf.h doc/man7/openssl_user_macros.pod
+DEPEND[]=include/openssl/opensslconf.h include/crypto/bn_conf.h \
+         include/crypto/dso_conf.h doc/man7/openssl_user_macros.pod
 DEPEND[include/openssl/opensslconf.h]=configdata.pm
 GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
-DEPEND[crypto/include/internal/bn_conf.h]=configdata.pm
-GENERATE[crypto/include/internal/bn_conf.h]=crypto/include/internal/bn_conf.h.in
-DEPEND[crypto/include/internal/dso_conf.h]=configdata.pm
-GENERATE[crypto/include/internal/dso_conf.h]=crypto/include/internal/dso_conf.h.in
+DEPEND[include/crypto/bn_conf.h]=configdata.pm
+GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
+DEPEND[include/crypto/dso_conf.h]=configdata.pm
+GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
 DEPEND[doc/man7/openssl_user_macros.pod]=configdata.pm
 GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in
 
index 67bd8d95d86153b7284e1ef3808f7ad19eff0d28..c1b2254af7fadc8d1154e9059d58aa3c00d2eff4 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include <openssl/e_os2.h>
-#include "internal/aria.h"
+#include "crypto/aria.h"
 
 #include <assert.h>
 #include <string.h>
index a8d80090cf37a83fd593cd7c9b80167d91b8d4bd..186e7ec4136e42735fb4f8e199da2a3e7cbeb8d8 100644 (file)
@@ -13,7 +13,7 @@
 #include "internal/numbers.h"
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 #ifndef NO_OLD_ASN1
 # ifndef OPENSSL_NO_STDIO
index ea08edc219354402302f6262f18f61ea358433d6..122cafd02c5213e1381918d2c3578c4108a3151c 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/asn1.h>
 
index 913fa9a14d1bb02614a1f3e2bb6024e6468e49f7..cc5541081e1509b9ed20c79967d35b65c650f8b9 100644 (file)
@@ -9,13 +9,13 @@
 
 #include <stdio.h>
 #include <limits.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/bn.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include "asn1_locl.h"
 
 int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
index 516f091916ad3a66163701eda971d88af9551167..328e0abcc510680ecac3875404548ad3d86d5020 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/asn1.h>
 
index e2ef60f773846a764302233d60bef903a77a936c..fdf25b204b72ba422394547b206707607da43cb7 100644 (file)
@@ -18,8 +18,8 @@
 #include <openssl/x509.h>
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 #ifndef NO_ASN1_OLD
 
index 4f431480c203e6d7fe9cdb508e394cd8abd36338..91d78c66341c0e9c612cca3d3c92292a204a8217 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "internal/cryptlib.h"
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include <openssl/crypto.h>
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
index 16f0cc3fe34e435193992f11fbc1fde196227d79..af060c4fc39aeafdc24de93ffdab4e233841bf74 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 #include <time.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include "asn1_locl.h"
index d26c52360072b67acd5ba6885fa567da72068dd6..9484bccf4cc758a21071f2a399e27eb00854d951 100644 (file)
@@ -18,8 +18,8 @@
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 #ifndef NO_ASN1_OLD
 
index b2bcd5acac479596816fa618fa12e04e902385be..4295d889cb6ec9e2dcc2a0f2c85af4b3d9784776 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/engine.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 #include "standard_methods.h"
 
index 5c3493832bc4c000f9c5a906d1841ec92b0ad053..571523e12741fa3a00947fa7a92492dcadeceffb 100644 (file)
@@ -8,13 +8,13 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/bio.h"
 #include "asn1_locl.h"
 
index 251a7efcc629627895d7fc05184d6a325e6b5f55..90f807604819a47c239ccdd8e2f44129a12c5c2c 100644 (file)
@@ -8,13 +8,13 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509.h>
-#include "internal/asn1_int.h"
-#include "internal/objects.h"
+#include "crypto/asn1.h"
+#include "crypto/objects.h"
 
 /* Simple ASN1 OID module: add all objects in a given section */
 
index e852470a663889067d5fd7977a59e61a0567569c..c82b4a8fa83e93b19babe9807b649edff5fe8427 100644 (file)
@@ -11,8 +11,8 @@
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/asn1.h>
-#include "internal/evp_int.h"
-#include "internal/asn1_int.h"
+#include "crypto/evp.h"
+#include "crypto/asn1.h"
 
 EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,
                         long length)
index c683f62c478f2338420456e3a50187484b41e80e..b24f99118e9cc1fffdb2ddfde0cbe993b227d792 100644 (file)
@@ -15,8 +15,8 @@
 #include <openssl/engine.h>
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
                          long length)
index 8876878fd074e0d97437d8ce04aeb2a1b600ad1c..4b26ec0400772d6ac0448cfef3ea02bac82a75bf 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/dsa.h>
 #include <openssl/ec.h>
 
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
                         long length)
index de7d983695f1538ee5e32bd8b1e0d483c89dba5c..295ecb6fc5bc22f924cb6d71ad7f9491d764dc91 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
index dbca0c06136f1a1b67882988184930fc7404148b..0b930dfd0a8a2980a3dae27dfde0b325e322095c 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
index 2e9000891a19d88817cc9d988cb52c34e537c6bb..1e1ebc95b2ef567c942dc799450b1602f6a4970b 100644 (file)
@@ -12,8 +12,8 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/asn1.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
 {
index 7133d3da9c46a287920ec6c5b9bf7cf0bc6c7aa9..4decdb1dd739bab1387ad26cbbf18e7462f41ab9 100644 (file)
@@ -11,8 +11,8 @@
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp)
 {
index 94b32646cc3e8a529869a9791bfda168898e15f8..c55353ae112c22fad9e860583f0bd90856bd2365 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 /* Minor tweak to operation: zero private key data */
 static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
index 483dd109212616c95e20681d9eeab19ebd044f6b..03579c877cfc001d54f8ed39e5b6c225cf124d06 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 
 /* Number of octets per line */
 #define ASN1_BUF_PRINT_WIDTH    15
index 8ab9c370fdef4e4242d98459a3fd7f231fe09273..0ca8460580a463691e8590b30672de9b2ff514df 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include "asn1_locl.h"
 
 static int asn1_i2d_ex_primitive(const ASN1_VALUE **pval, unsigned char **out,
index 0f56fb092da5e243a74a23fcc09e4c6a6c3a2b1d..149300e4fbcd68135991f110f8737cb8b98e2789 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/buffer.h>
 #include <openssl/err.h>
 #include <openssl/x509v3.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include "asn1_locl.h"
 
 /*
index 77363fe75d1e6e16ad85410bdf95acac992cdd15..94c2aa3a2b2119c18ea63e45bac1668821798327 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 ASN1_SEQUENCE(X509_ALGOR) = {
         ASN1_SIMPLE(X509_ALGOR, algorithm, ASN1_OBJECT),
index f8ca810fbec95f27797521ccf5bc5045bb681d7f..759a9566531e9d1ea0b73fe7ddda0314f9e1fd1f 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 ASN1_SEQUENCE(X509_SIG) = {
         ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR),
index 8423ff883f4cb1f9aeb302823720e0899d0f65be..972a9eb9055ba76a9eaccb39ae137e0e8558550c 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
-#include "internal/asn1_dsa.h"
+#include "crypto/asn1_dsa.h"
 #include "internal/packet.h"
 
 #define ID_SEQUENCE 0x30
index 43b16a7b7c0288b85b9e9e2014ef6b0568700f76..74904195869496696766282984397af3556a6923 100644 (file)
@@ -19,7 +19,7 @@
 #include "async_locl.h"
 
 #include <openssl/err.h>
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include <string.h>
 
 #define ASYNC_JOB_RUNNING   0
index 85dfcfa6327a9d9c67a897e2cc733a6c7fc795b6..549a27e61143328bc599b93df15bfc8b9cf82d1b 100644 (file)
@@ -20,7 +20,7 @@
 # include <windows.h>
 #endif
 
-#include "internal/async.h"
+#include "crypto/async.h"
 #include <openssl/crypto.h>
 
 typedef struct async_ctx_st async_ctx;
index 438cd0e6362f4f9eb5a90d1a2270c9083f21632b..0d6fafcc2d411da4158526b024173bab58f0b981 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "internal/cryptlib.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/numbers.h"
 #include <openssl/bio.h>
 
index b429d2d7f2e695aaeaf274a73d27573362dfe2e9..816dd06b6c83b4198b3e5a5c80287e52a7f384aa 100644 (file)
@@ -11,7 +11,7 @@
 
 # include <stddef.h>
 # include <openssl/obj_mac.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include "internal/blake2.h"
 
 static int init(EVP_MD_CTX *ctx)
index dd4b68fa1c2d3589fc143a890c90d4fbc4c3f524..caf8a6657a128752f06fb9fb41fd634352965d0e 100644 (file)
@@ -11,7 +11,7 @@
 
 # include <stddef.h>
 # include <openssl/obj_mac.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include "internal/blake2.h"
 
 static int init(EVP_MD_CTX *ctx)
index 9219fa4cb88f2de762e9ceede9d1012851bed201..3c5ae75ef7e6877ebf7b5eecf1728464ad4ec321 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <openssl/err.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "bn_lcl.h"
 
 static const char Hex[] = "0123456789ABCDEF";
index 668be57a18fd49344493ea1c5198eafffabc800e..4e97a9877975e927785939a9e83da224f55d98d2 100644 (file)
@@ -12,7 +12,7 @@
 
 #ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
-#include "internal/bn_dh.h"
+#include "crypto/bn_dh.h"
 /* DH parameters from RFC5114 */
 
 # if BN_BITS2 == 64
index 38e66ab123154a5bb2bcc808c0f52f61fc9c3f4f..2640f3416fa972b649f7d592b89d5266769de740 100644 (file)
 # include <openssl/opensslconf.h>
 
 # if !defined(OPENSSL_SYS_UEFI)
-#  include "internal/bn_conf.h"
+#  include "crypto/bn_conf.h"
 # endif
 
-# include "internal/bn_int.h"
+# include "crypto/bn.h"
 
 /*
  * These preprocessor symbols control various aspects of the bignum headers
index 2b3e6f2076e88a7871b8735553e770bdc8cce686..836ff54af63c6aca546ef2c957b72ce1614fa59b 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <time.h>
 #include "internal/cryptlib.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "bn_lcl.h"
 #include <openssl/rand.h>
 #include <openssl/sha.h>
index 9a3041e2e13dcc52791bc40a16eb2e73a1e796f9..2a0f35f7a5e7abd4a525ef2e79dede01ba7b67b0 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdio.h>
 #include <openssl/bn.h>
 #include "bn_lcl.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 
 /*
  * FIPS 186-4 Table B.1. "Min length of auxiliary primes p1, p2, q1, q2".
index d722f59eb7d6a0cf2da065a71d35f773e472117b..412bc5e9f6dff94579b7aa1c4cee5c4f73b668c2 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OPENSSL_NO_SRP
 
 #include <openssl/srp.h>
-#include "internal/bn_srp.h"
+#include "crypto/bn_srp.h"
 
 # if (BN_BYTES == 8)
 #  if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
index e350c9b0f10f65c14bc34471473ce710c5254e15..05a716b5d42b22a895a9182c1d8550e154936873 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <string.h>
 
-#include "internal/chacha.h"
+#include "crypto/chacha.h"
 
 typedef unsigned int u32;
 typedef unsigned char u8;
index b1ee0d3d2f1d5406a9b59c8dd15be31732c69591..9db2562157238c058ecf33e1931af1238d47d0bf 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 /*
  * CMAC "ASN1" method. This is just here to indicate the maximum CMAC output
index 27e98ce0a7de95f23077b489e110d71a1fee5cfd..15248ddf3c3e9edb7f4cfac00c5ae49102c5fe35 100644 (file)
@@ -15,8 +15,8 @@
 #include <openssl/cms.h>
 #include <openssl/aes.h>
 #include "cms_lcl.h"
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 /* CMS EnvelopedData Utilities */
 
index 8f80f6ba5df7919ba512fc52235b13a2970b6280..ded7738218764b623c7a782d6cf2eff251eab6fb 100644 (file)
@@ -16,8 +16,8 @@
 #include <openssl/cms.h>
 #include <openssl/ess.h>
 #include "cms_lcl.h"
-#include "internal/ess_int.h"
-#include "internal/cms_int.h"
+#include "crypto/ess.h"
+#include "crypto/cms.h"
 
 IMPLEMENT_ASN1_FUNCTIONS(CMS_ReceiptRequest)
 
index 866749a171eeea6947efd3df6beebf3febdc6c9a..364903b662a5c7713232492157c0046940d9d52c 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/cms.h>
 #include <openssl/aes.h>
 #include "cms_lcl.h"
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 /* Key Agreement Recipient Info (KARI) routines */
 
index f0502a45100cc2e944a70fb9d65c87bf32ab8db1..d1cb16f3fd30a58b584a235fdec7d4a4734a9f8b 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/rand.h>
 #include <openssl/aes.h>
 #include "cms_lcl.h"
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
                                     unsigned char *pass, ossl_ssize_t passlen)
index 6715e84d2fcc9628b4d19928c7363d2c095b03d1..1cea8617655da7eecd712e5f667543bba5a0f36c 100644 (file)
 #include <openssl/cms.h>
 #include <openssl/ess.h>
 #include "cms_lcl.h"
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
-#include "internal/cms_int.h"
-#include "internal/ess_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
+#include "crypto/cms.h"
+#include "crypto/ess.h"
 
 /* CMS SignedData Utilities */
 
index ae95ff2dd22a2f9addb52fc096ce1365cec5dfae..1117d7488c3038cb4efac20313823a97c7673c2b 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/err.h>
 #include <openssl/cms.h>
 #include "cms_lcl.h"
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 static BIO *cms_get_text_bio(BIO *out, unsigned int flags)
 {
index 1dd7d679981081ca43b20920b65e48fe23033425..17786e8cedf03e65787d0523f31c35efd59d37bd 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/objects.h>
 #include "internal/comp.h"
 #include <openssl/err.h>
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/bio.h"
 #include "comp_lcl.h"
 
index 13d061b298cf870c441dd8430bb1b6c9f2143c96..833b7a6551ad7ceedc785e876629703591c7ea38 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "internal/conf.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <openssl/crypto.h>
 #include <openssl/err.h>
 #include <openssl/conf.h>
index a2e19bac5442cb94f41347b7139f735a22e0c718..02fecf9f35b48ed232a6a9ec20899654a231b307 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/thread_once.h"
 #include "internal/property.h"
 
index cf5f1e54c390879408a3f6b936448bfd6c3a3894..cb26b429b7519d2f775a99153610666e30e58ffe 100644 (file)
@@ -10,7 +10,7 @@
 #include "e_os.h"                /* strcasecmp */
 #include "internal/namemap.h"
 #include <openssl/lhash.h>
-#include "internal/lhash.h"      /* openssl_lh_strcasehash */
+#include "crypto/lhash.h"      /* openssl_lh_strcasehash */
 
 /*-
  * The namenum entry
index 7e89bbd6b5709382cbabbbfb2e0fbab68b3aaaf8..bc29a3b583d63525eb12c2b4665f650e56c41a70 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include "e_os.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include <openssl/safestack.h>
 
 #if     defined(__i386)   || defined(__i386__)   || defined(_M_IX86) || \
@@ -49,7 +49,7 @@ typedef char variant_char;
 #   define ossl_getenv getenv
 #  endif
 
-#  include "internal/ctype.h"
+#  include "crypto/ctype.h"
 
 static int todigit(variant_char c)
 {
index e7bc25b9766130a5180635a6060356fb0913bdca..dbd7891399ad59e0cd6f50cea921785e73189507 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "openssl/ebcdic.h"
 
 /*
index 84f1f8b952c6947288fb820e4d32c69cc7435a8d..c0bcf25567883e5cd4139fbb6b36458b1a8764a7 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/asn1.h>
 #include "dh_locl.h"
 #include <openssl/bn.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include <openssl/cms.h>
 #include <openssl/core_names.h>
 #include "internal/param_build.h"
index 8731cc2c7315a14246bc03f91df045e7b752a1f7..71f748f8297f41960ce6e3e31306d9ce6e921067 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include "dh_locl.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 
 static int generate_key(DH *dh);
 static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
index 4676a222e2f965654199ecb807461844ddc1c1cc..1f0f3d4d3f4bb1cd120beb33c21f155c76e1b6ab 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/bn.h>
 #include <openssl/dsa.h>
 #include <openssl/objects.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 /* DH pkey context structure */
 
index 1cc323839b82bc228c14def9b867281439aec5d2..143a19f22444c63c1e008a6a47725ffe951e82da 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include "dh_locl.h"
 #include <openssl/bn.h>
-#include "internal/bn_dh.h"
+#include "crypto/bn_dh.h"
 
 /*
  * Macro to make a DH structure from BIGNUM data. NB: although just copying
index 4e676fd3d1271f93bb40987c76004e95b9586d21..d634dbc37614bd130ba10dd765a78fe613b21057 100644 (file)
@@ -12,7 +12,7 @@
 #include "dh_locl.h"
 #include <openssl/bn.h>
 #include <openssl/objects.h>
-#include "internal/bn_dh.h"
+#include "crypto/bn_dh.h"
 
 static DH *dh_param_init(const BIGNUM *p, int32_t nbits)
 {
index 6f12741f9a92882eca1f4f5896fce464743a90d0..48c0cd31227a4107aab0cdd0d2b3763a1a59630f 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "e_os.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 # ifdef __CYGWIN__
index f3aab34856f06b02050307b89a38ca56244e1d79..386646149022bf475031fbcd9c3914f41bac1fde 100644 (file)
@@ -14,8 +14,8 @@
 #include <openssl/cms.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "internal/param_build.h"
 #include "dsa_locl.h"
 
index eddcc11819a442f8aa65e1eddd5046e78580ddf3..55c4522c2fab160509ed58b8a818be7e6f51582a 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/rand.h>
-#include "internal/asn1_dsa.h"
+#include "crypto/asn1_dsa.h"
 
 DSA_SIG *DSA_SIG_new(void)
 {
index 08f2e9f025d6d25557c1db9ef42431c57d5eb792..0b9a0afd852224f7f89470c02017666714133990 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include <openssl/bn.h>
 #include <openssl/sha.h>
 #include "dsa_locl.h"
index 496063d8769aef83db050f1f885ee911b4392189..93e84b9b97fc877321b3e5bfd5360887cacadc59 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/x509.h>
 #include <openssl/evp.h>
 #include <openssl/bn.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "dsa_locl.h"
 
 /* DSA pkey context structure */
index 5d365aab25c410f012d55a31f113d7e9bcb08e7c..8aa29c1826fec97e2c29cb7869e674ffac2f4825 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include "internal/dso.h"
-#include "internal/dso_conf.h"
+#include "crypto/dso_conf.h"
 #include "internal/refcount.h"
 
 /**********************************************************************/
index f377b1f11e24da1f1d51b4f545cbab82a9c62e0a..a9e9a4c842b42d91613078b83c5597ad02ca842a 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <openssl/err.h>
 
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "ec_lcl.h"
 
 #ifndef OPENSSL_NO_EC2M
index 2beeb82707bbb5f4da8c52f33574b84095665841..74124bdc639c98ee7add9aea133f1148b65e5401 100644 (file)
@@ -14,8 +14,8 @@
 #include <openssl/bn.h>
 #include <openssl/cms.h>
 #include <openssl/asn1t.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "ec_lcl.h"
 
 #ifndef OPENSSL_NO_CMS
index 2726f5d15109718f50d86b6a87b092735c287b5c..9a8a80021ca688f833b3846300ef59e2f2a2365a 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
 #include "internal/nelem.h"
-#include "internal/asn1_dsa.h"
+#include "crypto/asn1_dsa.h"
 
 #ifndef FIPS_MODE
 
index 9b3087ed0936e51d140c8dd827da6edef1481240..4b4096b0bf2e80b89da24fd8830c9610cf5e15c0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <openssl/err.h>
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "ec_lcl.h"
 
 EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
index b33d30982c08b83a3cb2df312f449d9be67a0646..a523ab64228d7fc61127c34fe4718dec4dd95833 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/ec.h>
 #include <openssl/bn.h>
 #include "internal/refcount.h"
-#include "internal/ec_int.h"
+#include "crypto/ec.h"
 
 #if defined(__SUNPRO_C)
 # if __SUNPRO_C >= 0x520
index be4f23062334efbe2f942c1a059b0c4027af995c..1710decdddc9d7cdb8fbf942caff6d930108c96b 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/err.h>
 
 #include "internal/cryptlib.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "ec_lcl.h"
 #include "internal/refcount.h"
 
index ded2858ee45d20b97c91ca13a551142964ed3650..5834b868e24d07bfc5802ba3971043aab8c3ebbd 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/ec.h>
 #include "ec_lcl.h"
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 /* EC pkey context structure */
 
index afa65233be45626f94e3210febf763e6fc8f1623..432002ca311885abd644081d2f9cb901af1611ca 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/err.h>
 #include <openssl/obj_mac.h>
 #include <openssl/rand.h>
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "ec_lcl.h"
 
 int ossl_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
index a09e9c5d99db91cefe4429295491ee278fcb233c..f0f3ae32dd003304c3f5875ed1042eefe1ec7dc0 100644 (file)
@@ -21,7 +21,7 @@
 #include <string.h>
 
 #include "internal/cryptlib.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "ec_lcl.h"
 #include "internal/refcount.h"
 
index aaaca6442692fec0656ca0b0e9fe5344f2755b4f..2eedba3d84a567fbfdace4057f18a1cb1134d634 100644 (file)
@@ -12,8 +12,8 @@
 #include <openssl/x509.h>
 #include <openssl/ec.h>
 #include <openssl/rand.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "ec_lcl.h"
 #include "curve448/curve448_lcl.h"
 
index d45617567cbfdebfebf2f002b9f58a0cf6f716fd..460053184344aecd987a9584dcdc74ed17c2a08d 100644 (file)
@@ -13,7 +13,7 @@
 
 # include <openssl/trace.h>
 # include "internal/cryptlib.h"
-# include "internal/engine.h"
+# include "crypto/engine.h"
 # include "internal/thread_once.h"
 # include "internal/refcount.h"
 
index debbb16a79203ae91d282ce160b585b47d8a422a..53edb41a3ea1832788b5e596b1b0848844c55f5d 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
-#include "internal/engine.h"
+#include "crypto/engine.h"
 #include <openssl/pem.h>
 #include <openssl/evp.h>
 #include <openssl/rand.h>
index 7dd3b9fdf6fa1b6d7e9eb9788fd8ccad9a87d68e..b6d1988d13b1e732ceb009af88df64ab922a0545 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "internal/engine.h"
+#include "crypto/engine.h"
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include <openssl/err.h>
index 2f167c84a80effae6833c34757541bf6271fc0fb..2e01deb90163e764926a4881394499ac40467456 100644 (file)
@@ -10,7 +10,7 @@
 #include "e_os.h"
 #include "eng_int.h"
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 /*
  * If this symbol is defined then ENGINE_get_pkey_asn1_meth_engine(), the
index 6ad995d679ac23db92f62cab967719a6105d5f21..8db5385b7c1bf2f98f4d25f65007a5493a469d4c 100644 (file)
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/err.h"
-#include "internal/err_int.h"
+#include "crypto/err.h"
 #include <openssl/err.h>
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
 #include <openssl/bio.h>
 #include <openssl/opensslconf.h>
 #include "internal/thread_once.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/constant_time_locl.h"
 #include "e_os.h"
 #include "err_locl.h"
index 972421f4025709685016bdac91ae22ad93399461..5957730d183e6eb6e3e88e45aa44e7495c37d668 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/err_int.h"
+#include "crypto/err.h"
 #include <openssl/asn1err.h>
 #include <openssl/bnerr.h>
 #include <openssl/ecerr.h>
index 925ed65b964d26c7befa9dfa719ed7f0afa8316f..3c09eab3e216966e6ac1f3310044165a856b6625 100644 (file)
@@ -35,7 +35,7 @@ L CMP           include/openssl/cmp.h           crypto/cmp/cmp_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           crypto/include/internal/sm2.h   crypto/sm2/sm2_err.c
+L SM2           include/crypto/sm2.h            crypto/sm2/sm2_err.c
 L OSSL_STORE    include/openssl/store.h         crypto/store/store_err.c
 L ESS           include/openssl/ess.h           crypto/ess/ess_err.c
 L PROP          include/internal/property.h     crypto/property/property_err.c
index 0ea08e865396607c6618319f8e9f882c9a4454cf..19589d97f3c047f31ddc213533de60c9b88b1ce6 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/ess.h>
 #include <openssl/x509v3.h>
-#include "internal/ess_int.h"
+#include "crypto/ess.h"
 
 /* ASN1 stuff for ESS Structure */
 
index fa9cff18be6c6241b6cdf10c64335c575a670f8c..17c0ea56c6a04e0276084327f9b5adf0fa3a446b 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/x509v3.h>
 #include <openssl/err.h>
 #include <openssl/ess.h>
-#include "internal/ess_int.h"
+#include "crypto/ess.h"
 
 static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed);
 static ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new_init(const EVP_MD *hash_alg,
index 9dd3ac421b02968a387e1c09abe0e7ec4e06bab6..e1b6c8cc3e6be9df6c92fbf543ac5c26367bc7ef 100644 (file)
@@ -12,7 +12,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 #include "internal/bio.h"
 
index 7f99f325482ce5031df741b78a58f3ffd5fb7f9d..f94882829b0fa6fa791879f7f8462e94b15bad62 100644 (file)
@@ -76,7 +76,7 @@
 #include "internal/bio.h"
 #include <openssl/evp.h>
 #include <openssl/rand.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 static int ok_write(BIO *h, const char *buf, int num);
 static int ok_read(BIO *h, char *buf, int size);
index a97eaa168514e41974b96917f637ac9f81e5f969..df8e5a5bcbbe13c980ca8293f34d5b1bf0f724df 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include <openssl/pkcs12.h>
 #include <openssl/objects.h>
 
index a0b2500d11434c3a92ecb7b0c8179b2f33f0502a..f7d62bd2ecff8bd5538292ddadcf0ecafcc86e48 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include <openssl/pkcs12.h>
 #include <openssl/objects.h>
 
index ba61c525643f1c6cc87d11419dfe7f97160b1f9a..7c7550e9ce618be568832480dc373d7dd00273e2 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 9c6aa42887d778fae747a448a1366f2ad251eb32..ca5f7a935e9a225bc6556cabfedcb2c6573dff79 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 39ed5280602cc683716295bc97503f199202b454..17e445d8f2dfe6edc3fbe106eb5928268eddd6ac 100644 (file)
 #include <openssl/aes.h>
 #include <openssl/rand.h>
 #include <openssl/cmac.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/cryptlib.h"
-#include "internal/modes_int.h"
-#include "internal/siv_int.h"
-#include "internal/ciphermode_platform.h"
+#include "crypto/modes.h"
+#include "crypto/siv.h"
+#include "crypto/ciphermode_platform.h"
 #include "evp_locl.h"
 
 typedef struct {
index 9e393f0b88a774b1aa300467c900a18925e9ee84..eddb9686e26356fca48e6ca970bd59aa93416f01 100644 (file)
@@ -16,8 +16,8 @@
 #include <openssl/sha.h>
 #include <openssl/rand.h>
 #include "internal/cryptlib.h"
-#include "internal/modes_int.h"
-#include "internal/evp_int.h"
+#include "crypto/modes.h"
+#include "crypto/evp.h"
 #include "internal/constant_time_locl.h"
 
 typedef struct {
index e434ec009f4015c088dcb833ee2fac83a28f4017..7659d8f8d365012a82dde3bbfbf826fcd99d3097 100644 (file)
@@ -16,9 +16,9 @@
 #include <openssl/sha.h>
 #include <openssl/rand.h>
 #include "internal/cryptlib.h"
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 #include "internal/constant_time_locl.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 typedef struct {
     AES_KEY ks;
index 84b14826cbaac43ba600229ac6bc75d0b3fbd779..9412d51b04f0cf12e5a6980064636d94eabb6ba1 100644 (file)
@@ -14,9 +14,9 @@
 # include <openssl/modes.h>
 # include <openssl/rand.h>
 # include <openssl/rand_drbg.h>
-# include "internal/aria.h"
-# include "internal/evp_int.h"
-# include "internal/modes_int.h"
+# include "crypto/aria.h"
+# include "crypto/evp.h"
+# include "crypto/modes.h"
 # include "evp_locl.h"
 
 /* ARIA subkey Structure */
index 71cc990b25a03aa6c710f71abd2a807cada73727..0ac49fe1fe1341d5c002acbaac02e8d0c2c2b46d 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #ifndef OPENSSL_NO_BF
 # include <openssl/evp.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/objects.h>
 # include <openssl/blowfish.h>
 
index 5e66101422f5d44945af5907fc100b3ca167e0df..50febca9bcf61b447a47888a22a66e107c133173 100644 (file)
@@ -17,9 +17,9 @@ NON_EMPTY_TRANSLATION_UNIT
 # include <string.h>
 # include <assert.h>
 # include <openssl/camellia.h>
-# include "internal/evp_int.h"
-# include "internal/modes_int.h"
-# include "internal/ciphermode_platform.h"
+# include "crypto/evp.h"
+# include "crypto/modes.h"
+# include "crypto/ciphermode_platform.h"
 
 static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
                              const unsigned char *iv, int enc);
index 8906bd470327180fb2a8b2fc25cdbbe7a127c0c6..4b06717b72e73225c03c613dd02346d8d1a1395b 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OPENSSL_NO_CAST
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/cast.h>
 
 static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
index 570378b1af56c36f4203bf6c268b3b99a7c51ddf..17cce58ff176450d06bf712d3055b46cbeb85090 100644 (file)
@@ -14,9 +14,9 @@
 
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include "evp_locl.h"
-# include "internal/chacha.h"
+# include "crypto/chacha.h"
 
 typedef struct {
     union {
@@ -146,7 +146,7 @@ const EVP_CIPHER *EVP_chacha20(void)
 }
 
 # ifndef OPENSSL_NO_POLY1305
-#  include "internal/poly1305.h"
+#  include "crypto/poly1305.h"
 
 typedef struct {
     EVP_CHACHA_KEY key;
index 0d8e90cfa7c4762ed58d55127b0be22cf214f65e..e5791f34475c4eb29c92d3c18836c1c41ce9f13d 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef OPENSSL_NO_DES
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/des.h>
 # include <openssl/rand.h>
 
index 52fde95fb0c6ca91bc477be4bade82c871985876..1ceb3fc73c3b555654b4817acc78fc859dc9a2b9 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef OPENSSL_NO_DES
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/des.h>
 # include <openssl/rand.h>
 # include "evp_locl.h"
index 0f7f4dd525966815109d0d4141fe54380a02c54d..8c3a55410898c735b5c8aad120a8ba7631819c9d 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OPENSSL_NO_IDEA
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/idea.h>
 
 /* Can't use IMPLEMENT_BLOCK_CIPHER because IDEA_ecb_encrypt is different */
index 2f3fcc88f2a4c147252b69ec50709c0c66d8f143..2c8d27e3be32fd79b7d91abc3eb8f3fa6e38ca8d 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/objects.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
                          const unsigned char *iv, int enc);
index 375714a6f47cf87ff27c3a3cce4e2d3929407c1c..d2201b000a0e9cd8d1b1bd7a49edf84a4b95bcfd 100644 (file)
@@ -14,7 +14,7 @@
 
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/rc2.h>
 
 static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
index a1664b594e5b0af6e97cc0682eb59f8040afe873..092d6cf1dba38a98763393c5e316a70e0b4c5930 100644 (file)
@@ -16,7 +16,7 @@
 # include <openssl/objects.h>
 # include <openssl/rc4.h>
 
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 typedef struct {
     RC4_KEY ks;                 /* working key */
index 4d61faff61e807ef0da423bb0d06d157cf2e3197..fc519d90429bc3c328d0d88ffc6b9b57ea210cf2 100644 (file)
@@ -19,7 +19,7 @@
 # include <openssl/objects.h>
 # include <openssl/rc4.h>
 # include <openssl/md5.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 typedef struct {
     RC4_KEY ks;
index 95a626bd4f4e14ac9b0d0b3421f2012d20b85ba7..d92d10f16c24c250ede495a777b734e6db8bc114 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OPENSSL_NO_RC5
 
 # include <openssl/evp.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/objects.h>
 # include "evp_locl.h"
 # include <openssl/rc5.h>
index 0861ee8b2e7af6c1577c930974c9d7d9a9b7be72..9a9938deaf4edd8d132b3ac928db54761d99a555 100644 (file)
@@ -16,7 +16,7 @@ NON_EMPTY_TRANSLATION_UNIT
 # include <string.h>
 # include <assert.h>
 # include <openssl/seed.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
                          const unsigned char *iv, int enc);
index 02292fa605b553a13e18f180eeefd10361c765be..4653c10a14bf4e687a22d9c7e6310058c8d56774 100644 (file)
@@ -13,8 +13,8 @@
 #ifndef OPENSSL_NO_SM4
 # include <openssl/evp.h>
 # include <openssl/modes.h>
-# include "internal/sm4.h"
-# include "internal/evp_int.h"
+# include "crypto/sm4.h"
+# include "crypto/evp.h"
 
 typedef struct {
     SM4_KEY ks;
index 285001c3736ec8c8f2c82e84b591a6a91c6b46b8..d402606b6d7f0ec5aa36ae0444e0f0f4db0309cc 100644 (file)
@@ -14,7 +14,7 @@
 
 # include <openssl/evp.h>
 # include <openssl/objects.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/des.h>
 
 static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
index ab80267c1eb08803b5a1873cbdae80bdda9c2935..b8c82cfafd0d2c52ea27140052ea566e825ca6e7 100644 (file)
@@ -11,7 +11,7 @@
 #include <limits.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 static unsigned char conv_ascii2bin(unsigned char a,
index 2685436d36bfbb28a8f269e615f7f9bf5d5b0682..35bf42994d5aa9a82277e5ef23648d2cf300dbbd 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/engine.h>
 #include <openssl/params.h>
 #include <openssl/core_names.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index cd2bacea5dc9dba1d780fd88d2abd5f5c7222769..67ba201da3e2e48039e8ea58e1a7038cb335a59d 100644 (file)
@@ -17,7 +17,7 @@
 #include "internal/core.h"
 #include "internal/provider.h"
 #include "internal/namemap.h"
-#include "internal/evp_int.h"    /* evp_locl.h needs it */
+#include "crypto/evp.h"    /* evp_locl.h needs it */
 #include "evp_locl.h"
 
 static void default_method_store_free(void *vstore)
index 4ec880fd1382ea5488712e605a4e0e4bca1de9f1..0789aa8970447d59bacfce81ef7b6472059bc04e 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 #include <openssl/dh.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 8162a5e436639d96015a58e1f369cff1b863cbf6..2d87905bf5605b7df01627a0c2d89cf262d87498 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/pkcs12.h>
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 /* Password based encryption (PBE) functions */
index bffe2b3830fa679b091f623c69efa1a46ddd21b5..a11b856c03f542cd95a1c204ec17ba9da635b4c7 100644 (file)
@@ -12,9 +12,9 @@
 #include "internal/cryptlib.h"
 #include <openssl/x509.h>
 #include <openssl/rand.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
-#include "internal/x509_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
+#include "crypto/x509.h"
 
 /* Extract a private key from a PKCS8 structure */
 
index 3da208a69f1d4614fea4f39d87811b9072ae92a7..b3571bea9fa5a424e3171e9e94ef9f4adbf9b872 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/err.h>
 #include <openssl/asn1.h>        /* evp_locl.h needs it */
 #include <openssl/safestack.h>   /* evp_locl.h needs it */
-#include "internal/evp_int.h"    /* evp_locl.h needs it */
+#include "crypto/evp.h"    /* evp_locl.h needs it */
 #include "evp_locl.h"
 
 /*
index 53a25a424e2fcf1ccc45547a82127a5070d7134e..3caf03a0ced32fa452ed5186822a2103a0803fbf 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include "internal/refcount.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "internal/numbers.h"   /* includes SIZE_MAX */
 #include "evp_locl.h"
index 5c57cc360e908777ca3957d4de515263897c08b1..b2b28dece2618aad8008d7c132b53968387050de 100644 (file)
@@ -17,8 +17,8 @@
 #include <openssl/kdf.h>
 #include <openssl/core.h>
 #include <openssl/core_names.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
index 7bcdcc7df389d4bc852ada0b98b83ada30f5083f..c2b6cea6736c81f0154806d364510ba7d72b2345 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/core.h>
 #include <openssl/core_numbers.h>
 #include <openssl/kdf.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 8ee28fbe60aae21b7d8134a95531ab96aa1df3b7..1a4e9a297c04ec0649d2017141f3988a6056ec25 100644 (file)
@@ -9,8 +9,8 @@
 
 #include "internal/cryptlib.h"
 #include "internal/nelem.h"
-#include "internal/evp_int.h"
-#include "internal/asn1_int.h"
+#include "crypto/evp.h"
+#include "crypto/asn1.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index c170bd676b834cff973c13986630861f0a56fb89..1dbc9df550a68035331886b3d98371794a439bb1 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/err.h>
 #include "internal/provider.h"
 #include "internal/refcount.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 
index d7738472c89c971d6c21fd7ad71bca0c8fda6e80..a8a0af96aabedc9052f49d999582400176b00f2d 100644 (file)
@@ -18,7 +18,7 @@
 # include <openssl/md2.h>
 # include <openssl/rsa.h>
 
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index 1dc3cdee64503015727f17294a2a4e950f25631f..9638213de754fb5d2784ac6ec4241c3d2f536f1b 100644 (file)
@@ -17,7 +17,7 @@
 # include <openssl/x509.h>
 # include <openssl/md4.h>
 # include <openssl/rsa.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index 539ab76448c298ede90baf34e319e1b26359090b..d817982488b368a17cd3b0793d3130d671c6045f 100644 (file)
@@ -17,7 +17,7 @@
 # include <openssl/x509.h>
 # include <openssl/md5.h>
 # include <openssl/rsa.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index af8ae31ec15515f415137404be6dbe0cce2f31df..e9ed800145bec2abfa3fb2b09b07f64938b20134 100644 (file)
@@ -12,7 +12,7 @@
 # include <string.h>
 # include <openssl/evp.h>
 # include <openssl/obj_mac.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include "internal/md5_sha1.h"
 
 static int init(EVP_MD_CTX *ctx)
index 145d9550f2de2a73f39688dd3959b34cbbc7b1b1..fdc689e1155aa2bd61e6f5a54dfb80d723e06e67 100644 (file)
@@ -17,7 +17,7 @@
 # include <openssl/x509.h>
 # include <openssl/mdc2.h>
 # include <openssl/rsa.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index 5dcb250fe884f06696391a013dae7c0e5009576e..51c93c0dc40d8f08657d5b77b604a37d7cefdefb 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index d821a58493a8d711a5bcbb9a6d06b75d0b970d74..4e05d18ba63cee01086b812b93df6f2c0854abca 100644 (file)
@@ -17,7 +17,7 @@
 # include <openssl/objects.h>
 # include <openssl/x509.h>
 # include <openssl/rsa.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index 1258ea03bcaf532453bd79b8e86706297f8e5e03..421d302582c5cbfe4fc359d35808bf07c9189173 100644 (file)
@@ -14,8 +14,8 @@
 #include <openssl/objects.h>
 #include <openssl/sha.h>
 #include <openssl/rsa.h>
-#include "internal/evp_int.h"
-#include "internal/sha.h"
+#include "crypto/evp.h"
+#include "crypto/sha.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index 1e71eed9487b63e51ad6a5333c9f1cec77949389..727bb2731ae27522b59280b0a4140628388501ee 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <openssl/evp.h>
 #include <openssl/objects.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/sha3.h"
 #include "evp_locl.h"
 
index 987b35b7fe912fb8aa5783e134770286c5623d8b..53074334bf608c392a2abeb5f5aca026f45ebec5 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 static int update(EVP_MD_CTX *ctx, const void *data, size_t datalen)
index 10c07ff55111d22ee6dd4c157cfbd22374decac4..ee69df56582f26a667fc1cacfc7ca6696d178174 100644 (file)
@@ -16,7 +16,7 @@
 # include <openssl/objects.h>
 # include <openssl/x509.h>
 # include <openssl/whrlpool.h>
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index cf704ba4fcc5b453543109ee48400fd26e2f10dc..c38c453c733eacfd8956d6ffc47e7f6421a73e74 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/core_names.h>
 #include <openssl/ossl_typ.h>
 #include "internal/nelem.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 8c47a6c6e8a97765f193daccb4d8aeb639e41e35..9e67d9085b771f6497610fc52ab12c5283c85f38 100644 (file)
@@ -2,7 +2,7 @@
 #include <openssl/err.h>
 #include <openssl/core.h>
 #include <openssl/core_numbers.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index 7c2f4f061c61f7ce6c06ca7b27ebff2ec18e5040..901899ad3b4dfbee41d04f349e535a39bf4f5001 100644 (file)
@@ -11,9 +11,9 @@
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/kdf.h>
-#include "internal/objects.h"
+#include "crypto/objects.h"
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 int EVP_add_cipher(const EVP_CIPHER *c)
 {
index 96a72730f31de23792dca3110b33bc275ceddc4a..27fb9594284a6ae77b7df29d2c2799fa4d0b5659 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/hmac.h>
 #include <openssl/trace.h>
 #include <openssl/core_names.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
index 83cf12fff38f9e9f50d4ab5ebe76baef6a6399d1..e2c6eaa17fbba453b6f050895dbc8cbdeeed7673 100644 (file)
@@ -23,8 +23,8 @@
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 
 static void EVP_PKEY_free_it(EVP_PKEY *x);
index c1b0d3acda0e3f843ad7e30988bca0d345fb34f3..44a69083b21920b4aab73990a0f5c09a43bcddc6 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
                   unsigned int *siglen, EVP_PKEY *pkey)
index 956b089572db3595ef61b212ccd58b23ee517520..fe4b7b568d36c292cc808bc6be04600372a28652 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
                     unsigned int siglen, EVP_PKEY *pkey)
index 98bf5c6660101d622774a48ba39c8eb61bf19288..d57ff6fd472bc46575c1ad92a9ef4a54114ab295 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/core_names.h>
 #include <openssl/params.h>
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 #define MAX_PARAM   20
 
index 9853e09cf1c388bac1824b4ee8ec186f89ccd83c..2c60afe55fc26c3feab3334ba725bb4a2dcb3770 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/engine.h>
 #include <openssl/params.h>
 #include <openssl/core_names.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "evp_locl.h"
 
 /* MAC PKEY context structure */
index 34db48639aed482e8d8c958d975ef78f0dad0dd6..240738d3ee481dbf80eceedba1c970718572d7c6 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include "internal/cryptlib.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
 
index c81f5a1a3f9e060e94456597d6eed6db839abfc8..2564bbd03e56ada2fdddf0403ae715d1a98f6b33 100644 (file)
@@ -12,9 +12,9 @@
 #include "internal/cryptlib.h"
 #include <openssl/objects.h>
 #include <openssl/evp.h>
-#include "internal/bn_int.h"
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/bn.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx)
 {
index 8b386cf19fe1c218219d4f3898079fb7617c6666..5f0a93ed9a4700f1eab3593a9ed59515d939342a 100644 (file)
@@ -16,8 +16,8 @@
 #include <openssl/core_names.h>
 #include <openssl/dh.h>
 #include "internal/cryptlib.h"
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "internal/provider.h"
 #include "evp_locl.h"
index cd8e695855f5bc7d41a67963a52449398de6f1ce..9f08606d2ff9de4641e1c612cc170cecb7f9a7d2 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/thread_once.h"
 
 int do_ex_data_init(OPENSSL_CTX *ctx)
index f0a5bc9a01d2a2d9b142b21ddd6e082f6ff364de..9ecb78610606a49dac50ffa41881425920f5727f 100644 (file)
@@ -10,8 +10,8 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 /*
  * HMAC "ASN1" method. This is just here to indicate the maximum HMAC output
diff --git a/crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H b/crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H
deleted file mode 100644 (file)
index e57c0ea..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*
- * This file is only used by HP C on VMS, and is included automatically
- * after each header file from this directory
- */
-
-/* restore state.  Must correspond to the save in __decc_include_prologue.h */
-#pragma names restore
diff --git a/crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H b/crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H
deleted file mode 100644 (file)
index a013957..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*
- * This file is only used by HP C on VMS, and is included automatically
- * after each header file from this directory
- */
-
-/* save state */
-#pragma names save
-/* have the compiler shorten symbols larger than 31 chars to 23 chars
- * followed by a 8 hex char CRC
- */
-#pragma names as_is,shortened
diff --git a/crypto/include/internal/aria.h b/crypto/include/internal/aria.h
deleted file mode 100644 (file)
index 4bfbd5a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright (c) 2017, Oracle and/or its affiliates.  All rights reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
- /* Copyright (c) 2017 National Security Research Institute.  All rights reserved. */
-
-#ifndef HEADER_ARIA_H
-# define HEADER_ARIA_H
-
-# include <openssl/opensslconf.h>
-
-# ifdef OPENSSL_NO_ARIA
-#  error ARIA is disabled.
-# endif
-
-# define ARIA_ENCRYPT     1
-# define ARIA_DECRYPT     0
-
-# define ARIA_BLOCK_SIZE    16  /* Size of each encryption/decryption block */
-# define ARIA_MAX_KEYS      17  /* Number of keys needed in the worst case  */
-
-typedef union {
-    unsigned char c[ARIA_BLOCK_SIZE];
-    unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)];
-} ARIA_u128;
-
-typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE];
-
-struct aria_key_st {
-    ARIA_u128 rd_key[ARIA_MAX_KEYS];
-    unsigned int rounds;
-};
-typedef struct aria_key_st ARIA_KEY;
-
-
-int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
-                         ARIA_KEY *key);
-int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
-                         ARIA_KEY *key);
-
-void aria_encrypt(const unsigned char *in, unsigned char *out,
-                  const ARIA_KEY *key);
-
-#endif
diff --git a/crypto/include/internal/asn1_dsa.h b/crypto/include/internal/asn1_dsa.h
deleted file mode 100644 (file)
index d257051..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_ASN1_DSA_H
-# define HEADER_ASN1_DSA_H
-
-#include "internal/packet.h"
-
-int encode_der_length(WPACKET *pkt, size_t cont_len);
-int encode_der_integer(WPACKET *pkt, const BIGNUM *n);
-int encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s);
-int decode_der_length(PACKET *pkt, PACKET *subpkt);
-int decode_der_integer(PACKET *pkt, BIGNUM *n);
-size_t decode_der_dsa_sig(BIGNUM *r, BIGNUM *s, const unsigned char **ppin,
-                          size_t len);
-
-#endif
diff --git a/crypto/include/internal/asn1_int.h b/crypto/include/internal/asn1_int.h
deleted file mode 100644 (file)
index 674fa70..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* Internal ASN1 structures and functions: not for application use */
-
-/* ASN1 public key method structure */
-
-struct evp_pkey_asn1_method_st {
-    int pkey_id;
-    int pkey_base_id;
-    unsigned long pkey_flags;
-    char *pem_str;
-    char *info;
-    int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub);
-    int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);
-    int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
-    int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,
-                      ASN1_PCTX *pctx);
-    int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
-    int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
-    int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent,
-                       ASN1_PCTX *pctx);
-    int (*pkey_size) (const EVP_PKEY *pk);
-    int (*pkey_bits) (const EVP_PKEY *pk);
-    int (*pkey_security_bits) (const EVP_PKEY *pk);
-    int (*param_decode) (EVP_PKEY *pkey,
-                         const unsigned char **pder, int derlen);
-    int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder);
-    int (*param_missing) (const EVP_PKEY *pk);
-    int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from);
-    int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
-    int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent,
-                        ASN1_PCTX *pctx);
-    int (*sig_print) (BIO *out,
-                      const X509_ALGOR *sigalg, const ASN1_STRING *sig,
-                      int indent, ASN1_PCTX *pctx);
-    void (*pkey_free) (EVP_PKEY *pkey);
-    int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);
-    /* Legacy functions for old PEM */
-    int (*old_priv_decode) (EVP_PKEY *pkey,
-                            const unsigned char **pder, int derlen);
-    int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);
-    /* Custom ASN1 signature verification */
-    int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
-                        X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
-    int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
-                      X509_ALGOR *alg1, X509_ALGOR *alg2,
-                      ASN1_BIT_STRING *sig);
-    int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg,
-                       const ASN1_STRING *sig);
-    /* Check */
-    int (*pkey_check) (const EVP_PKEY *pk);
-    int (*pkey_public_check) (const EVP_PKEY *pk);
-    int (*pkey_param_check) (const EVP_PKEY *pk);
-    /* Get/set raw private/public key data */
-    int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len);
-    int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len);
-    int (*get_priv_key) (const EVP_PKEY *pk, unsigned char *priv, size_t *len);
-    int (*get_pub_key) (const EVP_PKEY *pk, unsigned char *pub, size_t *len);
-
-    /*
-     * TODO: Make sure these functions are defined for key types that are
-     * implemented in providers.
-     */
-    /* Exports to providers */
-    size_t (*dirty_cnt) (const EVP_PKEY *pk);
-    void *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
-} /* EVP_PKEY_ASN1_METHOD */ ;
-
-DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)
-
-extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5];
-extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ed448_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD sm2_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD poly1305_asn1_meth;
-
-extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[2];
-extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD siphash_asn1_meth;
-
-/*
- * These are used internally in the ASN1_OBJECT to keep track of whether the
- * names and data need to be free()ed
- */
-# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
-# define ASN1_OBJECT_FLAG_CRITICAL        0x02/* critical x509v3 object id */
-# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
-# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
-struct asn1_object_st {
-    const char *sn, *ln;
-    int nid;
-    int length;
-    const unsigned char *data;  /* data remains const after init */
-    int flags;                  /* Should we free this one */
-};
-
-/* ASN1 print context structure */
-
-struct asn1_pctx_st {
-    unsigned long flags;
-    unsigned long nm_flags;
-    unsigned long cert_flags;
-    unsigned long oid_flags;
-    unsigned long str_flags;
-} /* ASN1_PCTX */ ;
-
-int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
diff --git a/crypto/include/internal/async.h b/crypto/include/internal/async.h
deleted file mode 100644 (file)
index e9a89da..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/async.h>
-
-int async_init(void);
-void async_deinit(void);
-
diff --git a/crypto/include/internal/bn_conf.h.in b/crypto/include/internal/bn_conf.h.in
deleted file mode 100644 (file)
index 9061d20..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-{- join("\n",map { "/* $_ */" } @autowarntext) -}
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_BN_CONF_H
-# define HEADER_BN_CONF_H
-
-/*
- * The contents of this file are not used in the UEFI build, as
- * both 32-bit and 64-bit builds are supported from a single run
- * of the Configure script.
- */
-
-/* Should we define BN_DIV2W here? */
-
-/* Only one for the following should be defined */
-{- $config{b64l} ? "#define" : "#undef" -} SIXTY_FOUR_BIT_LONG
-{- $config{b64}  ? "#define" : "#undef" -} SIXTY_FOUR_BIT
-{- $config{b32}  ? "#define" : "#undef" -} THIRTY_TWO_BIT
-
-#endif
diff --git a/crypto/include/internal/bn_dh.h b/crypto/include/internal/bn_dh.h
deleted file mode 100644 (file)
index 9077234..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#define declare_dh_bn(x) \
-    extern const BIGNUM _bignum_dh##x##_p;              \
-    extern const BIGNUM _bignum_dh##x##_g;              \
-    extern const BIGNUM _bignum_dh##x##_q;
-
-declare_dh_bn(1024_160)
-declare_dh_bn(2048_224)
-declare_dh_bn(2048_256)
-
-extern const BIGNUM _bignum_ffdhe2048_p;
-extern const BIGNUM _bignum_ffdhe3072_p;
-extern const BIGNUM _bignum_ffdhe4096_p;
-extern const BIGNUM _bignum_ffdhe6144_p;
-extern const BIGNUM _bignum_ffdhe8192_p;
-extern const BIGNUM _bignum_const_2;
diff --git a/crypto/include/internal/bn_int.h b/crypto/include/internal/bn_int.h
deleted file mode 100644 (file)
index cb8b176..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_BN_INT_H
-# define HEADER_BN_INT_H
-
-# include <openssl/bn.h>
-# include <limits.h>
-
-BIGNUM *bn_wexpand(BIGNUM *a, int words);
-BIGNUM *bn_expand2(BIGNUM *a, int words);
-
-void bn_correct_top(BIGNUM *a);
-
-/*
- * Determine the modified width-(w+1) Non-Adjacent Form (wNAF) of 'scalar'.
- * This is an array r[] of values that are either zero or odd with an
- * absolute value less than 2^w satisfying scalar = \sum_j r[j]*2^j where at
- * most one of any w+1 consecutive digits is non-zero with the exception that
- * the most significant digit may be only w-1 zeros away from that next
- * non-zero digit.
- */
-signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len);
-
-int bn_get_top(const BIGNUM *a);
-
-int bn_get_dmax(const BIGNUM *a);
-
-/* Set all words to zero */
-void bn_set_all_zero(BIGNUM *a);
-
-/*
- * Copy the internal BIGNUM words into out which holds size elements (and size
- * must be bigger than top)
- */
-int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size);
-
-BN_ULONG *bn_get_words(const BIGNUM *a);
-
-/*
- * Set the internal data words in a to point to words which contains size
- * elements. The BN_FLG_STATIC_DATA flag is set
- */
-void bn_set_static_words(BIGNUM *a, const BN_ULONG *words, int size);
-
-/*
- * Copy words into the BIGNUM |a|, reallocating space as necessary.
- * The negative flag of |a| is not modified.
- * Returns 1 on success and 0 on failure.
- */
-/*
- * |num_words| is int because bn_expand2 takes an int. This is an internal
- * function so we simply trust callers not to pass negative values.
- */
-int bn_set_words(BIGNUM *a, const BN_ULONG *words, int num_words);
-
-/*
- * Some BIGNUM functions assume most significant limb to be non-zero, which
- * is customarily arranged by bn_correct_top. Output from below functions
- * is not processed with bn_correct_top, and for this reason it may not be
- * returned out of public API. It may only be passed internally into other
- * functions known to support non-minimal or zero-padded BIGNUMs. Even
- * though the goal is to facilitate constant-time-ness, not each subroutine
- * is constant-time by itself. They all have pre-conditions, consult source
- * code...
- */
-int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-                          BN_MONT_CTX *mont, BN_CTX *ctx);
-int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
-                         BN_CTX *ctx);
-int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
-                           BN_CTX *ctx);
-int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-                         const BIGNUM *m);
-int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-                         const BIGNUM *m);
-int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
-int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
-int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
-int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
-int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
-                     const BIGNUM *d, BN_CTX *ctx);
-
-#define BN_PRIMETEST_COMPOSITE                    0
-#define BN_PRIMETEST_COMPOSITE_WITH_FACTOR        1
-#define BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME 2
-#define BN_PRIMETEST_PROBABLY_PRIME               3
-
-int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
-                             BN_GENCB *cb, int enhanced, int *status);
-
-const BIGNUM *bn_get0_small_factors(void);
-
-int bn_rsa_fips186_4_prime_MR_min_checks(int nbits);
-
-int bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout,
-                                     BIGNUM *p1, BIGNUM *p2,
-                                     const BIGNUM *Xp, const BIGNUM *Xp1,
-                                     const BIGNUM *Xp2, int nlen,
-                                     const BIGNUM *e, BN_CTX *ctx,
-                                     BN_GENCB *cb);
-
-int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin,
-                                  const BIGNUM *r1, const BIGNUM *r2, int nlen,
-                                  const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
-
-OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx);
-#endif
diff --git a/crypto/include/internal/bn_srp.h b/crypto/include/internal/bn_srp.h
deleted file mode 100644 (file)
index 897618c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef OPENSSL_NO_SRP
-
-extern const BIGNUM bn_group_1024;
-
-extern const BIGNUM bn_group_1536;
-
-extern const BIGNUM bn_group_2048;
-
-extern const BIGNUM bn_group_3072;
-
-extern const BIGNUM bn_group_4096;
-
-extern const BIGNUM bn_group_6144;
-
-extern const BIGNUM bn_group_8192;
-
-extern const BIGNUM bn_generator_19;
-
-extern const BIGNUM bn_generator_5;
-
-extern const BIGNUM bn_generator_2;
-
-#endif
diff --git a/crypto/include/internal/chacha.h b/crypto/include/internal/chacha.h
deleted file mode 100644 (file)
index e095522..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_CHACHA_H
-#define HEADER_CHACHA_H
-
-#include <stddef.h>
-
-/*
- * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and
- * nonce and writes the result to |out|, which may be equal to |inp|.
- * The |key| is not 32 bytes of verbatim key material though, but the
- * said material collected into 8 32-bit elements array in host byte
- * order. Same approach applies to nonce: the |counter| argument is
- * pointer to concatenated nonce and counter values collected into 4
- * 32-bit elements. This, passing crypto material collected into 32-bit
- * elements as opposite to passing verbatim byte vectors, is chosen for
- * efficiency in multi-call scenarios.
- */
-void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
-                    size_t len, const unsigned int key[8],
-                    const unsigned int counter[4]);
-/*
- * You can notice that there is no key setup procedure. Because it's
- * as trivial as collecting bytes into 32-bit elements, it's reckoned
- * that below macro is sufficient.
- */
-#define CHACHA_U8TOU32(p)  ( \
-                ((unsigned int)(p)[0])     | ((unsigned int)(p)[1]<<8) | \
-                ((unsigned int)(p)[2]<<16) | ((unsigned int)(p)[3]<<24)  )
-
-#define CHACHA_KEY_SIZE         32
-#define CHACHA_CTR_SIZE         16
-#define CHACHA_BLK_SIZE         64
-
-#endif
diff --git a/crypto/include/internal/ciphermode_platform.h b/crypto/include/internal/ciphermode_platform.h
deleted file mode 100644 (file)
index b16062f..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_INTERNAL_CIPHERMODE_PLATFORM_H
-# define HEADER_INTERNAL_CIPHERMODE_PLATFORM_H
-
-# include "openssl/aes.h"
-
-# ifdef VPAES_ASM
-int vpaes_set_encrypt_key(const unsigned char *userKey, int bits,
-                          AES_KEY *key);
-int vpaes_set_decrypt_key(const unsigned char *userKey, int bits,
-                          AES_KEY *key);
-void vpaes_encrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-void vpaes_decrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-void vpaes_cbc_encrypt(const unsigned char *in,
-                       unsigned char *out,
-                       size_t length,
-                       const AES_KEY *key, unsigned char *ivec, int enc);
-# endif /* VPAES_ASM */
-
-# ifdef BSAES_ASM
-void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                       size_t length, const AES_KEY *key,
-                       unsigned char ivec[16], int enc);
-void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
-                                size_t len, const AES_KEY *key,
-                                const unsigned char ivec[16]);
-void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
-                       size_t len, const AES_KEY *key1,
-                       const AES_KEY *key2, const unsigned char iv[16]);
-void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
-                       size_t len, const AES_KEY *key1,
-                       const AES_KEY *key2, const unsigned char iv[16]);
-# endif /* BSAES_ASM */
-
-# ifdef AES_CTR_ASM
-void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                       size_t blocks, const AES_KEY *key,
-                       const unsigned char ivec[AES_BLOCK_SIZE]);
-# endif /*  AES_CTR_ASM */
-
-# ifdef AES_XTS_ASM
-void AES_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len,
-                     const AES_KEY *key1, const AES_KEY *key2,
-                     const unsigned char iv[16]);
-void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
-                     const AES_KEY *key1, const AES_KEY *key2,
-                     const unsigned char iv[16]);
-# endif /* AES_XTS_ASM */
-
-# if defined(OPENSSL_CPUID_OBJ)
-#  if (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
-#   include "ppc_arch.h"
-#   ifdef VPAES_ASM
-#    define VPAES_CAPABLE (OPENSSL_ppccap_P & PPC_ALTIVEC)
-#   endif
-#   define HWAES_CAPABLE  (OPENSSL_ppccap_P & PPC_CRYPTO207)
-#   define HWAES_set_encrypt_key aes_p8_set_encrypt_key
-#   define HWAES_set_decrypt_key aes_p8_set_decrypt_key
-#   define HWAES_encrypt aes_p8_encrypt
-#   define HWAES_decrypt aes_p8_decrypt
-#   define HWAES_cbc_encrypt aes_p8_cbc_encrypt
-#   define HWAES_ctr32_encrypt_blocks aes_p8_ctr32_encrypt_blocks
-#   define HWAES_xts_encrypt aes_p8_xts_encrypt
-#   define HWAES_xts_decrypt aes_p8_xts_decrypt
-#  endif /* PPC */
-
-#  if (defined(__arm__) || defined(__arm) || defined(__aarch64__))
-#   include "arm_arch.h"
-#   if __ARM_MAX_ARCH__>=7
-#    if defined(BSAES_ASM)
-#     define BSAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
-#    endif
-#    if defined(VPAES_ASM)
-#     define VPAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
-#    endif
-#    define HWAES_CAPABLE (OPENSSL_armcap_P & ARMV8_AES)
-#    define HWAES_set_encrypt_key aes_v8_set_encrypt_key
-#    define HWAES_set_decrypt_key aes_v8_set_decrypt_key
-#    define HWAES_encrypt aes_v8_encrypt
-#    define HWAES_decrypt aes_v8_decrypt
-#    define HWAES_cbc_encrypt aes_v8_cbc_encrypt
-#    define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks
-#   endif
-#  endif
-# endif /* OPENSSL_CPUID_OBJ */
-
-# if     defined(AES_ASM) && !defined(I386_ONLY) &&      (  \
-         ((defined(__i386)       || defined(__i386__)    || \
-           defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
-         defined(__x86_64)       || defined(__x86_64__)  || \
-         defined(_M_AMD64)       || defined(_M_X64)      )
-
-/* AES-NI section */
-
-#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
-#  ifdef VPAES_ASM
-#   define VPAES_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
-#  endif
-#  ifdef BSAES_ASM
-#   define BSAES_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
-#  endif
-
-int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
-                          AES_KEY *key);
-int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
-                          AES_KEY *key);
-
-void aesni_encrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-void aesni_decrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-
-void aesni_ecb_encrypt(const unsigned char *in,
-                       unsigned char *out,
-                       size_t length, const AES_KEY *key, int enc);
-void aesni_cbc_encrypt(const unsigned char *in,
-                       unsigned char *out,
-                       size_t length,
-                       const AES_KEY *key, unsigned char *ivec, int enc);
-#  ifndef OPENSSL_NO_OCB
-void aesni_ocb_encrypt(const unsigned char *in, unsigned char *out,
-                       size_t blocks, const void *key,
-                       size_t start_block_num,
-                       unsigned char offset_i[16],
-                       const unsigned char L_[][16],
-                       unsigned char checksum[16]);
-void aesni_ocb_decrypt(const unsigned char *in, unsigned char *out,
-                       size_t blocks, const void *key,
-                       size_t start_block_num,
-                       unsigned char offset_i[16],
-                       const unsigned char L_[][16],
-                       unsigned char checksum[16]);
-#  endif /* OPENSSL_NO_OCB */
-
-void aesni_ctr32_encrypt_blocks(const unsigned char *in,
-                                unsigned char *out,
-                                size_t blocks,
-                                const void *key, const unsigned char *ivec);
-
-void aesni_xts_encrypt(const unsigned char *in,
-                       unsigned char *out,
-                       size_t length,
-                       const AES_KEY *key1, const AES_KEY *key2,
-                       const unsigned char iv[16]);
-
-void aesni_xts_decrypt(const unsigned char *in,
-                       unsigned char *out,
-                       size_t length,
-                       const AES_KEY *key1, const AES_KEY *key2,
-                       const unsigned char iv[16]);
-
-void aesni_ccm64_encrypt_blocks(const unsigned char *in,
-                                unsigned char *out,
-                                size_t blocks,
-                                const void *key,
-                                const unsigned char ivec[16],
-                                unsigned char cmac[16]);
-
-void aesni_ccm64_decrypt_blocks(const unsigned char *in,
-                                unsigned char *out,
-                                size_t blocks,
-                                const void *key,
-                                const unsigned char ivec[16],
-                                unsigned char cmac[16]);
-
-#  if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
-size_t aesni_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len,
-                         const void *key, unsigned char ivec[16], u64 *Xi);
-size_t aesni_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len,
-                         const void *key, unsigned char ivec[16], u64 *Xi);
-void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len);
-
-#   define AES_GCM_ASM(ctx)    (ctx->ctr == aesni_ctr32_encrypt_blocks && \
-                                ctx->gcm.ghash == gcm_ghash_avx)
-#  endif
-
-
-# elif defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
-
-/* Fujitsu SPARC64 X support */
-extern unsigned int OPENSSL_sparcv9cap_P[];
-#  include "sparc_arch.h"
-
-#  ifndef OPENSSL_NO_CAMELLIA
-#   define SPARC_CMLL_CAPABLE      (OPENSSL_sparcv9cap_P[1] & CFR_CAMELLIA)
-#   include "openssl/camellia.h"
-
-void cmll_t4_set_key(const unsigned char *key, int bits, CAMELLIA_KEY *ks);
-void cmll_t4_encrypt(const unsigned char *in, unsigned char *out,
-                     const CAMELLIA_KEY *key);
-void cmll_t4_decrypt(const unsigned char *in, unsigned char *out,
-                     const CAMELLIA_KEY *key);
-
-void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                            size_t len, const CAMELLIA_KEY *key,
-                            unsigned char *ivec);
-void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
-                            size_t len, const CAMELLIA_KEY *key,
-                            unsigned char *ivec);
-void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                            size_t len, const CAMELLIA_KEY *key,
-                            unsigned char *ivec);
-void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
-                            size_t len, const CAMELLIA_KEY *key,
-                            unsigned char *ivec);
-void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                              size_t blocks, const CAMELLIA_KEY *key,
-                              unsigned char *ivec);
-void cmll256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                              size_t blocks, const CAMELLIA_KEY *key,
-                              unsigned char *ivec);
-#  endif /* OPENSSL_NO_CAMELLIA */
-
-
-#  define SPARC_AES_CAPABLE       (OPENSSL_sparcv9cap_P[1] & CFR_AES)
-#  define SPARC_DES_CAPABLE       (OPENSSL_sparcv9cap_P[1] & CFR_DES)
-#  define HWAES_CAPABLE           (OPENSSL_sparcv9cap_P[0] & SPARCV9_FJAESX)
-#  define HWAES_set_encrypt_key aes_fx_set_encrypt_key
-#  define HWAES_set_decrypt_key aes_fx_set_decrypt_key
-#  define HWAES_encrypt aes_fx_encrypt
-#  define HWAES_decrypt aes_fx_decrypt
-#  define HWAES_cbc_encrypt aes_fx_cbc_encrypt
-#  define HWAES_ctr32_encrypt_blocks aes_fx_ctr32_encrypt_blocks
-
-void aes_t4_set_encrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
-void aes_t4_set_decrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
-void aes_t4_encrypt(const unsigned char *in, unsigned char *out,
-                    const AES_KEY *key);
-void aes_t4_decrypt(const unsigned char *in, unsigned char *out,
-                    const AES_KEY *key);
-/*
- * Key-length specific subroutines were chosen for following reason.
- * Each SPARC T4 core can execute up to 8 threads which share core's
- * resources. Loading as much key material to registers allows to
- * minimize references to shared memory interface, as well as amount
- * of instructions in inner loops [much needed on T4]. But then having
- * non-key-length specific routines would require conditional branches
- * either in inner loops or on subroutines' entries. Former is hardly
- * acceptable, while latter means code size increase to size occupied
- * by multiple key-length specific subroutines, so why fight?
- */
-void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
-                           size_t len, const AES_KEY *key,
-                           unsigned char *ivec);
-void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                             size_t blocks, const AES_KEY *key,
-                             unsigned char *ivec);
-void aes192_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                             size_t blocks, const AES_KEY *key,
-                             unsigned char *ivec);
-void aes256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
-                             size_t blocks, const AES_KEY *key,
-                             unsigned char *ivec);
-void aes128_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
-                           size_t blocks, const AES_KEY *key1,
-                           const AES_KEY *key2, const unsigned char *ivec);
-void aes128_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
-                           size_t blocks, const AES_KEY *key1,
-                           const AES_KEY *key2, const unsigned char *ivec);
-void aes256_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
-                           size_t blocks, const AES_KEY *key1,
-                           const AES_KEY *key2, const unsigned char *ivec);
-void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
-                           size_t blocks, const AES_KEY *key1,
-                           const AES_KEY *key2, const unsigned char *ivec);
-
-#  ifndef OPENSSL_NO_DES
-#   include <openssl/des.h>
-void des_t4_key_expand(const void *key, DES_key_schedule *ks);
-void des_t4_ede3_cbc_encrypt(const void *inp, void *out, size_t len,
-                             const DES_key_schedule ks[3], unsigned char iv[8]);
-void des_t4_ede3_cbc_decrypt(const void *inp, void *out, size_t len,
-                             const DES_key_schedule ks[3], unsigned char iv[8]);
-void des_t4_cbc_encrypt(const void *inp, void *out, size_t len,
-                        const DES_key_schedule *ks, unsigned char iv[8]);
-void des_t4_cbc_decrypt(const void *inp, void *out, size_t len,
-                        const DES_key_schedule *ks, unsigned char iv[8]);
-#  endif /*  OPENSSL_NO_DES */
-
-# elif defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
-/* IBM S390X support */
-#  include "s390x_arch.h"
-
-
-/* Convert key size to function code: [16,24,32] -> [18,19,20]. */
-#  define S390X_AES_FC(keylen)  (S390X_AES_128 + ((((keylen) << 3) - 128) >> 6))
-
-/* Most modes of operation need km for partial block processing. */
-#  define S390X_aes_128_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
-                                S390X_CAPBIT(S390X_AES_128))
-#  define S390X_aes_192_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
-                                S390X_CAPBIT(S390X_AES_192))
-#  define S390X_aes_256_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
-                                S390X_CAPBIT(S390X_AES_256))
-
-#  define S390X_aes_128_cbc_CAPABLE     1       /* checked by callee */
-#  define S390X_aes_192_cbc_CAPABLE     1
-#  define S390X_aes_256_cbc_CAPABLE     1
-
-#  define S390X_aes_128_ecb_CAPABLE     S390X_aes_128_CAPABLE
-#  define S390X_aes_192_ecb_CAPABLE     S390X_aes_192_CAPABLE
-#  define S390X_aes_256_ecb_CAPABLE     S390X_aes_256_CAPABLE
-
-#  define S390X_aes_128_ofb_CAPABLE (S390X_aes_128_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmo[0] &        \
-                                     S390X_CAPBIT(S390X_AES_128)))
-#  define S390X_aes_192_ofb_CAPABLE (S390X_aes_192_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmo[0] &        \
-                                     S390X_CAPBIT(S390X_AES_192)))
-#  define S390X_aes_256_ofb_CAPABLE (S390X_aes_256_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmo[0] &        \
-                                     S390X_CAPBIT(S390X_AES_256)))
-
-#  define S390X_aes_128_cfb_CAPABLE (S390X_aes_128_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmf[0] &        \
-                                     S390X_CAPBIT(S390X_AES_128)))
-#  define S390X_aes_192_cfb_CAPABLE (S390X_aes_192_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmf[0] &        \
-                                     S390X_CAPBIT(S390X_AES_192)))
-#  define S390X_aes_256_cfb_CAPABLE (S390X_aes_256_CAPABLE &&           \
-                                    (OPENSSL_s390xcap_P.kmf[0] &        \
-                                     S390X_CAPBIT(S390X_AES_256)))
-#  define S390X_aes_128_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
-                                     S390X_CAPBIT(S390X_AES_128))
-#  define S390X_aes_192_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
-                                     S390X_CAPBIT(S390X_AES_192))
-#  define S390X_aes_256_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
-                                     S390X_CAPBIT(S390X_AES_256))
-#  define S390X_aes_128_cfb1_CAPABLE    0
-#  define S390X_aes_192_cfb1_CAPABLE    0
-#  define S390X_aes_256_cfb1_CAPABLE    0
-
-#  define S390X_aes_128_ctr_CAPABLE     1       /* checked by callee */
-#  define S390X_aes_192_ctr_CAPABLE     1
-#  define S390X_aes_256_ctr_CAPABLE     1
-
-#  define S390X_aes_128_xts_CAPABLE     1       /* checked by callee */
-#  define S390X_aes_256_xts_CAPABLE     1
-
-# define S390X_aes_128_gcm_CAPABLE (S390X_aes_128_CAPABLE &&        \
-                                    (OPENSSL_s390xcap_P.kma[0] &    \
-                                     S390X_CAPBIT(S390X_AES_128)))
-# define S390X_aes_192_gcm_CAPABLE (S390X_aes_192_CAPABLE &&        \
-                                    (OPENSSL_s390xcap_P.kma[0] &    \
-                                     S390X_CAPBIT(S390X_AES_192)))
-# define S390X_aes_256_gcm_CAPABLE (S390X_aes_256_CAPABLE &&        \
-                                    (OPENSSL_s390xcap_P.kma[0] &    \
-                                     S390X_CAPBIT(S390X_AES_256)))
-
-#  define S390X_aes_128_ccm_CAPABLE (S390X_aes_128_CAPABLE &&       \
-                                    (OPENSSL_s390xcap_P.kmac[0] &   \
-                                     S390X_CAPBIT(S390X_AES_128)))
-#  define S390X_aes_192_ccm_CAPABLE (S390X_aes_192_CAPABLE &&       \
-                                    (OPENSSL_s390xcap_P.kmac[0] &   \
-                                     S390X_CAPBIT(S390X_AES_192)))
-#  define S390X_aes_256_ccm_CAPABLE (S390X_aes_256_CAPABLE &&       \
-                                    (OPENSSL_s390xcap_P.kmac[0] &   \
-                                     S390X_CAPBIT(S390X_AES_256)))
-#  define S390X_CCM_AAD_FLAG    0x40
-
-#  ifndef OPENSSL_NO_OCB
-#   define S390X_aes_128_ocb_CAPABLE    0
-#   define S390X_aes_192_ocb_CAPABLE    0
-#   define S390X_aes_256_ocb_CAPABLE    0
-#  endif /* OPENSSL_NO_OCB */
-
-#  ifndef OPENSSL_NO_SIV
-#   define S390X_aes_128_siv_CAPABLE    0
-#   define S390X_aes_192_siv_CAPABLE    0
-#   define S390X_aes_256_siv_CAPABLE    0
-#  endif /* OPENSSL_NO_SIV */
-
-/* Convert key size to function code: [16,24,32] -> [18,19,20]. */
-#  define S390X_AES_FC(keylen)  (S390X_AES_128 + ((((keylen) << 3) - 128) >> 6))
-# endif
-
-# if defined(HWAES_CAPABLE)
-int HWAES_set_encrypt_key(const unsigned char *userKey, const int bits,
-                          AES_KEY *key);
-int HWAES_set_decrypt_key(const unsigned char *userKey, const int bits,
-                          AES_KEY *key);
-void HWAES_encrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-void HWAES_decrypt(const unsigned char *in, unsigned char *out,
-                   const AES_KEY *key);
-void HWAES_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                       size_t length, const AES_KEY *key,
-                       unsigned char *ivec, const int enc);
-void HWAES_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
-                                size_t len, const AES_KEY *key,
-                                const unsigned char ivec[16]);
-void HWAES_xts_encrypt(const unsigned char *inp, unsigned char *out,
-                       size_t len, const AES_KEY *key1,
-                       const AES_KEY *key2, const unsigned char iv[16]);
-void HWAES_xts_decrypt(const unsigned char *inp, unsigned char *out,
-                       size_t len, const AES_KEY *key1,
-                       const AES_KEY *key2, const unsigned char iv[16]);
-#  ifndef OPENSSL_NO_OCB
-#   ifdef HWAES_ocb_encrypt
-void HWAES_ocb_encrypt(const unsigned char *in, unsigned char *out,
-                       size_t blocks, const void *key,
-                       size_t start_block_num,
-                       unsigned char offset_i[16],
-                       const unsigned char L_[][16],
-                       unsigned char checksum[16]);
-#   else
-#     define HWAES_ocb_encrypt ((ocb128_f)NULL)
-#   endif
-#   ifdef HWAES_ocb_decrypt
-void HWAES_ocb_decrypt(const unsigned char *in, unsigned char *out,
-                       size_t blocks, const void *key,
-                       size_t start_block_num,
-                       unsigned char offset_i[16],
-                       const unsigned char L_[][16],
-                       unsigned char checksum[16]);
-#   else
-#     define HWAES_ocb_decrypt ((ocb128_f)NULL)
-#   endif
-#  endif /* OPENSSL_NO_OCB */
-
-# endif /* HWAES_CAPABLE */
-
-#endif /* HEADER_INTERNAL_CIPHERMODE_PLATFORM_H */
diff --git a/crypto/include/internal/cms_int.h b/crypto/include/internal/cms_int.h
deleted file mode 100644 (file)
index c630991..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* internal CMS-ESS related stuff */
-
-int cms_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc);
-int cms_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc);
diff --git a/crypto/include/internal/cryptlib_int.h b/crypto/include/internal/cryptlib_int.h
deleted file mode 100644 (file)
index 69d94be..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/core.h>
-#include "internal/cryptlib.h"
-
-/* This file is not scanned by mkdef.pl, whereas cryptlib.h is */
-
-int ossl_init_thread_start(const void *index, void *arg,
-                           OSSL_thread_stop_handler_fn handfn);
-int ossl_init_thread_deregister(void *index);
-int ossl_init_thread(void);
-void ossl_cleanup_thread(void);
-void ossl_ctx_thread_stop(void *arg);
-
-/*
- * OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below
- * are those omitted from crypto.h because they are "reserved for internal
- * use".
- */
-# define OPENSSL_INIT_ZLIB                   0x00010000L
-# define OPENSSL_INIT_BASE_ONLY              0x00040000L
-
-void ossl_trace_cleanup(void);
-void ossl_malloc_setup_failures(void);
diff --git a/crypto/include/internal/ctype.h b/crypto/include/internal/ctype.h
deleted file mode 100644 (file)
index d0660cf..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*
- * This version of ctype.h provides a standardised and platform
- * independent implementation that supports seven bit ASCII characters.
- * The specific intent is to not pass extended ASCII characters (> 127)
- * even if the host operating system would.
- *
- * There is EBCDIC support included for machines which use this.  However,
- * there are a number of concerns about how well EBCDIC is supported
- * throughout the rest of the source code.  Refer to issue #4154 for
- * details.
- */
-#ifndef INTERNAL_CTYPE_H
-# define INTERNAL_CTYPE_H
-
-# define CTYPE_MASK_lower       0x1
-# define CTYPE_MASK_upper       0x2
-# define CTYPE_MASK_digit       0x4
-# define CTYPE_MASK_space       0x8
-# define CTYPE_MASK_xdigit      0x10
-# define CTYPE_MASK_blank       0x20
-# define CTYPE_MASK_cntrl       0x40
-# define CTYPE_MASK_graph       0x80
-# define CTYPE_MASK_print       0x100
-# define CTYPE_MASK_punct       0x200
-# define CTYPE_MASK_base64      0x400
-# define CTYPE_MASK_asn1print   0x800
-
-# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
-# define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
-
-/*
- * The ascii mask assumes that any other classification implies that
- * the character is ASCII and that there are no ASCII characters
- * that aren't in any of the classifications.
- *
- * This assumption holds at the moment, but it might not in the future.
- */
-# define CTYPE_MASK_ascii   (~0)
-
-# ifdef CHARSET_EBCDIC
-int ossl_toascii(int c);
-int ossl_fromascii(int c);
-# else
-#  define ossl_toascii(c)       (c)
-#  define ossl_fromascii(c)     (c)
-# endif
-int ossl_ctype_check(int c, unsigned int mask);
-int ossl_tolower(int c);
-int ossl_toupper(int c);
-
-int ascii_isdigit(const char inchar);
-
-# define ossl_isalnum(c)        (ossl_ctype_check((c), CTYPE_MASK_alnum))
-# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
-# ifdef CHARSET_EBCDIC
-# define ossl_isascii(c)        (ossl_ctype_check((c), CTYPE_MASK_ascii))
-# else
-# define ossl_isascii(c)        (((c) & ~127) == 0)
-# endif
-# define ossl_isblank(c)        (ossl_ctype_check((c), CTYPE_MASK_blank))
-# define ossl_iscntrl(c)        (ossl_ctype_check((c), CTYPE_MASK_cntrl))
-# define ossl_isdigit(c)        (ossl_ctype_check((c), CTYPE_MASK_digit))
-# define ossl_isgraph(c)        (ossl_ctype_check((c), CTYPE_MASK_graph))
-# define ossl_islower(c)        (ossl_ctype_check((c), CTYPE_MASK_lower))
-# define ossl_isprint(c)        (ossl_ctype_check((c), CTYPE_MASK_print))
-# define ossl_ispunct(c)        (ossl_ctype_check((c), CTYPE_MASK_punct))
-# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
-# define ossl_isupper(c)        (ossl_ctype_check((c), CTYPE_MASK_upper))
-# define ossl_isxdigit(c)       (ossl_ctype_check((c), CTYPE_MASK_xdigit))
-# define ossl_isbase64(c)       (ossl_ctype_check((c), CTYPE_MASK_base64))
-# define ossl_isasn1print(c)    (ossl_ctype_check((c), CTYPE_MASK_asn1print))
-
-#endif
diff --git a/crypto/include/internal/dso_conf.h.in b/crypto/include/internal/dso_conf.h.in
deleted file mode 100644 (file)
index 9a373b2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-{- join("\n",map { "/* $_ */" } @autowarntext) -}
-/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_DSO_CONF_H
-# define HEADER_DSO_CONF_H
-{-  # The DSO code currently always implements all functions so that no
-    # applications will have to worry about that from a compilation point
-    # of view. However, the "method"s may return zero unless that platform
-    # has support compiled in for them. Currently each method is enabled
-    # by a define "DSO_<name>" ... we translate the "dso_scheme" config
-    # string entry into using the following logic;
-    my $scheme = $disabled{dso} ? undef : uc $target{dso_scheme};
-    if (!$scheme) {
-        $scheme = "NONE";
-    }
-    my @macros = ( "DSO_$scheme" );
-    if ($scheme eq 'DLFCN') {
-        @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
-    } elsif ($scheme eq "DLFCN_NO_H") {
-        @macros = ( "DSO_DLFCN" );
-    }
-    join("\n", map { "# define $_" } @macros); -}
-# define DSO_EXTENSION "{- platform->dsoext() -}"
-#endif
diff --git a/crypto/include/internal/ec_int.h b/crypto/include/internal/ec_int.h
deleted file mode 100644 (file)
index 9d8882d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* Internal EC functions for other submodules: not for application use */
-
-#ifndef HEADER_OSSL_EC_INTERNAL_H
-# define HEADER_OSSL_EC_INTERNAL_H
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_EC
-
-#  include <openssl/ec.h>
-
-/*-
- * Computes the multiplicative inverse of x in the range
- * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the
- * subgroup generated by the generator G:
- *
- *         res := x^(-1) (mod EC_GROUP::order).
- *
- * This function expects the following two conditions to hold:
- *  - the EC_GROUP order is prime, and
- *  - x is included in the range [1, EC_GROUP::order).
- *
- * This function returns 1 on success, 0 on error.
- *
- * If the EC_GROUP order is even, this function explicitly returns 0 as
- * an error.
- * In case any of the two conditions stated above is not satisfied,
- * the correctness of its output is not guaranteed, even if the return
- * value could still be 1 (as primality testing and a conditional modular
- * reduction round on the input can be omitted by the underlying
- * implementations for better SCA properties on regular input values).
- */
-__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
-                                   const BIGNUM *x, BN_CTX *ctx);
-
-/*-
- * ECDH Key Derivation Function as defined in ANSI X9.63
- */
-int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
-                   const unsigned char *Z, size_t Zlen,
-                   const unsigned char *sinfo, size_t sinfolen,
-                   const EVP_MD *md);
-
-# endif /* OPENSSL_NO_EC */
-#endif
diff --git a/crypto/include/internal/engine.h b/crypto/include/internal/engine.h
deleted file mode 100644 (file)
index fac6ed0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/engine.h>
-
-void engine_load_openssl_int(void);
-void engine_load_devcrypto_int(void);
-void engine_load_rdrand_int(void);
-void engine_load_dynamic_int(void);
-void engine_load_padlock_int(void);
-void engine_load_capi_int(void);
-void engine_load_dasync_int(void);
-void engine_load_afalg_int(void);
-void engine_cleanup_int(void);
diff --git a/crypto/include/internal/err_int.h b/crypto/include/internal/err_int.h
deleted file mode 100644 (file)
index 68c6d62..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef INTERNAL_ERR_INT_H
-# define INTERNAL_ERR_INT_H
-
-int err_load_crypto_strings_int(void);
-void err_cleanup(void);
-int err_shelve_state(void **);
-void err_unshelve_state(void *);
-
-#endif
diff --git a/crypto/include/internal/ess_int.h b/crypto/include/internal/ess_int.h
deleted file mode 100644 (file)
index ac6c5c6..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* internal ESS related stuff */
-
-ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si);
-int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc);
-
-ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,
-                                            STACK_OF(X509) *certs,
-                                            int issuer_needed);
-
-ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_get(PKCS7_SIGNER_INFO *si);
-int ESS_SIGNING_CERT_V2_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT_V2 *sc);
-
-ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new_init(const EVP_MD *hash_alg,
-                                                  X509 *signcert,
-                                                  STACK_OF(X509) *certs,
-                                                  int issuer_needed);
-
-/*-
- * IssuerSerial ::= SEQUENCE {
- *        issuer                  GeneralNames,
- *        serialNumber            CertificateSerialNumber
- * }
- */
-
-struct ESS_issuer_serial {
-    STACK_OF(GENERAL_NAME) *issuer;
-    ASN1_INTEGER *serial;
-};
-
-/*-
- * ESSCertID ::=  SEQUENCE {
- *        certHash                Hash,
- *        issuerSerial            IssuerSerial OPTIONAL
- * }
- */
-
-struct ESS_cert_id {
-    ASN1_OCTET_STRING *hash;    /* Always SHA-1 digest. */
-    ESS_ISSUER_SERIAL *issuer_serial;
-};
-
-/*-
- * SigningCertificate ::=  SEQUENCE {
- *        certs                   SEQUENCE OF ESSCertID,
- *        policies                SEQUENCE OF PolicyInformation OPTIONAL
- * }
- */
-
-struct ESS_signing_cert {
-    STACK_OF(ESS_CERT_ID) *cert_ids;
-    STACK_OF(POLICYINFO) *policy_info;
-};
-
-/*-
- * ESSCertIDv2 ::=  SEQUENCE {
- *        hashAlgorithm           AlgorithmIdentifier DEFAULT id-sha256,
- *        certHash                Hash,
- *        issuerSerial            IssuerSerial OPTIONAL
- * }
- */
-
-struct ESS_cert_id_v2_st {
-    X509_ALGOR *hash_alg;       /* Default: SHA-256 */
-    ASN1_OCTET_STRING *hash;
-    ESS_ISSUER_SERIAL *issuer_serial;
-};
-
-/*-
- * SigningCertificateV2 ::= SEQUENCE {
- *        certs                   SEQUENCE OF ESSCertIDv2,
- *        policies                SEQUENCE OF PolicyInformation OPTIONAL
- * }
- */
-
-struct ESS_signing_cert_v2_st {
-    STACK_OF(ESS_CERT_ID_V2) *cert_ids;
-    STACK_OF(POLICYINFO) *policy_info;
-};
diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h
deleted file mode 100644 (file)
index b9dc951..0000000
+++ /dev/null
@@ -1,619 +0,0 @@
-/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/evp.h>
-#include <openssl/core_numbers.h>
-#include "internal/refcount.h"
-
-/*
- * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag
- * values in evp.h
- */
-#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX   0x0400
-
-struct evp_pkey_ctx_st {
-    /* Actual operation */
-    int operation;
-
-    union {
-        struct {
-            EVP_KEYEXCH *exchange;
-            void *exchprovctx;
-        } kex;
-
-        struct {
-            EVP_SIGNATURE *signature;
-            void *sigprovctx;
-        } sig;
-    } op;
-
-    /* Legacy fields below */
-
-    /* Method associated with this operation */
-    const EVP_PKEY_METHOD *pmeth;
-    /* Engine that implements this method or NULL if builtin */
-    ENGINE *engine;
-    /* Key: may be NULL */
-    EVP_PKEY *pkey;
-    /* Peer key for key agreement, may be NULL */
-    EVP_PKEY *peerkey;
-    /* Algorithm specific data */
-    void *data;
-    /* Application specific data */
-    void *app_data;
-    /* Keygen callback */
-    EVP_PKEY_gen_cb *pkey_gencb;
-    /* implementation specific keygen data */
-    int *keygen_info;
-    int keygen_info_count;
-} /* EVP_PKEY_CTX */ ;
-
-#define EVP_PKEY_FLAG_DYNAMIC   1
-
-struct evp_pkey_method_st {
-    int pkey_id;
-    int flags;
-    int (*init) (EVP_PKEY_CTX *ctx);
-    int (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);
-    void (*cleanup) (EVP_PKEY_CTX *ctx);
-    int (*paramgen_init) (EVP_PKEY_CTX *ctx);
-    int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
-    int (*keygen_init) (EVP_PKEY_CTX *ctx);
-    int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
-    int (*sign_init) (EVP_PKEY_CTX *ctx);
-    int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
-                 const unsigned char *tbs, size_t tbslen);
-    int (*verify_init) (EVP_PKEY_CTX *ctx);
-    int (*verify) (EVP_PKEY_CTX *ctx,
-                   const unsigned char *sig, size_t siglen,
-                   const unsigned char *tbs, size_t tbslen);
-    int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
-    int (*verify_recover) (EVP_PKEY_CTX *ctx,
-                           unsigned char *rout, size_t *routlen,
-                           const unsigned char *sig, size_t siglen);
-    int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
-    int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
-                    EVP_MD_CTX *mctx);
-    int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
-    int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
-                      EVP_MD_CTX *mctx);
-    int (*encrypt_init) (EVP_PKEY_CTX *ctx);
-    int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
-                    const unsigned char *in, size_t inlen);
-    int (*decrypt_init) (EVP_PKEY_CTX *ctx);
-    int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
-                    const unsigned char *in, size_t inlen);
-    int (*derive_init) (EVP_PKEY_CTX *ctx);
-    int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
-    int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
-    int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
-    int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
-                       const unsigned char *tbs, size_t tbslen);
-    int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
-                         size_t siglen, const unsigned char *tbs,
-                         size_t tbslen);
-    int (*check) (EVP_PKEY *pkey);
-    int (*public_check) (EVP_PKEY *pkey);
-    int (*param_check) (EVP_PKEY *pkey);
-
-    int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
-} /* EVP_PKEY_METHOD */ ;
-
-DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
-
-void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
-
-const EVP_PKEY_METHOD *cmac_pkey_method(void);
-const EVP_PKEY_METHOD *dh_pkey_method(void);
-const EVP_PKEY_METHOD *dhx_pkey_method(void);
-const EVP_PKEY_METHOD *dsa_pkey_method(void);
-const EVP_PKEY_METHOD *ec_pkey_method(void);
-const EVP_PKEY_METHOD *sm2_pkey_method(void);
-const EVP_PKEY_METHOD *ecx25519_pkey_method(void);
-const EVP_PKEY_METHOD *ecx448_pkey_method(void);
-const EVP_PKEY_METHOD *ed25519_pkey_method(void);
-const EVP_PKEY_METHOD *ed448_pkey_method(void);
-const EVP_PKEY_METHOD *hmac_pkey_method(void);
-const EVP_PKEY_METHOD *rsa_pkey_method(void);
-const EVP_PKEY_METHOD *rsa_pss_pkey_method(void);
-const EVP_PKEY_METHOD *scrypt_pkey_method(void);
-const EVP_PKEY_METHOD *tls1_prf_pkey_method(void);
-const EVP_PKEY_METHOD *hkdf_pkey_method(void);
-const EVP_PKEY_METHOD *poly1305_pkey_method(void);
-const EVP_PKEY_METHOD *siphash_pkey_method(void);
-
-struct evp_mac_st {
-    OSSL_PROVIDER *prov;
-    int name_id;
-
-    CRYPTO_REF_COUNT refcnt;
-    CRYPTO_RWLOCK *lock;
-
-    OSSL_OP_mac_newctx_fn *newctx;
-    OSSL_OP_mac_dupctx_fn *dupctx;
-    OSSL_OP_mac_freectx_fn *freectx;
-    OSSL_OP_mac_size_fn *size;
-    OSSL_OP_mac_init_fn *init;
-    OSSL_OP_mac_update_fn *update;
-    OSSL_OP_mac_final_fn *final;
-    OSSL_OP_mac_gettable_params_fn *gettable_params;
-    OSSL_OP_mac_gettable_ctx_params_fn *gettable_ctx_params;
-    OSSL_OP_mac_settable_ctx_params_fn *settable_ctx_params;
-    OSSL_OP_mac_get_params_fn *get_params;
-    OSSL_OP_mac_get_ctx_params_fn *get_ctx_params;
-    OSSL_OP_mac_set_ctx_params_fn *set_ctx_params;
-};
-
-struct evp_kdf_st {
-    OSSL_PROVIDER *prov;
-    int name_id;
-    CRYPTO_REF_COUNT refcnt;
-    CRYPTO_RWLOCK *lock;
-
-    OSSL_OP_kdf_newctx_fn *newctx;
-    OSSL_OP_kdf_dupctx_fn *dupctx;
-    OSSL_OP_kdf_freectx_fn *freectx;
-    OSSL_OP_kdf_reset_fn *reset;
-    OSSL_OP_kdf_derive_fn *derive;
-    OSSL_OP_kdf_gettable_params_fn *gettable_params;
-    OSSL_OP_kdf_gettable_ctx_params_fn *gettable_ctx_params;
-    OSSL_OP_kdf_settable_ctx_params_fn *settable_ctx_params;
-    OSSL_OP_kdf_get_params_fn *get_params;
-    OSSL_OP_kdf_get_ctx_params_fn *get_ctx_params;
-    OSSL_OP_kdf_set_ctx_params_fn *set_ctx_params;
-};
-
-extern const EVP_KDF pbkdf2_kdf_meth;
-extern const EVP_KDF scrypt_kdf_meth;
-extern const EVP_KDF tls1_prf_kdf_meth;
-extern const EVP_KDF hkdf_kdf_meth;
-extern const EVP_KDF sshkdf_kdf_meth;
-extern const EVP_KDF ss_kdf_meth;
-extern const EVP_KDF x963_kdf_meth;
-extern const EVP_KDF x942_kdf_meth;
-
-struct evp_md_st {
-    /* nid */
-    int type;
-
-    /* Legacy structure members */
-    /* TODO(3.0): Remove these */
-    int pkey_type;
-    int md_size;
-    unsigned long flags;
-    int (*init) (EVP_MD_CTX *ctx);
-    int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
-    int (*final) (EVP_MD_CTX *ctx, unsigned char *md);
-    int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from);
-    int (*cleanup) (EVP_MD_CTX *ctx);
-    int block_size;
-    int ctx_size;               /* how big does the ctx->md_data need to be */
-    /* control function */
-    int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
-
-    /* New structure members */
-    /* TODO(3.0): Remove above comment when legacy has gone */
-    int name_id;
-    OSSL_PROVIDER *prov;
-    CRYPTO_REF_COUNT refcnt;
-    CRYPTO_RWLOCK *lock;
-    OSSL_OP_digest_newctx_fn *newctx;
-    OSSL_OP_digest_init_fn *dinit;
-    OSSL_OP_digest_update_fn *dupdate;
-    OSSL_OP_digest_final_fn *dfinal;
-    OSSL_OP_digest_digest_fn *digest;
-    OSSL_OP_digest_freectx_fn *freectx;
-    OSSL_OP_digest_dupctx_fn *dupctx;
-    OSSL_OP_digest_get_params_fn *get_params;
-    OSSL_OP_digest_set_ctx_params_fn *set_ctx_params;
-    OSSL_OP_digest_get_ctx_params_fn *get_ctx_params;
-    OSSL_OP_digest_gettable_params_fn *gettable_params;
-    OSSL_OP_digest_settable_ctx_params_fn *settable_ctx_params;
-    OSSL_OP_digest_gettable_ctx_params_fn *gettable_ctx_params;
-
-} /* EVP_MD */ ;
-
-struct evp_cipher_st {
-    int nid;
-
-    int block_size;
-    /* Default value for variable length ciphers */
-    int key_len;
-    int iv_len;
-
-    /* Legacy structure members */
-    /* TODO(3.0): Remove these */
-    /* Various flags */
-    unsigned long flags;
-    /* init key */
-    int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key,
-                 const unsigned char *iv, int enc);
-    /* encrypt/decrypt data */
-    int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out,
-                      const unsigned char *in, size_t inl);
-    /* cleanup ctx */
-    int (*cleanup) (EVP_CIPHER_CTX *);
-    /* how big ctx->cipher_data needs to be */
-    int ctx_size;
-    /* Populate a ASN1_TYPE with parameters */
-    int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
-    /* Get parameters from a ASN1_TYPE */
-    int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
-    /* Miscellaneous operations */
-    int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr);
-    /* Application data */
-    void *app_data;
-
-    /* New structure members */
-    /* TODO(3.0): Remove above comment when legacy has gone */
-    int name_id;
-    OSSL_PROVIDER *prov;
-    CRYPTO_REF_COUNT refcnt;
-    CRYPTO_RWLOCK *lock;
-    OSSL_OP_cipher_newctx_fn *newctx;
-    OSSL_OP_cipher_encrypt_init_fn *einit;
-    OSSL_OP_cipher_decrypt_init_fn *dinit;
-    OSSL_OP_cipher_update_fn *cupdate;
-    OSSL_OP_cipher_final_fn *cfinal;
-    OSSL_OP_cipher_cipher_fn *ccipher;
-    OSSL_OP_cipher_freectx_fn *freectx;
-    OSSL_OP_cipher_dupctx_fn *dupctx;
-    OSSL_OP_cipher_get_params_fn *get_params;
-    OSSL_OP_cipher_get_ctx_params_fn *get_ctx_params;
-    OSSL_OP_cipher_set_ctx_params_fn *set_ctx_params;
-    OSSL_OP_cipher_gettable_params_fn *gettable_params;
-    OSSL_OP_cipher_gettable_ctx_params_fn *gettable_ctx_params;
-    OSSL_OP_cipher_settable_ctx_params_fn *settable_ctx_params;
-} /* EVP_CIPHER */ ;
-
-/* Macros to code block cipher wrappers */
-
-/* Wrapper functions for each cipher mode */
-
-#define EVP_C_DATA(kstruct, ctx) \
-        ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
-
-#define BLOCK_CIPHER_ecb_loop() \
-        size_t i, bl; \
-        bl = EVP_CIPHER_CTX_cipher(ctx)->block_size;    \
-        if (inl < bl) return 1;\
-        inl -= bl; \
-        for (i=0; i <= inl; i+=bl)
-
-#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
-static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
-{\
-        BLOCK_CIPHER_ecb_loop() \
-            cprefix##_ecb_encrypt(in + i, out + i, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_encrypting(ctx)); \
-        return 1;\
-}
-
-#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))
-
-#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
-    static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
-{\
-        while(inl>=EVP_MAXCHUNK) {\
-            int num = EVP_CIPHER_CTX_num(ctx);\
-            cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
-            EVP_CIPHER_CTX_set_num(ctx, num);\
-            inl-=EVP_MAXCHUNK;\
-            in +=EVP_MAXCHUNK;\
-            out+=EVP_MAXCHUNK;\
-        }\
-        if (inl) {\
-            int num = EVP_CIPHER_CTX_num(ctx);\
-            cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
-            EVP_CIPHER_CTX_set_num(ctx, num);\
-        }\
-        return 1;\
-}
-
-#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
-static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
-{\
-        while(inl>=EVP_MAXCHUNK) \
-            {\
-            cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
-            inl-=EVP_MAXCHUNK;\
-            in +=EVP_MAXCHUNK;\
-            out+=EVP_MAXCHUNK;\
-            }\
-        if (inl)\
-            cprefix##_cbc_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
-        return 1;\
-}
-
-#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched)  \
-static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
-{\
-    size_t chunk = EVP_MAXCHUNK;\
-    if (cbits == 1)  chunk >>= 3;\
-    if (inl < chunk) chunk = inl;\
-    while (inl && inl >= chunk)\
-    {\
-        int num = EVP_CIPHER_CTX_num(ctx);\
-        cprefix##_cfb##cbits##_encrypt(in, out, (long) \
-            ((cbits == 1) \
-                && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
-                ? chunk*8 : chunk), \
-            &EVP_C_DATA(kstruct, ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx),\
-            &num, EVP_CIPHER_CTX_encrypting(ctx));\
-        EVP_CIPHER_CTX_set_num(ctx, num);\
-        inl -= chunk;\
-        in += chunk;\
-        out += chunk;\
-        if (inl < chunk) chunk = inl;\
-    }\
-    return 1;\
-}
-
-#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
-        BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
-        BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
-        BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
-        BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
-
-#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
-                          key_len, iv_len, flags, init_key, cleanup, \
-                          set_asn1, get_asn1, ctrl) \
-static const EVP_CIPHER cname##_##mode = { \
-        nid##_##nmode, block_size, key_len, iv_len, \
-        flags | EVP_CIPH_##MODE##_MODE, \
-        init_key, \
-        cname##_##mode##_cipher, \
-        cleanup, \
-        sizeof(kstruct), \
-        set_asn1, get_asn1,\
-        ctrl, \
-        NULL \
-}; \
-const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
-
-#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
-                             iv_len, flags, init_key, cleanup, set_asn1, \
-                             get_asn1, ctrl) \
-BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
-                  iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
-
-#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
-                             iv_len, cbits, flags, init_key, cleanup, \
-                             set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
-                  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
-                  get_asn1, ctrl)
-
-#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
-                             iv_len, cbits, flags, init_key, cleanup, \
-                             set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
-                  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
-                  get_asn1, ctrl)
-
-#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
-                             flags, init_key, cleanup, set_asn1, \
-                             get_asn1, ctrl) \
-BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
-                  0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
-
-#define BLOCK_CIPHER_defs(cname, kstruct, \
-                          nid, block_size, key_len, iv_len, cbits, flags, \
-                          init_key, cleanup, set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
-                     init_key, cleanup, set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
-                     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
-                     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
-BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
-                     init_key, cleanup, set_asn1, get_asn1, ctrl)
-
-/*-
-#define BLOCK_CIPHER_defs(cname, kstruct, \
-                                nid, block_size, key_len, iv_len, flags,\
-                                 init_key, cleanup, set_asn1, get_asn1, ctrl)\
-static const EVP_CIPHER cname##_cbc = {\
-        nid##_cbc, block_size, key_len, iv_len, \
-        flags | EVP_CIPH_CBC_MODE,\
-        init_key,\
-        cname##_cbc_cipher,\
-        cleanup,\
-        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
-                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
-        set_asn1, get_asn1,\
-        ctrl, \
-        NULL \
-};\
-const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
-static const EVP_CIPHER cname##_cfb = {\
-        nid##_cfb64, 1, key_len, iv_len, \
-        flags | EVP_CIPH_CFB_MODE,\
-        init_key,\
-        cname##_cfb_cipher,\
-        cleanup,\
-        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
-                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
-        set_asn1, get_asn1,\
-        ctrl,\
-        NULL \
-};\
-const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
-static const EVP_CIPHER cname##_ofb = {\
-        nid##_ofb64, 1, key_len, iv_len, \
-        flags | EVP_CIPH_OFB_MODE,\
-        init_key,\
-        cname##_ofb_cipher,\
-        cleanup,\
-        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
-                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
-        set_asn1, get_asn1,\
-        ctrl,\
-        NULL \
-};\
-const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
-static const EVP_CIPHER cname##_ecb = {\
-        nid##_ecb, block_size, key_len, iv_len, \
-        flags | EVP_CIPH_ECB_MODE,\
-        init_key,\
-        cname##_ecb_cipher,\
-        cleanup,\
-        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
-                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
-        set_asn1, get_asn1,\
-        ctrl,\
-        NULL \
-};\
-const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
-*/
-
-#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
-                               block_size, key_len, iv_len, cbits, \
-                               flags, init_key, \
-                               cleanup, set_asn1, get_asn1, ctrl) \
-        BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
-        BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
-                          cbits, flags, init_key, cleanup, set_asn1, \
-                          get_asn1, ctrl)
-
-#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,fl) \
-        BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
-        BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
-                             NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
-                             (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \
-                             cipher##_init_key, NULL, NULL, NULL, NULL)
-
-
-# ifndef OPENSSL_NO_EC
-
-#define X25519_KEYLEN        32
-#define X448_KEYLEN          56
-#define ED25519_KEYLEN       32
-#define ED448_KEYLEN         57
-
-#define MAX_KEYLEN  ED448_KEYLEN
-
-typedef struct {
-    unsigned char pubkey[MAX_KEYLEN];
-    unsigned char *privkey;
-} ECX_KEY;
-
-#endif
-
-/*
- * Type needs to be a bit field Sub-type needs to be for variations on the
- * method, as in, can it do arbitrary encryption....
- */
-struct evp_pkey_st {
-    /* == Legacy attributes == */
-    int type;
-    int save_type;
-    const EVP_PKEY_ASN1_METHOD *ameth;
-    ENGINE *engine;
-    ENGINE *pmeth_engine; /* If not NULL public key ENGINE to use */
-    union {
-        void *ptr;
-# ifndef OPENSSL_NO_RSA
-        struct rsa_st *rsa;     /* RSA */
-# endif
-# ifndef OPENSSL_NO_DSA
-        struct dsa_st *dsa;     /* DSA */
-# endif
-# ifndef OPENSSL_NO_DH
-        struct dh_st *dh;       /* DH */
-# endif
-# ifndef OPENSSL_NO_EC
-        struct ec_key_st *ec;   /* ECC */
-        ECX_KEY *ecx;           /* X25519, X448, Ed25519, Ed448 */
-# endif
-    } pkey;
-
-    /* == Common attributes == */
-    CRYPTO_REF_COUNT references;
-    CRYPTO_RWLOCK *lock;
-    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
-    int save_parameters;
-
-    /* == Provider attributes == */
-    /*
-     * To support transparent export/import between providers that
-     * support the methods for it, and still not having to do the
-     * export/import every time a key is used, we maintain a cache
-     * of imported key, indexed by provider address.
-     * pkeys[0] is *always* the "original" key.
-     */
-    struct {
-        EVP_KEYMGMT *keymgmt;
-        void *provkey;
-    } pkeys[10];
-    /*
-     * If there is a legacy key assigned to this structure, we keep
-     * a copy of that key's dirty count.
-     */
-    size_t dirty_cnt_copy;
-} /* EVP_PKEY */ ;
-
-#define EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) \
-    ((ctx)->operation == EVP_PKEY_OP_SIGN \
-     || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
-     || (ctx)->operation == EVP_PKEY_OP_VERIFY \
-     || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
-     || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
-
-#define EVP_PKEY_CTX_IS_DERIVE_OP(ctx) \
-    ((ctx)->operation == EVP_PKEY_OP_DERIVE)
-
-void openssl_add_all_ciphers_int(void);
-void openssl_add_all_digests_int(void);
-void evp_cleanup_int(void);
-void evp_app_cleanup_int(void);
-
-/* KEYMGMT helper functions */
-void *evp_keymgmt_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
-void evp_keymgmt_clear_pkey_cache(EVP_PKEY *pk);
-
-/* KEYMGMT provider interface functions */
-void *evp_keymgmt_importdomparams(const EVP_KEYMGMT *keymgmt,
-                                  const OSSL_PARAM params[]);
-void *evp_keymgmt_gendomparams(const EVP_KEYMGMT *keymgmt,
-                            const OSSL_PARAM params[]);
-void evp_keymgmt_freedomparams(const EVP_KEYMGMT *keymgmt,
-                               void *provdomparams);
-int evp_keymgmt_exportdomparams(const EVP_KEYMGMT *keymgmt,
-                                void *provdomparams, OSSL_PARAM params[]);
-const OSSL_PARAM *
-evp_keymgmt_importdomparam_types(const EVP_KEYMGMT *keymgmt);
-const OSSL_PARAM *
-evp_keymgmt_exportdomparam_types(const EVP_KEYMGMT *keymgmt);
-
-void *evp_keymgmt_importkey(const EVP_KEYMGMT *keymgmt,
-                            const OSSL_PARAM params[]);
-void *evp_keymgmt_genkey(const EVP_KEYMGMT *keymgmt, void *domparams,
-                         const OSSL_PARAM params[]);
-void *evp_keymgmt_loadkey(const EVP_KEYMGMT *keymgmt,
-                          void *id, size_t idlen);
-void evp_keymgmt_freekey(const EVP_KEYMGMT *keymgmt, void *provkey);
-int evp_keymgmt_exportkey(const EVP_KEYMGMT *keymgmt,
-                               void *provkey, OSSL_PARAM params[]);
-const OSSL_PARAM *evp_keymgmt_importkey_types(const EVP_KEYMGMT *keymgmt);
-const OSSL_PARAM *evp_keymgmt_exportkey_types(const EVP_KEYMGMT *keymgmt);
-
-/* Pulling defines out of C source files */
-
-#define EVP_RC4_KEY_SIZE 16
-#ifndef TLS1_1_VERSION
-# define TLS1_1_VERSION   0x0302
-#endif
-
-void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags);
-
-/* EVP_ENCODE_CTX flags */
-/* Don't generate new lines when encoding */
-#define EVP_ENCODE_CTX_NO_NEWLINES          1
-/* Use the SRP base64 alphabet instead of the standard one */
-#define EVP_ENCODE_CTX_USE_SRP_ALPHABET     2
diff --git a/crypto/include/internal/lhash.h b/crypto/include/internal/lhash.h
deleted file mode 100644 (file)
index de0c8b0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef INTERNAL_LHASH_H
-# define INTERNAL_LHASH_H
-
-unsigned long openssl_lh_strcasehash(const char *);
-
-#endif
diff --git a/crypto/include/internal/md32_common.h b/crypto/include/internal/md32_common.h
deleted file mode 100644 (file)
index 3b16f1b..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*-
- * This is a generic 32 bit "collector" for message digest algorithms.
- * Whenever needed it collects input character stream into chunks of
- * 32 bit values and invokes a block function that performs actual hash
- * calculations.
- *
- * Porting guide.
- *
- * Obligatory macros:
- *
- * DATA_ORDER_IS_BIG_ENDIAN or DATA_ORDER_IS_LITTLE_ENDIAN
- *      this macro defines byte order of input stream.
- * HASH_CBLOCK
- *      size of a unit chunk HASH_BLOCK operates on.
- * HASH_LONG
- *      has to be at least 32 bit wide.
- * HASH_CTX
- *      context structure that at least contains following
- *      members:
- *              typedef struct {
- *                      ...
- *                      HASH_LONG       Nl,Nh;
- *                      either {
- *                      HASH_LONG       data[HASH_LBLOCK];
- *                      unsigned char   data[HASH_CBLOCK];
- *                      };
- *                      unsigned int    num;
- *                      ...
- *                      } HASH_CTX;
- *      data[] vector is expected to be zeroed upon first call to
- *      HASH_UPDATE.
- * HASH_UPDATE
- *      name of "Update" function, implemented here.
- * HASH_TRANSFORM
- *      name of "Transform" function, implemented here.
- * HASH_FINAL
- *      name of "Final" function, implemented here.
- * HASH_BLOCK_DATA_ORDER
- *      name of "block" function capable of treating *unaligned* input
- *      message in original (data) byte order, implemented externally.
- * HASH_MAKE_STRING
- *      macro converting context variables to an ASCII hash string.
- *
- * MD5 example:
- *
- *      #define DATA_ORDER_IS_LITTLE_ENDIAN
- *
- *      #define HASH_LONG               MD5_LONG
- *      #define HASH_CTX                MD5_CTX
- *      #define HASH_CBLOCK             MD5_CBLOCK
- *      #define HASH_UPDATE             MD5_Update
- *      #define HASH_TRANSFORM          MD5_Transform
- *      #define HASH_FINAL              MD5_Final
- *      #define HASH_BLOCK_DATA_ORDER   md5_block_data_order
- */
-
-#include <openssl/crypto.h>
-
-#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN)
-# error "DATA_ORDER must be defined!"
-#endif
-
-#ifndef HASH_CBLOCK
-# error "HASH_CBLOCK must be defined!"
-#endif
-#ifndef HASH_LONG
-# error "HASH_LONG must be defined!"
-#endif
-#ifndef HASH_CTX
-# error "HASH_CTX must be defined!"
-#endif
-
-#ifndef HASH_UPDATE
-# error "HASH_UPDATE must be defined!"
-#endif
-#ifndef HASH_TRANSFORM
-# error "HASH_TRANSFORM must be defined!"
-#endif
-#ifndef HASH_FINAL
-# error "HASH_FINAL must be defined!"
-#endif
-
-#ifndef HASH_BLOCK_DATA_ORDER
-# error "HASH_BLOCK_DATA_ORDER must be defined!"
-#endif
-
-#define ROTATE(a,n)     (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
-
-#if defined(DATA_ORDER_IS_BIG_ENDIAN)
-
-# define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))<<24),          \
-                         l|=(((unsigned long)(*((c)++)))<<16),          \
-                         l|=(((unsigned long)(*((c)++)))<< 8),          \
-                         l|=(((unsigned long)(*((c)++)))    )           )
-# define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
-                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
-                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
-                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
-                         l)
-
-#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
-
-# define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))    ),          \
-                         l|=(((unsigned long)(*((c)++)))<< 8),          \
-                         l|=(((unsigned long)(*((c)++)))<<16),          \
-                         l|=(((unsigned long)(*((c)++)))<<24)           )
-# define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)    )&0xff),      \
-                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
-                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
-                         *((c)++)=(unsigned char)(((l)>>24)&0xff),      \
-                         l)
-
-#endif
-
-/*
- * Time for some action :-)
- */
-
-int HASH_UPDATE(HASH_CTX *c, const void *data_, size_t len)
-{
-    const unsigned char *data = data_;
-    unsigned char *p;
-    HASH_LONG l;
-    size_t n;
-
-    if (len == 0)
-        return 1;
-
-    l = (c->Nl + (((HASH_LONG) len) << 3)) & 0xffffffffUL;
-    if (l < c->Nl)              /* overflow */
-        c->Nh++;
-    c->Nh += (HASH_LONG) (len >> 29); /* might cause compiler warning on
-                                       * 16-bit */
-    c->Nl = l;
-
-    n = c->num;
-    if (n != 0) {
-        p = (unsigned char *)c->data;
-
-        if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) {
-            memcpy(p + n, data, HASH_CBLOCK - n);
-            HASH_BLOCK_DATA_ORDER(c, p, 1);
-            n = HASH_CBLOCK - n;
-            data += n;
-            len -= n;
-            c->num = 0;
-            /*
-             * We use memset rather than OPENSSL_cleanse() here deliberately.
-             * Using OPENSSL_cleanse() here could be a performance issue. It
-             * will get properly cleansed on finalisation so this isn't a
-             * security problem.
-             */
-            memset(p, 0, HASH_CBLOCK); /* keep it zeroed */
-        } else {
-            memcpy(p + n, data, len);
-            c->num += (unsigned int)len;
-            return 1;
-        }
-    }
-
-    n = len / HASH_CBLOCK;
-    if (n > 0) {
-        HASH_BLOCK_DATA_ORDER(c, data, n);
-        n *= HASH_CBLOCK;
-        data += n;
-        len -= n;
-    }
-
-    if (len != 0) {
-        p = (unsigned char *)c->data;
-        c->num = (unsigned int)len;
-        memcpy(p, data, len);
-    }
-    return 1;
-}
-
-void HASH_TRANSFORM(HASH_CTX *c, const unsigned char *data)
-{
-    HASH_BLOCK_DATA_ORDER(c, data, 1);
-}
-
-int HASH_FINAL(unsigned char *md, HASH_CTX *c)
-{
-    unsigned char *p = (unsigned char *)c->data;
-    size_t n = c->num;
-
-    p[n] = 0x80;                /* there is always room for one */
-    n++;
-
-    if (n > (HASH_CBLOCK - 8)) {
-        memset(p + n, 0, HASH_CBLOCK - n);
-        n = 0;
-        HASH_BLOCK_DATA_ORDER(c, p, 1);
-    }
-    memset(p + n, 0, HASH_CBLOCK - 8 - n);
-
-    p += HASH_CBLOCK - 8;
-#if   defined(DATA_ORDER_IS_BIG_ENDIAN)
-    (void)HOST_l2c(c->Nh, p);
-    (void)HOST_l2c(c->Nl, p);
-#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
-    (void)HOST_l2c(c->Nl, p);
-    (void)HOST_l2c(c->Nh, p);
-#endif
-    p -= HASH_CBLOCK;
-    HASH_BLOCK_DATA_ORDER(c, p, 1);
-    c->num = 0;
-    OPENSSL_cleanse(p, HASH_CBLOCK);
-
-#ifndef HASH_MAKE_STRING
-# error "HASH_MAKE_STRING must be defined!"
-#else
-    HASH_MAKE_STRING(c, md);
-#endif
-
-    return 1;
-}
-
-#ifndef MD32_REG_T
-# if defined(__alpha) || defined(__sparcv9) || defined(__mips)
-#  define MD32_REG_T long
-/*
- * This comment was originally written for MD5, which is why it
- * discusses A-D. But it basically applies to all 32-bit digests,
- * which is why it was moved to common header file.
- *
- * In case you wonder why A-D are declared as long and not
- * as MD5_LONG. Doing so results in slight performance
- * boost on LP64 architectures. The catch is we don't
- * really care if 32 MSBs of a 64-bit register get polluted
- * with eventual overflows as we *save* only 32 LSBs in
- * *either* case. Now declaring 'em long excuses the compiler
- * from keeping 32 MSBs zeroed resulting in 13% performance
- * improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
- * Well, to be honest it should say that this *prevents*
- * performance degradation.
- */
-# else
-/*
- * Above is not absolute and there are LP64 compilers that
- * generate better code if MD32_REG_T is defined int. The above
- * pre-processor condition reflects the circumstances under which
- * the conclusion was made and is subject to further extension.
- */
-#  define MD32_REG_T int
-# endif
-#endif
diff --git a/crypto/include/internal/modes_int.h b/crypto/include/internal/modes_int.h
deleted file mode 100644 (file)
index 08e4ffa..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2010-2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* TODO(3.0) Move this header into provider when dependencies are removed */
-#include <openssl/modes.h>
-
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
-typedef __int64 i64;
-typedef unsigned __int64 u64;
-# define U64(C) C##UI64
-#elif defined(__arch64__)
-typedef long i64;
-typedef unsigned long u64;
-# define U64(C) C##UL
-#else
-typedef long long i64;
-typedef unsigned long long u64;
-# define U64(C) C##ULL
-#endif
-
-typedef unsigned int u32;
-typedef unsigned char u8;
-
-#define STRICT_ALIGNMENT 1
-#ifndef PEDANTIC
-# if defined(__i386)    || defined(__i386__)    || \
-     defined(__x86_64)  || defined(__x86_64__)  || \
-     defined(_M_IX86)   || defined(_M_AMD64)    || defined(_M_X64) || \
-     defined(__aarch64__)                       || \
-     defined(__s390__)  || defined(__s390x__)
-#  undef STRICT_ALIGNMENT
-# endif
-#endif
-
-#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
-# if defined(__GNUC__) && __GNUC__>=2
-#  if defined(__x86_64) || defined(__x86_64__)
-#   define BSWAP8(x) ({ u64 ret_=(x);                   \
-                        asm ("bswapq %0"                \
-                        : "+r"(ret_));   ret_;          })
-#   define BSWAP4(x) ({ u32 ret_=(x);                   \
-                        asm ("bswapl %0"                \
-                        : "+r"(ret_));   ret_;          })
-#  elif (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
-#   define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x);   \
-                        asm ("bswapl %0; bswapl %1"     \
-                        : "+r"(hi_),"+r"(lo_));         \
-                        (u64)hi_<<32|lo_;               })
-#   define BSWAP4(x) ({ u32 ret_=(x);                   \
-                        asm ("bswapl %0"                \
-                        : "+r"(ret_));   ret_;          })
-#  elif defined(__aarch64__)
-#   define BSWAP8(x) ({ u64 ret_;                       \
-                        asm ("rev %0,%1"                \
-                        : "=r"(ret_) : "r"(x)); ret_;   })
-#   define BSWAP4(x) ({ u32 ret_;                       \
-                        asm ("rev %w0,%w1"              \
-                        : "=r"(ret_) : "r"(x)); ret_;   })
-#  elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT)
-#   define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x);   \
-                        asm ("rev %0,%0; rev %1,%1"     \
-                        : "+r"(hi_),"+r"(lo_));         \
-                        (u64)hi_<<32|lo_;               })
-#   define BSWAP4(x) ({ u32 ret_;                       \
-                        asm ("rev %0,%1"                \
-                        : "=r"(ret_) : "r"((u32)(x)));  \
-                        ret_;                           })
-#  endif
-# elif defined(_MSC_VER)
-#  if _MSC_VER>=1300
-#   include <stdlib.h>
-#   pragma intrinsic(_byteswap_uint64,_byteswap_ulong)
-#   define BSWAP8(x)    _byteswap_uint64((u64)(x))
-#   define BSWAP4(x)    _byteswap_ulong((u32)(x))
-#  elif defined(_M_IX86)
-__inline u32 _bswap4(u32 val)
-{
-_asm mov eax, val _asm bswap eax}
-#   define BSWAP4(x)    _bswap4(x)
-#  endif
-# endif
-#endif
-#if defined(BSWAP4) && !defined(STRICT_ALIGNMENT)
-# define GETU32(p)       BSWAP4(*(const u32 *)(p))
-# define PUTU32(p,v)     *(u32 *)(p) = BSWAP4(v)
-#else
-# define GETU32(p)       ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
-# define PUTU32(p,v)     ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
-#endif
-/*- GCM definitions */ typedef struct {
-    u64 hi, lo;
-} u128;
-
-#ifdef  TABLE_BITS
-# undef  TABLE_BITS
-#endif
-/*
- * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
- * never be set to 8 [or 1]. For further information see gcm128.c.
- */
-#define TABLE_BITS 4
-
-struct gcm128_context {
-    /* Following 6 names follow names in GCM specification */
-    union {
-        u64 u[2];
-        u32 d[4];
-        u8 c[16];
-        size_t t[16 / sizeof(size_t)];
-    } Yi, EKi, EK0, len, Xi, H;
-    /*
-     * Relative position of Xi, H and pre-computed Htable is used in some
-     * assembler modules, i.e. don't change the order!
-     */
-#if TABLE_BITS==8
-    u128 Htable[256];
-#else
-    u128 Htable[16];
-    void (*gmult) (u64 Xi[2], const u128 Htable[16]);
-    void (*ghash) (u64 Xi[2], const u128 Htable[16], const u8 *inp,
-                   size_t len);
-#endif
-    unsigned int mres, ares;
-    block128_f block;
-    void *key;
-#if !defined(OPENSSL_SMALL_FOOTPRINT)
-    unsigned char Xn[48];
-#endif
-};
-
-/*
- * The maximum permitted number of cipher blocks per data unit in XTS mode.
- * Reference IEEE Std 1619-2018.
- */
-#define XTS_MAX_BLOCKS_PER_DATA_UNIT            (1<<20)
-
-struct xts128_context {
-    void *key1, *key2;
-    block128_f block1, block2;
-};
-
-struct ccm128_context {
-    union {
-        u64 u[2];
-        u8 c[16];
-    } nonce, cmac;
-    u64 blocks;
-    block128_f block;
-    void *key;
-};
-
-#ifndef OPENSSL_NO_OCB
-
-typedef union {
-    u64 a[2];
-    unsigned char c[16];
-} OCB_BLOCK;
-# define ocb_block16_xor(in1,in2,out) \
-    ( (out)->a[0]=(in1)->a[0]^(in2)->a[0], \
-      (out)->a[1]=(in1)->a[1]^(in2)->a[1] )
-# if STRICT_ALIGNMENT
-#  define ocb_block16_xor_misaligned(in1,in2,out) \
-    ocb_block_xor((in1)->c,(in2)->c,16,(out)->c)
-# else
-#  define ocb_block16_xor_misaligned ocb_block16_xor
-# endif
-
-struct ocb128_context {
-    /* Need both encrypt and decrypt key schedules for decryption */
-    block128_f encrypt;
-    block128_f decrypt;
-    void *keyenc;
-    void *keydec;
-    ocb128_f stream;    /* direction dependent */
-    /* Key dependent variables. Can be reused if key remains the same */
-    size_t l_index;
-    size_t max_l_index;
-    OCB_BLOCK l_star;
-    OCB_BLOCK l_dollar;
-    OCB_BLOCK *l;
-    /* Must be reset for each session */
-    struct {
-        u64 blocks_hashed;
-        u64 blocks_processed;
-        OCB_BLOCK offset_aad;
-        OCB_BLOCK sum;
-        OCB_BLOCK offset;
-        OCB_BLOCK checksum;
-    } sess;
-};
-#endif                          /* OPENSSL_NO_OCB */
-
-#ifndef OPENSSL_NO_SIV
-
-#define SIV_LEN 16
-
-typedef union siv_block_u {
-    uint64_t word[SIV_LEN/sizeof(uint64_t)];
-    unsigned char byte[SIV_LEN];
-} SIV_BLOCK;
-
-struct siv128_context {
-    /* d stores intermediate results of S2V; it corresponds to D from the
-       pseudocode in section 2.4 of RFC 5297. */
-    SIV_BLOCK d;
-    SIV_BLOCK tag;
-    EVP_CIPHER_CTX *cipher_ctx;
-    EVP_MAC *mac;
-    EVP_MAC_CTX *mac_ctx_init;
-    int final_ret;
-    int crypto_ok;
-};
-
-#endif /* OPENSSL_NO_SIV */
diff --git a/crypto/include/internal/objects.h b/crypto/include/internal/objects.h
deleted file mode 100644 (file)
index 7db718f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/objects.h>
-
-void obj_cleanup_int(void);
diff --git a/crypto/include/internal/poly1305.h b/crypto/include/internal/poly1305.h
deleted file mode 100644 (file)
index 46f834e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <stddef.h>
-
-#define POLY1305_BLOCK_SIZE  16
-#define POLY1305_DIGEST_SIZE 16
-#define POLY1305_KEY_SIZE    32
-
-typedef struct poly1305_context POLY1305;
-
-size_t Poly1305_ctx_size(void);
-void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]);
-void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len);
-void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]);
diff --git a/crypto/include/internal/rand_int.h b/crypto/include/internal/rand_int.h
deleted file mode 100644 (file)
index bc427e3..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*
- * Licensed under the Apache License 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * https://www.openssl.org/source/license.html
- * or in the file LICENSE in the source distribution.
- */
-
-#ifndef HEADER_RAND_INT_H
-# define HEADER_RAND_INT_H
-
-# include <openssl/rand.h>
-
-/* forward declaration */
-typedef struct rand_pool_st RAND_POOL;
-
-void rand_cleanup_int(void);
-
-/* Hardware-based seeding functions. */
-size_t rand_acquire_entropy_from_tsc(RAND_POOL *pool);
-size_t rand_acquire_entropy_from_cpu(RAND_POOL *pool);
-
-/* DRBG entropy callbacks. */
-size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
-                             unsigned char **pout,
-                             int entropy, size_t min_len, size_t max_len,
-                             int prediction_resistance);
-void rand_drbg_cleanup_entropy(RAND_DRBG *drbg,
-                               unsigned char *out, size_t outlen);
-size_t rand_drbg_get_nonce(RAND_DRBG *drbg,
-                           unsigned char **pout,
-                           int entropy, size_t min_len, size_t max_len);
-void rand_drbg_cleanup_nonce(RAND_DRBG *drbg,
-                             unsigned char *out, size_t outlen);
-
-size_t rand_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout);
-
-void rand_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out);
-
-/* CRNG test entropy filter callbacks. */
-size_t rand_crngt_get_entropy(RAND_DRBG *drbg,
-                              unsigned char **pout,
-                              int entropy, size_t min_len, size_t max_len,
-                              int prediction_resistance);
-void rand_crngt_cleanup_entropy(RAND_DRBG *drbg,
-                                unsigned char *out, size_t outlen);
-
-/*
- * RAND_POOL functions
- */
-RAND_POOL *rand_pool_new(int entropy_requested, int secure,
-                         size_t min_len, size_t max_len);
-RAND_POOL *rand_pool_attach(const unsigned char *buffer, size_t len,
-                            size_t entropy);
-void rand_pool_free(RAND_POOL *pool);
-
-const unsigned char *rand_pool_buffer(RAND_POOL *pool);
-unsigned char *rand_pool_detach(RAND_POOL *pool);
-void rand_pool_reattach(RAND_POOL *pool, unsigned char *buffer);
-
-size_t rand_pool_entropy(RAND_POOL *pool);
-size_t rand_pool_length(RAND_POOL *pool);
-
-size_t rand_pool_entropy_available(RAND_POOL *pool);
-size_t rand_pool_entropy_needed(RAND_POOL *pool);
-/* |entropy_factor| expresses how many bits of data contain 1 bit of entropy */
-size_t rand_pool_bytes_needed(RAND_POOL *pool, unsigned int entropy_factor);
-size_t rand_pool_bytes_remaining(RAND_POOL *pool);
-
-int rand_pool_add(RAND_POOL *pool,
-                  const unsigned char *buffer, size_t len, size_t entropy);
-unsigned char *rand_pool_add_begin(RAND_POOL *pool, size_t len);
-int rand_pool_add_end(RAND_POOL *pool, size_t len, size_t entropy);
-
-
-/*
- * Add random bytes to the pool to acquire requested amount of entropy
- *
- * This function is platform specific and tries to acquire the requested
- * amount of entropy by polling platform specific entropy sources.
- *
- * If the function succeeds in acquiring at least |entropy_requested| bits
- * of entropy, the total entropy count is returned. If it fails, it returns
- * an entropy count of 0.
- */
-size_t rand_pool_acquire_entropy(RAND_POOL *pool);
-
-/*
- * Add some application specific nonce data
- *
- * This function is platform specific and adds some application specific
- * data to the nonce used for instantiating the drbg.
- *
- * This data currently consists of the process and thread id, and a high
- * resolution timestamp. The data does not include an atomic counter,
- * because that is added by the calling function rand_drbg_get_nonce().
- *
- * Returns 1 on success and 0 on failure.
- */
-int rand_pool_add_nonce_data(RAND_POOL *pool);
-
-
-/*
- * Add some platform specific additional data
- *
- * This function is platform specific and adds some random noise to the
- * additional data used for generating random bytes and for reseeding
- * the drbg.
- *
- * Returns 1 on success and 0 on failure.
- */
-int rand_pool_add_additional_data(RAND_POOL *pool);
-
-/*
- * Initialise the random pool reseeding sources.
- *
- * Returns 1 on success and 0 on failure.
- */
-int rand_pool_init(void);
-
-/*
- * Finalise the random pool reseeding sources.
- */
-void rand_pool_cleanup(void);
-
-/*
- * Control the random pool use of open file descriptors.
- */
-void rand_pool_keep_random_devices_open(int keep);
-
-/* Equivalent of RAND_priv_bytes() but additionally taking an OPENSSL_CTX */
-int rand_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
-
-/* Equivalent of RAND_bytes() but additionally taking an OPENSSL_CTX */
-int rand_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
-
-#endif
diff --git a/crypto/include/internal/sha.h b/crypto/include/internal/sha.h
deleted file mode 100644 (file)
index 3863261..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright (c) 2018, Oracle and/or its affiliates.  All rights reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_INTERNAL_SHA_H
-# define HEADER_INTERNAL_SHA_H
-
-# include <openssl/opensslconf.h>
-
-int sha512_224_init(SHA512_CTX *);
-int sha512_256_init(SHA512_CTX *);
-int sha1_ctrl(SHA_CTX *ctx, int cmd, int mslen, void *ms);
-
-#endif
diff --git a/crypto/include/internal/siphash.h b/crypto/include/internal/siphash.h
deleted file mode 100644 (file)
index 1575141..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <stddef.h>
-
-#define SIPHASH_BLOCK_SIZE        8
-#define SIPHASH_KEY_SIZE         16
-#define SIPHASH_MIN_DIGEST_SIZE   8
-#define SIPHASH_MAX_DIGEST_SIZE  16
-
-typedef struct siphash_st SIPHASH;
-
-size_t SipHash_ctx_size(void);
-size_t SipHash_hash_size(SIPHASH *ctx);
-int SipHash_set_hash_size(SIPHASH *ctx, size_t hash_size);
-int SipHash_Init(SIPHASH *ctx, const unsigned char *k,
-                 int crounds, int drounds);
-void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen);
-int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen);
diff --git a/crypto/include/internal/siv_int.h b/crypto/include/internal/siv_int.h
deleted file mode 100644 (file)
index 8a8ef6e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef OPENSSL_NO_SIV
-
-typedef struct siv128_context SIV128_CONTEXT;
-
-SIV128_CONTEXT *CRYPTO_siv128_new(const unsigned char *key, int klen,
-                                  EVP_CIPHER* cbc, EVP_CIPHER* ctr);
-int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
-                       const EVP_CIPHER* cbc, const EVP_CIPHER* ctr);
-int CRYPTO_siv128_copy_ctx(SIV128_CONTEXT *dest, SIV128_CONTEXT *src);
-int CRYPTO_siv128_aad(SIV128_CONTEXT *ctx, const unsigned char *aad,
-                      size_t len);
-int CRYPTO_siv128_encrypt(SIV128_CONTEXT *ctx,
-                          const unsigned char *in, unsigned char *out,
-                          size_t len);
-int CRYPTO_siv128_decrypt(SIV128_CONTEXT *ctx,
-                          const unsigned char *in, unsigned char *out,
-                          size_t len);
-int CRYPTO_siv128_finish(SIV128_CONTEXT *ctx);
-int CRYPTO_siv128_set_tag(SIV128_CONTEXT *ctx, const unsigned char *tag,
-                          size_t len);
-int CRYPTO_siv128_get_tag(SIV128_CONTEXT *ctx, unsigned char *tag, size_t len);
-int CRYPTO_siv128_cleanup(SIV128_CONTEXT *ctx);
-int CRYPTO_siv128_speed(SIV128_CONTEXT *ctx, int arg);
-
-#endif /* OPENSSL_NO_SIV */
diff --git a/crypto/include/internal/sm2.h b/crypto/include/internal/sm2.h
deleted file mode 100644 (file)
index dad70e6..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright 2017 Ribose Inc. All Rights Reserved.
- * Ported from Ribose contributions from Botan.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_SM2_H
-# define HEADER_SM2_H
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_SM2
-
-#  include <openssl/ec.h>
-
-/* The default user id as specified in GM/T 0009-2012 */
-#  define SM2_DEFAULT_USERID "1234567812345678"
-
-int sm2_compute_z_digest(uint8_t *out,
-                         const EVP_MD *digest,
-                         const uint8_t *id,
-                         const size_t id_len,
-                         const EC_KEY *key);
-
-/*
- * SM2 signature operation. Computes Z and then signs H(Z || msg) using SM2
- */
-ECDSA_SIG *sm2_do_sign(const EC_KEY *key,
-                       const EVP_MD *digest,
-                       const uint8_t *id,
-                       const size_t id_len,
-                       const uint8_t *msg, size_t msg_len);
-
-int sm2_do_verify(const EC_KEY *key,
-                  const EVP_MD *digest,
-                  const ECDSA_SIG *signature,
-                  const uint8_t *id,
-                  const size_t id_len,
-                  const uint8_t *msg, size_t msg_len);
-
-/*
- * SM2 signature generation.
- */
-int sm2_sign(const unsigned char *dgst, int dgstlen,
-             unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
-
-/*
- * SM2 signature verification.
- */
-int sm2_verify(const unsigned char *dgst, int dgstlen,
-               const unsigned char *sig, int siglen, EC_KEY *eckey);
-
-/*
- * SM2 encryption
- */
-int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
-                        size_t *ct_size);
-
-int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
-                       size_t *pt_size);
-
-int sm2_encrypt(const EC_KEY *key,
-                const EVP_MD *digest,
-                const uint8_t *msg,
-                size_t msg_len,
-                uint8_t *ciphertext_buf, size_t *ciphertext_len);
-
-int sm2_decrypt(const EC_KEY *key,
-                const EVP_MD *digest,
-                const uint8_t *ciphertext,
-                size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len);
-
-# endif /* OPENSSL_NO_SM2 */
-#endif
diff --git a/crypto/include/internal/sm2err.h b/crypto/include/internal/sm2err.h
deleted file mode 100644 (file)
index 923bb6c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_SM2ERR_H
-# define HEADER_SM2ERR_H
-
-# include <openssl/opensslconf.h>
-# include <openssl/symhacks.h>
-
-
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_SM2
-
-#  ifdef  __cplusplus
-extern "C"
-#  endif
-int ERR_load_SM2_strings(void);
-
-/*
- * SM2 function codes.
- */
-# if !OPENSSL_API_3
-#   define SM2_F_PKEY_SM2_COPY                              0
-#   define SM2_F_PKEY_SM2_CTRL                              0
-#   define SM2_F_PKEY_SM2_CTRL_STR                          0
-#   define SM2_F_PKEY_SM2_DIGEST_CUSTOM                     0
-#   define SM2_F_PKEY_SM2_INIT                              0
-#   define SM2_F_PKEY_SM2_SIGN                              0
-#   define SM2_F_SM2_COMPUTE_MSG_HASH                       0
-#   define SM2_F_SM2_COMPUTE_USERID_DIGEST                  0
-#   define SM2_F_SM2_COMPUTE_Z_DIGEST                       0
-#   define SM2_F_SM2_DECRYPT                                0
-#   define SM2_F_SM2_ENCRYPT                                0
-#   define SM2_F_SM2_PLAINTEXT_SIZE                         0
-#   define SM2_F_SM2_SIGN                                   0
-#   define SM2_F_SM2_SIG_GEN                                0
-#   define SM2_F_SM2_SIG_VERIFY                             0
-#   define SM2_F_SM2_VERIFY                                 0
-# endif
-
-/*
- * SM2 reason codes.
- */
-#  define SM2_R_ASN1_ERROR                                 100
-#  define SM2_R_BAD_SIGNATURE                              101
-#  define SM2_R_BUFFER_TOO_SMALL                           107
-#  define SM2_R_DIST_ID_TOO_LARGE                          110
-#  define SM2_R_ID_NOT_SET                                 112
-#  define SM2_R_ID_TOO_LARGE                               111
-#  define SM2_R_INVALID_CURVE                              108
-#  define SM2_R_INVALID_DIGEST                             102
-#  define SM2_R_INVALID_DIGEST_TYPE                        103
-#  define SM2_R_INVALID_ENCODING                           104
-#  define SM2_R_INVALID_FIELD                              105
-#  define SM2_R_NO_PARAMETERS_SET                          109
-#  define SM2_R_USER_ID_TOO_LARGE                          106
-
-# endif
-#endif
diff --git a/crypto/include/internal/sm4.h b/crypto/include/internal/sm4.h
deleted file mode 100644 (file)
index f2e1728..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright 2017 Ribose Inc. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_SM4_H
-# define HEADER_SM4_H
-
-# include <openssl/opensslconf.h>
-# include <openssl/e_os2.h>
-
-# ifdef OPENSSL_NO_SM4
-#  error SM4 is disabled.
-# endif
-
-# define SM4_ENCRYPT     1
-# define SM4_DECRYPT     0
-
-# define SM4_BLOCK_SIZE    16
-# define SM4_KEY_SCHEDULE  32
-
-typedef struct SM4_KEY_st {
-    uint32_t rk[SM4_KEY_SCHEDULE];
-} SM4_KEY;
-
-int SM4_set_key(const uint8_t *key, SM4_KEY *ks);
-
-void SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks);
-
-void SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks);
-
-#endif
diff --git a/crypto/include/internal/sparse_array.h b/crypto/include/internal/sparse_array.h
deleted file mode 100644 (file)
index 037ccfe..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_SPARSE_ARRAY_H
-# define HEADER_SPARSE_ARRAY_H
-
-# include <openssl/e_os2.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define SPARSE_ARRAY_OF(type) struct sparse_array_st_ ## type
-
-# define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
-    SPARSE_ARRAY_OF(type); \
-    static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * \
-        ossl_sa_##type##_new(void) \
-    { \
-        return (SPARSE_ARRAY_OF(type) *)OPENSSL_SA_new(); \
-    } \
-    static ossl_unused ossl_inline void ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) *sa) \
-    { \
-        OPENSSL_SA_free((OPENSSL_SA *)sa); \
-    } \
-    static ossl_unused ossl_inline void ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) *sa) \
-    { \
-        OPENSSL_SA_free_leaves((OPENSSL_SA *)sa); \
-    } \
-    static ossl_unused ossl_inline size_t ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) *sa) \
-    { \
-        return OPENSSL_SA_num((OPENSSL_SA *)sa); \
-    } \
-    static ossl_unused ossl_inline void ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) *sa, \
-                                                   void (*leaf)(ossl_uintmax_t, \
-                                                                type *)) \
-    { \
-        OPENSSL_SA_doall((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *))leaf); \
-    } \
-    static ossl_unused ossl_inline \
-    void ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) *sa, \
-                                    void (*leaf)(ossl_uintmax_t, type *, void *), \
-                                    void *arg) \
-    { \
-        OPENSSL_SA_doall_arg((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *, \
-                                                void *))leaf, \
-                             arg); \
-    } \
-    static ossl_unused ossl_inline ctype *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) *sa, \
-                                                  ossl_uintmax_t n) \
-    { \
-        return (type *)OPENSSL_SA_get((OPENSSL_SA *)sa, n); \
-    } \
-    static ossl_unused ossl_inline int ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) *sa, \
-                                                ossl_uintmax_t n, ctype *val) \
-    { \
-        return OPENSSL_SA_set((OPENSSL_SA *)sa, n, (void *)val); \
-    } \
-    SPARSE_ARRAY_OF(type)
-
-# define DEFINE_SPARSE_ARRAY_OF(type) \
-    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
-# define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
-    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
-
-typedef struct sparse_array_st OPENSSL_SA;
-OPENSSL_SA *OPENSSL_SA_new(void);
-void OPENSSL_SA_free(OPENSSL_SA *sa);
-void OPENSSL_SA_free_leaves(OPENSSL_SA *sa);
-size_t OPENSSL_SA_num(const OPENSSL_SA *sa);
-void OPENSSL_SA_doall(const OPENSSL_SA *sa,
-                      void (*leaf)(ossl_uintmax_t, void *));
-void OPENSSL_SA_doall_arg(const OPENSSL_SA *sa,
-                          void (*leaf)(ossl_uintmax_t, void *, void *), void *);
-void *OPENSSL_SA_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
-int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
-
-# ifdef  __cplusplus
-}
-# endif
-#endif
diff --git a/crypto/include/internal/store.h b/crypto/include/internal/store.h
deleted file mode 100644 (file)
index b2e9dbf..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-void ossl_store_cleanup_int(void);
diff --git a/crypto/include/internal/store_int.h b/crypto/include/internal/store_int.h
deleted file mode 100644 (file)
index 67f2526..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_STORE_INT_H
-# define HEADER_STORE_INT_H
-
-# include <openssl/bio.h>
-# include <openssl/store.h>
-# include <openssl/ui.h>
-
-/*
- * Two functions to read PEM data off an already opened BIO.  To be used
- * instead of OSSLSTORE_open() and OSSLSTORE_close().  Everything is done
- * as usual with OSSLSTORE_load() and OSSLSTORE_eof().
- */
-OSSL_STORE_CTX *ossl_store_attach_pem_bio(BIO *bp, const UI_METHOD *ui_method,
-                                          void *ui_data);
-int ossl_store_detach_pem_bio(OSSL_STORE_CTX *ctx);
-
-#endif
diff --git a/crypto/include/internal/x509_int.h b/crypto/include/internal/x509_int.h
deleted file mode 100644 (file)
index 11a7769..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include "internal/refcount.h"
-
-/* Internal X509 structures and functions: not for application use */
-
-/* Note: unless otherwise stated a field pointer is mandatory and should
- * never be set to NULL: the ASN.1 code and accessors rely on mandatory
- * fields never being NULL.
- */
-
-/*
- * name entry structure, equivalent to AttributeTypeAndValue defined
- * in RFC5280 et al.
- */
-struct X509_name_entry_st {
-    ASN1_OBJECT *object;        /* AttributeType */
-    ASN1_STRING *value;         /* AttributeValue */
-    int set;                    /* index of RDNSequence for this entry */
-    int size;                   /* temp variable */
-};
-
-/* Name from RFC 5280. */
-struct X509_name_st {
-    STACK_OF(X509_NAME_ENTRY) *entries; /* DN components */
-    int modified;               /* true if 'bytes' needs to be built */
-    BUF_MEM *bytes;             /* cached encoding: cannot be NULL */
-    /* canonical encoding used for rapid Name comparison */
-    unsigned char *canon_enc;
-    int canon_enclen;
-} /* X509_NAME */ ;
-
-/* Signature info structure */
-
-struct x509_sig_info_st {
-    /* NID of message digest */
-    int mdnid;
-    /* NID of public key algorithm */
-    int pknid;
-    /* Security bits */
-    int secbits;
-    /* Various flags */
-    uint32_t flags;
-};
-
-/* PKCS#10 certificate request */
-
-struct X509_req_info_st {
-    ASN1_ENCODING enc;          /* cached encoding of signed part */
-    ASN1_INTEGER *version;      /* version, defaults to v1(0) so can be NULL */
-    X509_NAME *subject;         /* certificate request DN */
-    X509_PUBKEY *pubkey;        /* public key of request */
-    /*
-     * Zero or more attributes.
-     * NB: although attributes is a mandatory field some broken
-     * encodings omit it so this may be NULL in that case.
-     */
-    STACK_OF(X509_ATTRIBUTE) *attributes;
-};
-
-struct X509_req_st {
-    X509_REQ_INFO req_info;     /* signed certificate request data */
-    X509_ALGOR sig_alg;         /* signature algorithm */
-    ASN1_BIT_STRING *signature; /* signature */
-    CRYPTO_REF_COUNT references;
-    CRYPTO_RWLOCK *lock;
-# ifndef OPENSSL_NO_SM2
-    ASN1_OCTET_STRING *sm2_id;
-# endif
-};
-
-struct X509_crl_info_st {
-    ASN1_INTEGER *version;      /* version: defaults to v1(0) so may be NULL */
-    X509_ALGOR sig_alg;         /* signature algorithm */
-    X509_NAME *issuer;          /* CRL issuer name */
-    ASN1_TIME *lastUpdate;      /* lastUpdate field */
-    ASN1_TIME *nextUpdate;      /* nextUpdate field: optional */
-    STACK_OF(X509_REVOKED) *revoked;        /* revoked entries: optional */
-    STACK_OF(X509_EXTENSION) *extensions;   /* extensions: optional */
-    ASN1_ENCODING enc;                      /* encoding of signed portion of CRL */
-};
-
-struct X509_crl_st {
-    X509_CRL_INFO crl;          /* signed CRL data */
-    X509_ALGOR sig_alg;         /* CRL signature algorithm */
-    ASN1_BIT_STRING signature;  /* CRL signature */
-    CRYPTO_REF_COUNT references;
-    int flags;
-    /*
-     * Cached copies of decoded extension values, since extensions
-     * are optional any of these can be NULL.
-     */
-    AUTHORITY_KEYID *akid;
-    ISSUING_DIST_POINT *idp;
-    /* Convenient breakdown of IDP */
-    int idp_flags;
-    int idp_reasons;
-    /* CRL and base CRL numbers for delta processing */
-    ASN1_INTEGER *crl_number;
-    ASN1_INTEGER *base_crl_number;
-    STACK_OF(GENERAL_NAMES) *issuers;
-    /* hash of CRL */
-    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
-    /* alternative method to handle this CRL */
-    const X509_CRL_METHOD *meth;
-    void *meth_data;
-    CRYPTO_RWLOCK *lock;
-};
-
-struct x509_revoked_st {
-    ASN1_INTEGER serialNumber; /* revoked entry serial number */
-    ASN1_TIME *revocationDate;  /* revocation date */
-    STACK_OF(X509_EXTENSION) *extensions;   /* CRL entry extensions: optional */
-    /* decoded value of CRLissuer extension: set if indirect CRL */
-    STACK_OF(GENERAL_NAME) *issuer;
-    /* revocation reason: set to CRL_REASON_NONE if reason extension absent */
-    int reason;
-    /*
-     * CRL entries are reordered for faster lookup of serial numbers. This
-     * field contains the original load sequence for this entry.
-     */
-    int sequence;
-};
-
-/*
- * This stuff is certificate "auxiliary info": it contains details which are
- * useful in certificate stores and databases. When used this is tagged onto
- * the end of the certificate itself. OpenSSL specific structure not defined
- * in any RFC.
- */
-
-struct x509_cert_aux_st {
-    STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */
-    STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */
-    ASN1_UTF8STRING *alias;     /* "friendly name" */
-    ASN1_OCTET_STRING *keyid;   /* key id of private key */
-    STACK_OF(X509_ALGOR) *other; /* other unspecified info */
-};
-
-struct x509_cinf_st {
-    ASN1_INTEGER *version;      /* [ 0 ] default of v1 */
-    ASN1_INTEGER serialNumber;
-    X509_ALGOR signature;
-    X509_NAME *issuer;
-    X509_VAL validity;
-    X509_NAME *subject;
-    X509_PUBKEY *key;
-    ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */
-    ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */
-    STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */
-    ASN1_ENCODING enc;
-};
-
-struct x509_st {
-    X509_CINF cert_info;
-    X509_ALGOR sig_alg;
-    ASN1_BIT_STRING signature;
-    X509_SIG_INFO siginf;
-    CRYPTO_REF_COUNT references;
-    CRYPTO_EX_DATA ex_data;
-    /* These contain copies of various extension values */
-    long ex_pathlen;
-    long ex_pcpathlen;
-    uint32_t ex_flags;
-    uint32_t ex_kusage;
-    uint32_t ex_xkusage;
-    uint32_t ex_nscert;
-    ASN1_OCTET_STRING *skid;
-    AUTHORITY_KEYID *akid;
-    X509_POLICY_CACHE *policy_cache;
-    STACK_OF(DIST_POINT) *crldp;
-    STACK_OF(GENERAL_NAME) *altname;
-    NAME_CONSTRAINTS *nc;
-# ifndef OPENSSL_NO_RFC3779
-    STACK_OF(IPAddressFamily) *rfc3779_addr;
-    struct ASIdentifiers_st *rfc3779_asid;
-# endif
-    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
-    X509_CERT_AUX *aux;
-    CRYPTO_RWLOCK *lock;
-    volatile int ex_cached;
-# ifndef OPENSSL_NO_SM2
-    ASN1_OCTET_STRING *sm2_id;
-# endif
-} /* X509 */ ;
-
-/*
- * This is a used when verifying cert chains.  Since the gathering of the
- * cert chain can take some time (and have to be 'retried', this needs to be
- * kept and passed around.
- */
-struct x509_store_ctx_st {      /* X509_STORE_CTX */
-    X509_STORE *store;
-    /* The following are set by the caller */
-    /* The cert to check */
-    X509 *cert;
-    /* chain of X509s - untrusted - passed in */
-    STACK_OF(X509) *untrusted;
-    /* set of CRLs passed in */
-    STACK_OF(X509_CRL) *crls;
-    X509_VERIFY_PARAM *param;
-    /* Other info for use with get_issuer() */
-    void *other_ctx;
-    /* Callbacks for various operations */
-    /* called to verify a certificate */
-    int (*verify) (X509_STORE_CTX *ctx);
-    /* error callback */
-    int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
-    /* get issuers cert from ctx */
-    int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
-    /* check issued */
-    int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
-    /* Check revocation status of chain */
-    int (*check_revocation) (X509_STORE_CTX *ctx);
-    /* retrieve CRL */
-    int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
-    /* Check CRL validity */
-    int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
-    /* Check certificate against CRL */
-    int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
-    /* Check policy status of the chain */
-    int (*check_policy) (X509_STORE_CTX *ctx);
-    STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
-    STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
-    int (*cleanup) (X509_STORE_CTX *ctx);
-    /* The following is built up */
-    /* if 0, rebuild chain */
-    int valid;
-    /* number of untrusted certs */
-    int num_untrusted;
-    /* chain of X509s - built up and trusted */
-    STACK_OF(X509) *chain;
-    /* Valid policy tree */
-    X509_POLICY_TREE *tree;
-    /* Require explicit policy value */
-    int explicit_policy;
-    /* When something goes wrong, this is why */
-    int error_depth;
-    int error;
-    X509 *current_cert;
-    /* cert currently being tested as valid issuer */
-    X509 *current_issuer;
-    /* current CRL */
-    X509_CRL *current_crl;
-    /* score of current CRL */
-    int current_crl_score;
-    /* Reason mask */
-    unsigned int current_reasons;
-    /* For CRL path validation: parent context */
-    X509_STORE_CTX *parent;
-    CRYPTO_EX_DATA ex_data;
-    SSL_DANE *dane;
-    /* signed via bare TA public key, rather than CA certificate */
-    int bare_ta_signed;
-};
-
-/* PKCS#8 private key info structure */
-
-struct pkcs8_priv_key_info_st {
-    ASN1_INTEGER *version;
-    X509_ALGOR *pkeyalg;
-    ASN1_OCTET_STRING *pkey;
-    STACK_OF(X509_ATTRIBUTE) *attributes;
-};
-
-struct X509_sig_st {
-    X509_ALGOR *algor;
-    ASN1_OCTET_STRING *digest;
-};
-
-struct x509_object_st {
-    /* one of the above types */
-    X509_LOOKUP_TYPE type;
-    union {
-        char *ptr;
-        X509 *x509;
-        X509_CRL *crl;
-        EVP_PKEY *pkey;
-    } data;
-};
-
-int a2i_ipadd(unsigned char *ipout, const char *ipasc);
-int x509_set1_time(ASN1_TIME **ptm, const ASN1_TIME *tm);
-
-void x509_init_sig_info(X509 *x);
index 355827c4518ae437de9251ec725ff36674f58199..613ddc7d8c3bee544aab6ddb33a878f19c316e51 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <openssl/crypto.h>
-#include "internal/dso_conf.h"
+#include "crypto/dso_conf.h"
 #include "internal/thread_once.h"
 #include "internal/cryptlib.h"
 #include "e_os.h"
index 32162c38745923fd5085519dc0b498ce061d6b9a..4aa3fc83da91495abd4d80082c5afbfd80adcdbe 100644 (file)
@@ -8,25 +8,25 @@
  */
 
 #include "e_os.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include <openssl/err.h>
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "internal/bio.h"
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/conf.h"
-#include "internal/async.h"
-#include "internal/engine.h"
+#include "crypto/async.h"
+#include "crypto/engine.h"
 #include "internal/comp.h"
 #include "internal/err.h"
-#include "internal/err_int.h"
-#include "internal/objects.h"
+#include "crypto/err.h"
+#include "crypto/objects.h"
 #include <stdlib.h>
 #include <assert.h>
 #include "internal/thread_once.h"
-#include "internal/dso_conf.h"
+#include "crypto/dso_conf.h"
 #include "internal/dso.h"
-#include "internal/store.h"
+#include "crypto/store.h"
 #include <openssl/cmp_util.h> /* for OSSL_CMP_log_close() */
 #include <openssl/trace.h>
 
index 7de8a3694519a03338a11ff537d08b76adb0db70..930b94a817d877d860e692dcf463067fccb6cfc2 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/core_numbers.h>
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/providercommon.h"
 #include "internal/thread_once.h"
 
index f91a56a70a6b032a3c0c0de13a9a9d1a95744b9e..65445895f5eed159d31c7ba1c05b8ae4a7df040c 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/crypto.h>
 #include <openssl/lhash.h>
 #include <openssl/err.h>
-#include "internal/ctype.h"
-#include "internal/lhash.h"
+#include "crypto/ctype.h"
+#include "crypto/lhash.h"
 #include "lhash_lcl.h"
 
 /*
index 74e53507a644d25ce1827f8848b7845aee71600f..58c23e1ad6cbb850025c11a0d6d597ac49c9b44d 100644 (file)
@@ -31,7 +31,7 @@ void md4_block_data_order(MD4_CTX *c, const void *p, size_t num);
         } while (0)
 #define HASH_BLOCK_DATA_ORDER   md4_block_data_order
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 /*-
 #define F(x,y,z)        (((x) & (y))  |  ((~(x)) & (z)))
index 73ba4d6ccd923a26e089ccffdeb032ab579dda05..8571e4848e91054643877df9c863005693e3010f 100644 (file)
@@ -42,7 +42,7 @@ void md5_block_data_order(MD5_CTX *c, const void *p, size_t num);
         } while (0)
 #define HASH_BLOCK_DATA_ORDER   md5_block_data_order
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 /*-
 #define F(x,y,z)        (((x) & (y))  |  ((~(x)) & (z)))
index 562d6b51e2b34511111517036da876ca2545c5b9..d3cac29b21f3ea4e81b7e7ab23f5ada93f0dddb5 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "e_os.h"
 #include "internal/cryptlib.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
index eb8e06c11de1c74be1746160a4c990d590a613f2..eec44bd91a5b1018becd151664a1538a0f4c88d6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 #if !defined(STRICT_ALIGNMENT) && !defined(PEDANTIC)
 # define STRICT_ALIGNMENT 0
index e97158a11962f5a192fb79323cd2020076cf60d1..1ffd6df46f742f82bec8425187c24050836f653b 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 /*
  * First you setup M and L parameters and pass the key schedule. This is
index 39644a237ee034da7c426368b8a10709adfe055e..e9ce4df3a50486c70134dd8b8b81e5eba132dd73 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 /*
  * The input and output encrypted as though 128bit cfb mode is being used.
index 1755b8500efb53e98947b46af6c96021739ded09..ff7499b34a653ef5a84d80c6fea092b372b327e8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 /*
  * NOTE: the IV/counter CTR mode is big-endian.  The code itself is
index b4f2f37775cb49150df409aa5d02e5e16e804201..5600d9c54b1b31f565bba080ff54a118d996cddd 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 /*
  * Trouble with Ciphertext Stealing, CTS, mode is that there is no
index f37653be6727bf34eaffe4544d96c4875edf810c..d2f2da61b3b4b2b3e69dbfe5ab42f03dcd19b057 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 #if defined(BSWAP4) && defined(STRICT_ALIGNMENT)
 /* redefine, because alignment is ensured */
index 9e7af6074ff6497e10ef7d21fae9d3299833e350..7886700533102a54a1424d744e1f58b88c78fc27 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include <openssl/err.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 #ifndef OPENSSL_NO_OCB
 
index b894cbb5c18e431f56103c4c08615977d133d527..2eca09bc1b03f928813729e44c7ede4a1d623bc9 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 /*
  * The input and output encrypted as though 128bit ofb mode is being used.
index 1d91ee78ee08b0098277bf0a45b960fb017fd02a..712141032db578461b321674ccd92449f760a899 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/evp.h>
 #include <openssl/core_names.h>
 #include <openssl/params.h>
-#include "internal/modes_int.h"
-#include "internal/siv_int.h"
+#include "crypto/modes.h"
+#include "crypto/siv.h"
 
 #ifndef OPENSSL_NO_SIV
 
index 03b83aa0ed9508bcd5a298778c3a7cca448e7e0f..9d9b65caa544b2b539afa5fba9da8ff373423aeb 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 
 int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
                           const unsigned char iv[16],
index 3ad905c939fd1a675ef9fb62f470b64fbee9e661..531f5247581689ad67b20bd4b7cacccb72c5c18a 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/safestack.h>
 #include <openssl/e_os2.h>
 #include "internal/thread_once.h"
-#include "internal/lhash.h"
+#include "crypto/lhash.h"
 #include "obj_lcl.h"
 #include "e_os.h"
 
index c4155a3dfc79b3e6abc13b4cce38381de6d091c8..1c3fe9eb5d4a52dbeb64a8a6e8ee800c74ad0f84 100644 (file)
@@ -8,14 +8,14 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <limits.h>
 #include "internal/cryptlib.h"
 #include <openssl/lhash.h>
 #include <openssl/asn1.h>
-#include "internal/objects.h"
+#include "crypto/objects.h"
 #include <openssl/bn.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include "obj_lcl.h"
 
 /* obj_dat.h is generated from objects.h by obj_dat.pl */
index 5dfe7c5b95185765745b27f00f756ed8e7e4c8c5..08266141e23b06bc5c6dad3e6a77b4361418bee3 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
 {
index 17f792c2b11483ea295ec5f98ba4866a07583b21..c75bfdb403672ec54e0ce41660fda9f293865aee 100644 (file)
@@ -10,7 +10,7 @@
 #include "e_os.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <string.h>
 #include <openssl/asn1.h>
 #include <openssl/ocsp.h>
index b33ab16266f75ad6f617f4e4cc062392ab2bf424..eb07c884e72aadd62271ada1ba3413cc5f163151 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <string.h>
 #include "internal/cryptlib.h"
 #include <openssl/buffer.h>
@@ -18,7 +18,7 @@
 #include <openssl/x509.h>
 #include <openssl/pem.h>
 #include <openssl/pkcs12.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include <openssl/des.h>
 #include <openssl/engine.h>
 
index ffcec127711a722d41f7c8358243d8195f0ba179..54596e4093436b2cba2d176c19c15204b29b4e9e 100644 (file)
@@ -17,8 +17,8 @@
 #include <openssl/pem.h>
 #include <openssl/engine.h>
 #include <openssl/dh.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 int pem_check_suffix(const char *pem_str, const char *suffix);
 
index 3b7a8436ed3cd8169b703ecc067aa0916f8ffb16..b9b34c249581226cf20ee5d1fc5909c1a983dafc 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/pkcs12.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
                         const char *pass, int passlen,
index 181fb5a5a19a0edd6096a123026cfc60fc90b5e1..815ac8683af9108e16f4521d066a54dcdcff5bef 100644 (file)
@@ -11,8 +11,8 @@
 #include "internal/cryptlib.h"
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 
 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
 {
index b83a4fc1cacec7788318214e427c13dce386ccb4..31bca781caf1ae503923992e97c3cf5e010b24dd 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 
-#include "internal/poly1305.h"
+#include "crypto/poly1305.h"
 #include "poly1305_local.h"
 
 size_t Poly1305_ctx_size(void)
index 73903635eacb5bbb8d419d520bf9de9dd144d403..d69607c7bb6c1ed9a9cd8b2c7604ec94a41ee5e7 100644 (file)
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
-#include "internal/poly1305.h"
+#include "crypto/asn1.h"
+#include "crypto/poly1305.h"
 #include "poly1305_local.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 /*
  * POLY1305 "ASN1" method. This is just here to indicate the maximum
index e540db14417134f24fe70dfeb14329868dd3fa8b..5b3ee754b293841ec6542f2d4a34dc3c29ee8113 100644 (file)
@@ -29,7 +29,7 @@
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
 #include <internal/cryptlib.h>
-#include <internal/chacha.h>
+#include <crypto/chacha.h>
 #include "bn/bn_lcl.h"
 
 #include "ppc_arch.h"
index e94c5de87dc53e608d0e0e2c9e2b27b50500d408..4f67207a791bdbf47666c223319ed2f88724613a 100644 (file)
 #include <stdarg.h>
 #include <openssl/crypto.h>
 #include "internal/property.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <openssl/lhash.h>
 #include <openssl/rand.h>
 #include "internal/thread_once.h"
-#include "internal/lhash.h"
-#include "internal/sparse_array.h"
+#include "crypto/lhash.h"
+#include "crypto/sparse_array.h"
 #include "property_lcl.h"
 
 /* The number of elements in the query cache before we initiate a flush */
index c17b0ddefc33639daaa39aad46c87180ba06ec45..c9fb7602fd498155ed7bf6689d986fcc40a2f66d 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/err.h>
 #include "internal/propertyerr.h"
 #include "internal/property.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/nelem.h"
 #include "property_lcl.h"
 #include "e_os.h"
index dcf5dcc2a44d952821364ba4fa809d20b7fc206b..d037f6a311d82c66088abc50073b9336a5d26d0c 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include <openssl/lhash.h>
-#include "internal/lhash.h"
+#include "crypto/lhash.h"
 #include "property_lcl.h"
 
 /*
index f8a002aa16fc1fb9bf6ff80da8d667647b066a34..4f3123d672ccaed218c8fa2c69d0de37de6f202e 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/core_names.h>
 #include <openssl/params.h>
 #include <openssl/opensslv.h>
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 #include "internal/nelem.h"
 #include "internal/thread_once.h"
 #include "internal/provider.h"
index bce2f74e9a3971821beb2d7a1b818401db271b3d..56525265684d5625a4c73d18b96a933d28368064 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/rand.h>
 #include "rand_lcl.h"
 #include "internal/thread_once.h"
-#include "internal/rand_int.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/rand.h"
+#include "crypto/cryptlib.h"
 
 /*
  * Support framework for NIST SP 800-90A DRBG
index 0ba0986b96ccc95e08fdae912454257e13accfe7..29af636f5375f7dbabbb4af2c65cea89628155b7 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <string.h>
 #include <openssl/evp.h>
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "internal/thread_once.h"
 #include "internal/cryptlib.h"
 #include "rand_lcl.h"
index 0c92d75666fc20a6bc195b1a4b27c99a2f36f804..0f8a81f311045c39868915fd243642059230d1e6 100644 (file)
@@ -17,7 +17,7 @@
 # include <openssl/ec.h>
 # include <openssl/rand_drbg.h>
 # include "internal/tsan_assist.h"
-# include "internal/rand_int.h"
+# include "crypto/rand.h"
 
 # include "internal/numbers.h"
 
index b70b60a6508ddcc4c4c893b3420077267af4390e..7f4f1b7f9086eb97884a3909fa2d88ac7d20af10 100644 (file)
@@ -11,7 +11,7 @@
 #include <time.h>
 #include "internal/cryptlib.h"
 #include <openssl/opensslconf.h>
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include <openssl/engine.h>
 #include "internal/thread_once.h"
 #include "rand_lcl.h"
index 8641badbff81ee6592afed516f03fdee9a098d1a..c0f995a166054d09d1a68230abaa0fbcbd299e7b 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/rand.h>
 #include <openssl/crypto.h>
 #include "rand_lcl.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include <stdio.h>
 #include "internal/dso.h"
 #ifdef __linux
index 3f13529d0f63e276a6c9f95498b4ee2f2b445564..5fb225915884491eca8902cdc09b37340a5dfdbd 100644 (file)
@@ -14,7 +14,7 @@
 # include <unistd.h>
 # include "internal/cryptlib.h"
 # include <openssl/rand.h>
-# include "internal/rand_int.h"
+# include "crypto/rand.h"
 # include "rand_lcl.h"
 # include <descrip.h>
 # include <dvidef.h>
index 81774e097d9938615245dbc0e62baa5bd2889f5d..a32cf45bb9458a7d2edfd28e213e8ef7df9f892c 100644 (file)
@@ -14,7 +14,7 @@ NON_EMPTY_TRANSLATION_UNIT
 #else
 # include <openssl/rand.h>
 # include "rand_lcl.h"
-# include "internal/rand_int.h"
+# include "crypto/rand.h"
 # include "internal/cryptlib.h"
 # include <version.h>
 # include <taskLib.h>
index 38852dc7a080c4809aafc016f78ec96cdcf25a0f..ea0d53b8adf1731acba3e4ea1467abc592797a19 100644 (file)
@@ -10,7 +10,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include "rand_lcl.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
 
 # ifndef OPENSSL_RAND_SEED_OS
index 361e21b940276cfdd88d858adc9caa4c2198e938..bb4feb969a3e0fe2ca9bcbf25fcb8588f922487d 100644 (file)
@@ -42,7 +42,7 @@ void ripemd160_block_data_order(RIPEMD160_CTX *c, const void *p, size_t num);
         } while (0)
 #define HASH_BLOCK_DATA_ORDER   ripemd160_block_data_order
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 /*
  * Transformed F2 and F4 are courtesy of Wei Dai
index bf56039b468d4dcfd05c282cefc00b9c5e9581c6..7b1c955870e49b0984f33ce0bcb2d03fd62f62c8 100644 (file)
@@ -13,8 +13,8 @@
 #include <openssl/x509.h>
 #include <openssl/bn.h>
 #include <openssl/cms.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
 #include "rsa_locl.h"
 
 #ifndef OPENSSL_NO_CMS
index c35ad9f54581b67e8e4a5cab345694642e0e6abb..4933982cddd788e5c87c475490a34286eed6f5b5 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include <openssl/rand.h>
 #include "rsa_locl.h"
 
index c6e570089fd1b722bf964f67f4d6eda241172dc6..83e6a35e42a6ed1f90f2a7494708c2a4a4072fa3 100644 (file)
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
 #include "internal/refcount.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include <openssl/engine.h>
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "rsa_locl.h"
 
 RSA *RSA_new(void)
index 5d5efdbd69db4ca999308d4a42e402035e4f3c48..54171de2f30e954fed7ee8f0e83fd90f39c7d026 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "internal/cryptlib.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "rsa_locl.h"
 #include "internal/constant_time_locl.h"
 
index 993c2cea4b65054250fb4d3f7e9fbe0af06e597c..dfbf00cb55fc0b3cbc602d38937bd9c21727028b 100644 (file)
@@ -18,7 +18,7 @@
 #include <openssl/evp.h>
 #include <openssl/x509v3.h>
 #include <openssl/cms.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "rsa_locl.h"
 
 /* RSA pkey context structure */
index 73811e7bfc3e51cebae69bb2c0c3d3306212aebe..07b18ed8bbe991f5d9486986ffcda4fd5828f433 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/rsa.h>
 #include <openssl/objects.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "rsa_locl.h"
 
 /* Size of an SSL signature: MD5+SHA1 */
index 10e264e5914b2a2cc30e5c5f4e27f8b1642e9abd..36d946de4e7116a50c50a7c3261c817124a1974d 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <openssl/err.h>
 #include <openssl/bn.h>
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "rsa_locl.h"
 
 /*
index 50c5bf14bea20aa65733add915e740303d565660..73c9c1d150120cd38df45668bb8f06f659a50022 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <openssl/err.h>
 #include <openssl/bn.h>
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 #include "rsa_locl.h"
 
 #define RSA_FIPS1864_MIN_KEYGEN_KEYSIZE 2048
index 64de9d0168547ea80e8af6044559e7988fe465cc..eb00a4a7bd3617976d1243653b0a9ea1bb4e6d78 100644 (file)
@@ -13,7 +13,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include "internal/cryptlib.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "s390x_arch.h"
 
 #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
index 4881bcb17a02c69425287d0b9af88356a5f1fafb..563ddbd1d02b3d0c7c696bc85cdade9fbeeac9f8 100644 (file)
@@ -17,7 +17,7 @@
 /* The implementation is in ../md32_common.h */
 
 #include "sha_locl.h"
-#include "internal/sha.h"
+#include "crypto/sha.h"
 
 int sha1_ctrl(SHA_CTX *sha1, int cmd, int mslen, void *ms)
 {
index 328c0f17c376639c6e3914d708e3c1daae47160d..99833924b0684a5d23200616f585de14518e05ce 100644 (file)
@@ -128,7 +128,7 @@ static
 #endif
 void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num);
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 #ifndef SHA256_ASM
 static const SHA_LONG K256[64] = {
index 7b6d7496d08cb0578af8df3e1642acd0ff12ba96..03189a9d9c4420d36bdd7d31e7b5d01241adf0be 100644 (file)
@@ -50,7 +50,7 @@
 #include <openssl/opensslv.h>
 
 #include "internal/cryptlib.h"
-#include "internal/sha.h"
+#include "crypto/sha.h"
 
 #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
     defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \
index d615e58491f06e29b63f7db4f5e29513e972fe30..f7c0ac707b2ceaee3ad79c76e29faecbeb9993a6 100644 (file)
@@ -42,7 +42,7 @@ static void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num);
 void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num);
 #endif
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 #define INIT_DATA_h0 0x67452301UL
 #define INIT_DATA_h1 0xefcdab89UL
index 9d91178455ef2089e636aebf445af3b4de16892f..03f9b4982d4b70ed809c6916e3fa80e3c931cec0 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 
-#include "internal/siphash.h"
+#include "crypto/siphash.h"
 #include "siphash_local.h"
 
 /* default: SipHash-2-4 */
index ba7679db3515f5d69220e4c2f1075ae3f8164ed9..5aa4d88915db30946696cb605994703dc4ca28e8 100644 (file)
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
-#include "internal/asn1_int.h"
-#include "internal/siphash.h"
+#include "crypto/asn1.h"
+#include "crypto/siphash.h"
 #include "siphash_local.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 /*
  * SIPHASH "ASN1" method. This is just here to indicate the maximum
index d5442107572ae81831c5bd5a90fc18c54fd42155..102f02651a5624558c8a3e1d3a3b34e2d5a21427 100644 (file)
@@ -9,9 +9,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/sm2.h"
-#include "internal/sm2err.h"
-#include "internal/ec_int.h" /* ecdh_KDF_X9_63() */
+#include "crypto/sm2.h"
+#include "crypto/sm2err.h"
+#include "crypto/ec.h" /* ecdh_KDF_X9_63() */
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/bn.h>
index d8e11790565c7c521cb1e5bae66aafbf3b822c1f..93ee9f7d7af1fa36dcfc0d0efd532c1e0aad1633 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <openssl/err.h>
-#include "internal/sm2err.h"
+#include "crypto/sm2err.h"
 
 #ifndef OPENSSL_NO_ERR
 
index 7613e333eccb20c6c0935adfcb9ec283b9bc9f11..27bec2cb06da118f6d815485e312532a4aa09ecc 100644 (file)
@@ -11,9 +11,9 @@
 #include <openssl/asn1t.h>
 #include <openssl/ec.h>
 #include <openssl/evp.h>
-#include "internal/evp_int.h"
-#include "internal/sm2.h"
-#include "internal/sm2err.h"
+#include "crypto/evp.h"
+#include "crypto/sm2.h"
+#include "crypto/sm2err.h"
 
 /* EC pkey context structure */
 
index 38e556241c2a91536483d32f46161bef3eb7d6f8..318e9818020a2609671636e9ccaeafb4ca0513b1 100644 (file)
@@ -9,9 +9,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/sm2.h"
-#include "internal/sm2err.h"
-#include "internal/ec_int.h" /* ec_group_do_inverse_ord() */
+#include "crypto/sm2.h"
+#include "crypto/sm2err.h"
+#include "crypto/ec.h" /* ec_group_do_inverse_ord() */
 #include "internal/numbers.h"
 #include <openssl/err.h>
 #include <openssl/evp.h>
index 38ddbfe372e1df19c341b7efd3f9f0810a401a21..4bccaaf1dc823e83f47e6b9163b129871c804286 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OPENSSL_NO_SM3
 # include <openssl/evp.h>
 # include "internal/sm3.h"
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index a5b79623e945cd76ee5b6bbd2c65c71be2b68977..07def19cf1cfc28e7574c4b3e26e8f552707b72a 100644 (file)
@@ -37,7 +37,7 @@
 void sm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
 void sm3_transform(SM3_CTX *c, const unsigned char *data);
 
-#include "internal/md32_common.h"
+#include "crypto/md32_common.h"
 
 #define P0(X) (X ^ ROTATE(X, 9) ^ ROTATE(X, 17))
 #define P1(X) (X ^ ROTATE(X, 15) ^ ROTATE(X, 23))
index c0454d137ad96b0d0cf508fbae512ece937f261a..a62993c272bfd6f6813db30cb0424a38a66f15e0 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #include <openssl/e_os2.h>
-#include "internal/sm4.h"
+#include "crypto/sm4.h"
 
 static const uint8_t SM4_S[256] = {
     0xD6, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2,
index a74db5d218e37181cf678726d07e3ddfe56852f0..9d444739f53ab8c4098a14fab58ee03c4007b37a 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
-#include "internal/sparse_array.h"
+#include "crypto/sparse_array.h"
 
 /*
  * How many bits are used to index each level in the tree structure?
index 8cba189ef3b88b4c5607ed572a5bc822197ab215..99511954d79f5af2a6a82ec92b39e54961d9f1d0 100644 (file)
@@ -16,7 +16,7 @@
 # include <openssl/sha.h>
 # include <openssl/srp.h>
 # include <openssl/evp.h>
-# include "internal/bn_srp.h"
+# include "crypto/bn_srp.h"
 
 /* calculate = SHA1(PAD(x) || PAD(y)) */
 
index 79e76c9aa90f08753b374612a731a3837acf67e4..c4dd5153f25456157dd4ff66b85a2db6686f5909 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifndef OPENSSL_NO_SRP
 # include "internal/cryptlib.h"
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include <openssl/sha.h>
 # include <openssl/srp.h>
 # include <openssl/evp.h>
index 206af12af6a255c15ba0ce20a5088d5440ae4afc..88302e58f324b0b04125d4e7bd125584fe6d0e03 100644 (file)
 #include <openssl/store.h>
 #include <openssl/ui.h>
 #include <openssl/x509.h>        /* For the PKCS8 stuff o.O */
-#include "internal/asn1_int.h"
-#include "internal/ctype.h"
+#include "crypto/asn1.h"
+#include "crypto/ctype.h"
 #include "internal/o_dir.h"
 #include "internal/cryptlib.h"
-#include "internal/store_int.h"
+#include "crypto/store.h"
 #include "store_locl.h"
 
 #ifdef _WIN32
index db050c07ccaeb3e8700137c3fcc988c449eab593..c5d8cc456ee8e308150faaf363033a687e6e30af 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <openssl/err.h>
-#include "internal/store.h"
+#include "crypto/store.h"
 #include "store_locl.h"
 
 static CRYPTO_ONCE store_init = CRYPTO_ONCE_STATIC_INIT;
index 8c55c431c12374720c975c97f67829750fae9990..2d3b307e04d69aaaac42810e77a848672d351a9e 100644 (file)
@@ -18,7 +18,7 @@
 #include <openssl/err.h>
 #include <openssl/store.h>
 #include "internal/thread_once.h"
-#include "internal/store_int.h"
+#include "crypto/store.h"
 #include "store_locl.h"
 
 struct ossl_store_ctx_st {
index 3022e368c6953e734558665d97c0f9568ef44c57..8cd57836a9534970c51730de5cbb33895fdbdf80 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <string.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <assert.h>
 
 #include <openssl/err.h>
index cc99fff37c653528ceb7458390d2b2ffdb5e6cae..7ff6af88370977213e6a6d6de089d3a6829b04c3 100755 (executable)
@@ -16,7 +16,7 @@
 #include <openssl/trace.h>
 #include "internal/bio.h"
 #include "internal/nelem.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 
 #include "e_os.h"                /* strcasecmp for Windows */
 
index 7791fc73c896ddac2c734bf535a79d70a1171656..74fa93d05e67a054abd23f14da4f8a55363c6d0a 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/pkcs7.h>
 #include <openssl/crypto.h>
 #include "ts_lcl.h"
-#include "internal/ess_int.h"
+#include "crypto/ess.h"
 
 static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *);
 static int def_time_cb(struct TS_resp_ctx *, void *, long *sec, long *usec);
index e658354eb37b97ce30db037ce67c2f3ede1b4cc5..0b6ea1ed623109d560602a7a6f4d2860282d345b 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/ts.h>
 #include <openssl/pkcs7.h>
 #include "ts_lcl.h"
-#include "internal/ess_int.h"
+#include "crypto/ess.h"
 
 static int ts_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
                           X509 *signer, STACK_OF(X509) **chain);
index e53b9b44a6b41cca0a3c8f94b4f9dd2fe9792a3a..720a4b9f551dda19a042008a527e8e056b398dd0 100644 (file)
@@ -19,7 +19,7 @@
 #endif
 
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "x509_lcl.h"
 
 struct lookup_dir_hashes_st {
index 21a89e62c09594d686b26ca1a4aaf5cfcd5305ec..56d3401ffbd21264b15dfc2d90aff23d8cc8761d 100644 (file)
@@ -10,7 +10,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 #include "pcy_int.h"
 
index 243d6e2b7c4e897a9d30230f8b1b53819d8f72e8..ec72dbd33b3dc28a9b46ce0d8a05e60e47182bce 100644 (file)
@@ -10,7 +10,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 #include "pcy_int.h"
 
index 3367228829d0b0647f2134736b3abb22e3c2b0bd..4969bb34bf2decaf6cc0b7f11518846f637393e5 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 
 #ifndef OPENSSL_NO_STDIO
 int X509_print_fp(FILE *fp, X509 *x)
index 9e6bffed280a2171e857395be7a02d3bc768dd70..a33dd9990dae86bc2488f1655c43d4d640ae676c 100644 (file)
@@ -20,7 +20,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/buffer.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "ext_dat.h"
 
 #ifndef OPENSSL_NO_RFC3779
index 2287675005b3e65323d30e47e4d3a3e2d3fe0656..dfd48f73319d47e7bf11da2c2b3b6a2b3a997ac0 100644 (file)
@@ -20,7 +20,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/bn.h>
 #include "ext_dat.h"
 
index b7b74c4f255cb8b39cebef24533b095d674309a4..47b1cfc90b44ba01ad133dc417397bb9fa610a27 100644 (file)
 /* extension creation utilities */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/x509v3.h>
 
 static int v3_check_critical(const char **value);
index 766bf0e5c88c79910dbf85dc7cd7177ec84177a1..c3517b817c33395ff0b5889c1c40be45431df157 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
 
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "ext_dat.h"
 
 static void *v2i_crld(const X509V3_EXT_METHOD *method,
index 9a8ca16685dd51f23a52022a8732b88ac782b143..3be0c05fceb5d9ab6e0a136d606e7029a0efa7b2 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include <stdio.h>
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
 #include <openssl/bn.h>
 
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "ext_dat.h"
 
 static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
index 40f976bdda505321b6f9aa69e111836589f9eee1..3248e286aeebb70c8a064f27c5dd3c889df9ebf1 100644 (file)
@@ -12,7 +12,7 @@
 #include "internal/numbers.h"
 #include <openssl/x509v3.h>
 #include <openssl/x509_vfy.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "internal/tsan_assist.h"
 
 static void x509v3_cache_extensions(X509 *x);
index f8a780d916f467c72801da8d1d3707d1b27f9e75..c69975f6af3fa7d11ce1c08877c9207680206168 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "ext_dat.h"
 
 static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
index 24f50a13b7ffc4d5ac501cf1b8377f6e7dd68d6b..1516d988f090319c449356001292663203b79e5e 100644 (file)
 #include "e_os.h"
 #include "internal/cryptlib.h"
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include <openssl/conf.h>
 #include <openssl/crypto.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/bn.h>
 #include "ext_dat.h"
 
index d7bbbc1947afd5ffe5be6ae919708b64e99d8376..f208cd6a0427cab98b904afea1049912c52dd2a2 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
 {
index e13be607dfd9b23c9970f224ff3b95f878eae201..a7b85857bdadce603d1524f9d443affe1da8f5d4 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/x509v3.h>
 
 int X509_CRL_get_ext_count(const X509_CRL *x)
index c81a00e0a7d8daac53ce7da7d13d437fd3d1470e..f6404d59e9dda7f74527b68e024d98e9d67e780e 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include "internal/refcount.h"
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/x509v3.h>
 #include "x509_lcl.h"
 
index cb16de1f71ccb649177fa5fbaa8032fb1f0d349a..9d8f48d2ee19850e6a74039385d97920c742f604 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/buffer.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 /*
  * Limit to ensure we don't overflow: much greater than
index c45043a72ee8ce6668a075ba1f615fcebc0795ae..d7dd3754f5bdc62c363884f7013217265e81c19c 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/evp.h>
 #include <openssl/asn1.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
 
index b0176bc90b4ee5f4d3b9a7b1e09dd6c8696c6e40..9382f37a8a467d0a6a01bd22346b315914288e64 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/objects.h>
 #include <openssl/buffer.h>
 #include <openssl/pem.h>
index 3dfe66440aa9b2d78061b9d8be32dc2455b653ad..66cf91fc3b0195104ba7af076c718197894885ad 100644 (file)
@@ -15,8 +15,8 @@
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/asn1_int.h"
-#include "internal/x509_int.h"
+#include "crypto/asn1.h"
+#include "crypto/x509.h"
 #include "x509_lcl.h"
 
 int X509_set_version(X509 *x, long version)
index 2347e559388d61544d54259c7f3192ff34d5f7da..b6a45acbcd90e491401e0dfc62bd81cc3f4b4b5d 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 static int tr_cmp(const X509_TRUST *const *a, const X509_TRUST *const *b);
 static void trtable_free(X509_TRUST *p);
index f337cd14cb534ab6206f13b6c5a3b605003bde25..0dd9772c101d1ccd75c8be5fe7b8d4110a61c4ee 100644 (file)
@@ -12,7 +12,7 @@
 #include <errno.h>
 #include <limits.h>
 
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
@@ -22,7 +22,7 @@
 #include <openssl/x509v3.h>
 #include <openssl/objects.h>
 #include "internal/dane.h"
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include "x509_lcl.h"
 
 /* CRL score values */
index 5fe0754e96f4f68dd6937b47f970d154d540ef1e..c681dbaa651d3fb8c649bb1d9f8fa18665908f95 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/buffer.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 #include "x509_lcl.h"
 
index ae447aa98f857954841d11ba093d0b69557fd34d..f1992ddcf042ba601b4e68d6a26441523ba7f341 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 int X509_CRL_set_version(X509_CRL *x, long version)
 {
index bf01450a1ce051e9bfc882124f4d76a00d1662e8..443ab42bddaed44b4d150fbe3c16aee16cf35b0b 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len)
 {
index 592466316d525014c94a0fdacb28da41be9eb075..3256ec2304a48bb367f47e6e428a190d3dab8553 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 int X509_REQ_set_version(X509_REQ *x, long version)
 {
index 392f47e8dc8d99190693d5770d0ebfbb7de68f9f..43b29d3bc67992fcce34f5c8b311f4bd7059e09b 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/asn1.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/ocsp.h>
 #include <openssl/rsa.h>
 #include <openssl/dsa.h>
@@ -21,8 +21,8 @@
 
 #ifndef OPENSSL_NO_SM2
 
-# include "internal/asn1_int.h"
-# include "internal/evp_int.h"
+# include "crypto/asn1.h"
+# include "crypto/evp.h"
 
 static int common_verify_sm2(void *data, EVP_PKEY *pkey,
                              int mdnid, int pknid, int req)
index 3984f0147f2c59c5b976c0cc6ae0b9328803971f..d06eb69a5bc7dc0aed22351d4e013477a0ec21b4 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 #include <openssl/x509v3.h>
 #include "x509_lcl.h"
 
index 8fd6566b0194fee52cef55f733765b5c7a9b8eac..93ba9555bec92792b8ec26e2c889131c5255362d 100644 (file)
@@ -8,12 +8,12 @@
  */
 
 #include <stdio.h>
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
-#include "internal/asn1_int.h"
+#include "crypto/x509.h"
+#include "crypto/asn1.h"
 #include "x509_lcl.h"
 
 /*
index d81f53844f375dfd8da78e5165a9817307180da2..6e8540835f662b912ede306c18cca1b88efc9c02 100644 (file)
@@ -11,9 +11,9 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/asn1_int.h"
-#include "internal/evp_int.h"
-#include "internal/x509_int.h"
+#include "crypto/asn1.h"
+#include "crypto/evp.h"
+#include "crypto/x509.h"
 #include <openssl/rsa.h>
 #include <openssl/dsa.h>
 
index 5bda794a8248063f99bb24ca6fc8eb620149c85e..e9cc9ba41c140ce7caecfaea84fbab64d3b281f3 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 /*-
  * X509_REQ_INFO is handled in an unusual way to get round
index d91c2d24da1c59ad563fcb953e12a0e41fe57058..7b41ce0777f66b885412622dd93ae6beeb639c1b 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
         ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
index a29d3dfce896704c5e5169cdeb215d90ce1453b8..18d09e300e871869613ea69a798a23fe517dec67 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/evp.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
 
 /*
  * X509_CERT_AUX routines. These are used to encode additional user
index 60695266a76d5f074e79010b134aa55fb66dddff..8617c975813e1866024089d8ea1efa2e468d849c 100644 (file)
@@ -11,7 +11,7 @@ ossl_sa_TYPE_doall_arg, ossl_sa_TYPE_get, ossl_sa_TYPE_set
 
 =for comment generic
 
- #include "internal/sparse_array.h"
+ #include "crypto/sparse_array.h"
 
  typedef struct sparse_array_st OPENSSL_SA;
 
index 72b766fb9333de8b77ed71b9c974022ba938e6b9..2cb40940b480970775280f028a4d610cca6207f5 100644 (file)
@@ -8,7 +8,7 @@ evp_keymgmt_clear_pkey_cache
 
 =head1 SYNOPSIS
 
- #include "internal/evp_int.h"
+ #include "crypto/evp.h"
 
  void *evp_keymgmt_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
  void evp_keymgmt_clear_pkey_cache(EVP_PKEY *pk);
index 597c34b6d4daae1b4631344dbf277db1b7f6624d..8be73aee81cdbdf103524ef515648f6d5748f360 100644 (file)
@@ -14,7 +14,7 @@ evp_keymgmt_importkey_types, evp_keymgmt_exportkey_types
 
 =head1 SYNOPSIS
 
- #include "internal/evp_int.h"
+ #include "crypto/evp.h"
 
  void *evp_keymgmt_importdomparams(const EVP_KEYMGMT *keymgmt,
                                 const OSSL_PARAM params[]);
index ccfb4197316bc0f09fdd0371adabae71f955e468..923b52547726e34813f62eda28d702c1ae48ba83 100644 (file)
@@ -9,7 +9,7 @@ ossl_init_thread_deregister
 
 =head1 SYNOPSIS
 
- #include "internal/cryptlib_int.h"
+ #include "crypto/cryptlib.h"
  #include <openssl/core.h>
 
  typedef void (*OSSL_thread_stop_handler_fn)(void *arg);
index cf54e02a316f54575c95ca307e5decfc2585bd2f..e1bb0f04dfefd5e6f118a767b2192d53835c47d9 100644 (file)
@@ -7,7 +7,7 @@ rand_bytes_ex, rand_priv_bytes_ex
 
 =head1 SYNOPSIS
 
- #include "internal/rand_int.h"
+ #include "crypto/rand.h"
 
  int rand_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
  int rand_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
diff --git a/include/crypto/__DECC_INCLUDE_EPILOGUE.H b/include/crypto/__DECC_INCLUDE_EPILOGUE.H
new file mode 100644 (file)
index 0000000..e57c0ea
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * This file is only used by HP C on VMS, and is included automatically
+ * after each header file from this directory
+ */
+
+/* restore state.  Must correspond to the save in __decc_include_prologue.h */
+#pragma names restore
diff --git a/include/crypto/__DECC_INCLUDE_PROLOGUE.H b/include/crypto/__DECC_INCLUDE_PROLOGUE.H
new file mode 100644 (file)
index 0000000..a013957
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * This file is only used by HP C on VMS, and is included automatically
+ * after each header file from this directory
+ */
+
+/* save state */
+#pragma names save
+/* have the compiler shorten symbols larger than 31 chars to 23 chars
+ * followed by a 8 hex char CRC
+ */
+#pragma names as_is,shortened
diff --git a/include/crypto/aria.h b/include/crypto/aria.h
new file mode 100644 (file)
index 0000000..4bfbd5a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates.  All rights reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+ /* Copyright (c) 2017 National Security Research Institute.  All rights reserved. */
+
+#ifndef HEADER_ARIA_H
+# define HEADER_ARIA_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_ARIA
+#  error ARIA is disabled.
+# endif
+
+# define ARIA_ENCRYPT     1
+# define ARIA_DECRYPT     0
+
+# define ARIA_BLOCK_SIZE    16  /* Size of each encryption/decryption block */
+# define ARIA_MAX_KEYS      17  /* Number of keys needed in the worst case  */
+
+typedef union {
+    unsigned char c[ARIA_BLOCK_SIZE];
+    unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)];
+} ARIA_u128;
+
+typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE];
+
+struct aria_key_st {
+    ARIA_u128 rd_key[ARIA_MAX_KEYS];
+    unsigned int rounds;
+};
+typedef struct aria_key_st ARIA_KEY;
+
+
+int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
+                         ARIA_KEY *key);
+int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
+                         ARIA_KEY *key);
+
+void aria_encrypt(const unsigned char *in, unsigned char *out,
+                  const ARIA_KEY *key);
+
+#endif
diff --git a/include/crypto/asn1.h b/include/crypto/asn1.h
new file mode 100644 (file)
index 0000000..674fa70
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* Internal ASN1 structures and functions: not for application use */
+
+/* ASN1 public key method structure */
+
+struct evp_pkey_asn1_method_st {
+    int pkey_id;
+    int pkey_base_id;
+    unsigned long pkey_flags;
+    char *pem_str;
+    char *info;
+    int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub);
+    int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);
+    int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
+    int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,
+                      ASN1_PCTX *pctx);
+    int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
+    int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
+    int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent,
+                       ASN1_PCTX *pctx);
+    int (*pkey_size) (const EVP_PKEY *pk);
+    int (*pkey_bits) (const EVP_PKEY *pk);
+    int (*pkey_security_bits) (const EVP_PKEY *pk);
+    int (*param_decode) (EVP_PKEY *pkey,
+                         const unsigned char **pder, int derlen);
+    int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder);
+    int (*param_missing) (const EVP_PKEY *pk);
+    int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from);
+    int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
+    int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent,
+                        ASN1_PCTX *pctx);
+    int (*sig_print) (BIO *out,
+                      const X509_ALGOR *sigalg, const ASN1_STRING *sig,
+                      int indent, ASN1_PCTX *pctx);
+    void (*pkey_free) (EVP_PKEY *pkey);
+    int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);
+    /* Legacy functions for old PEM */
+    int (*old_priv_decode) (EVP_PKEY *pkey,
+                            const unsigned char **pder, int derlen);
+    int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);
+    /* Custom ASN1 signature verification */
+    int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+                        X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
+    int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
+                      X509_ALGOR *alg1, X509_ALGOR *alg2,
+                      ASN1_BIT_STRING *sig);
+    int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg,
+                       const ASN1_STRING *sig);
+    /* Check */
+    int (*pkey_check) (const EVP_PKEY *pk);
+    int (*pkey_public_check) (const EVP_PKEY *pk);
+    int (*pkey_param_check) (const EVP_PKEY *pk);
+    /* Get/set raw private/public key data */
+    int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len);
+    int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len);
+    int (*get_priv_key) (const EVP_PKEY *pk, unsigned char *priv, size_t *len);
+    int (*get_pub_key) (const EVP_PKEY *pk, unsigned char *pub, size_t *len);
+
+    /*
+     * TODO: Make sure these functions are defined for key types that are
+     * implemented in providers.
+     */
+    /* Exports to providers */
+    size_t (*dirty_cnt) (const EVP_PKEY *pk);
+    void *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
+} /* EVP_PKEY_ASN1_METHOD */ ;
+
+DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)
+
+extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5];
+extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ed448_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD sm2_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD poly1305_asn1_meth;
+
+extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[2];
+extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD siphash_asn1_meth;
+
+/*
+ * These are used internally in the ASN1_OBJECT to keep track of whether the
+ * names and data need to be free()ed
+ */
+# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
+# define ASN1_OBJECT_FLAG_CRITICAL        0x02/* critical x509v3 object id */
+# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
+# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
+struct asn1_object_st {
+    const char *sn, *ln;
+    int nid;
+    int length;
+    const unsigned char *data;  /* data remains const after init */
+    int flags;                  /* Should we free this one */
+};
+
+/* ASN1 print context structure */
+
+struct asn1_pctx_st {
+    unsigned long flags;
+    unsigned long nm_flags;
+    unsigned long cert_flags;
+    unsigned long oid_flags;
+    unsigned long str_flags;
+} /* ASN1_PCTX */ ;
+
+int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
diff --git a/include/crypto/asn1_dsa.h b/include/crypto/asn1_dsa.h
new file mode 100644 (file)
index 0000000..d257051
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_ASN1_DSA_H
+# define HEADER_ASN1_DSA_H
+
+#include "internal/packet.h"
+
+int encode_der_length(WPACKET *pkt, size_t cont_len);
+int encode_der_integer(WPACKET *pkt, const BIGNUM *n);
+int encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s);
+int decode_der_length(PACKET *pkt, PACKET *subpkt);
+int decode_der_integer(PACKET *pkt, BIGNUM *n);
+size_t decode_der_dsa_sig(BIGNUM *r, BIGNUM *s, const unsigned char **ppin,
+                          size_t len);
+
+#endif
diff --git a/include/crypto/async.h b/include/crypto/async.h
new file mode 100644 (file)
index 0000000..e9a89da
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/async.h>
+
+int async_init(void);
+void async_deinit(void);
+
diff --git a/include/crypto/bn.h b/include/crypto/bn.h
new file mode 100644 (file)
index 0000000..cb8b176
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_BN_INT_H
+# define HEADER_BN_INT_H
+
+# include <openssl/bn.h>
+# include <limits.h>
+
+BIGNUM *bn_wexpand(BIGNUM *a, int words);
+BIGNUM *bn_expand2(BIGNUM *a, int words);
+
+void bn_correct_top(BIGNUM *a);
+
+/*
+ * Determine the modified width-(w+1) Non-Adjacent Form (wNAF) of 'scalar'.
+ * This is an array r[] of values that are either zero or odd with an
+ * absolute value less than 2^w satisfying scalar = \sum_j r[j]*2^j where at
+ * most one of any w+1 consecutive digits is non-zero with the exception that
+ * the most significant digit may be only w-1 zeros away from that next
+ * non-zero digit.
+ */
+signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len);
+
+int bn_get_top(const BIGNUM *a);
+
+int bn_get_dmax(const BIGNUM *a);
+
+/* Set all words to zero */
+void bn_set_all_zero(BIGNUM *a);
+
+/*
+ * Copy the internal BIGNUM words into out which holds size elements (and size
+ * must be bigger than top)
+ */
+int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size);
+
+BN_ULONG *bn_get_words(const BIGNUM *a);
+
+/*
+ * Set the internal data words in a to point to words which contains size
+ * elements. The BN_FLG_STATIC_DATA flag is set
+ */
+void bn_set_static_words(BIGNUM *a, const BN_ULONG *words, int size);
+
+/*
+ * Copy words into the BIGNUM |a|, reallocating space as necessary.
+ * The negative flag of |a| is not modified.
+ * Returns 1 on success and 0 on failure.
+ */
+/*
+ * |num_words| is int because bn_expand2 takes an int. This is an internal
+ * function so we simply trust callers not to pass negative values.
+ */
+int bn_set_words(BIGNUM *a, const BN_ULONG *words, int num_words);
+
+/*
+ * Some BIGNUM functions assume most significant limb to be non-zero, which
+ * is customarily arranged by bn_correct_top. Output from below functions
+ * is not processed with bn_correct_top, and for this reason it may not be
+ * returned out of public API. It may only be passed internally into other
+ * functions known to support non-minimal or zero-padded BIGNUMs. Even
+ * though the goal is to facilitate constant-time-ness, not each subroutine
+ * is constant-time by itself. They all have pre-conditions, consult source
+ * code...
+ */
+int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                          BN_MONT_CTX *mont, BN_CTX *ctx);
+int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
+                         BN_CTX *ctx);
+int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
+                           BN_CTX *ctx);
+int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                         const BIGNUM *m);
+int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                         const BIGNUM *m);
+int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
+int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
+int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
+int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
+                     const BIGNUM *d, BN_CTX *ctx);
+
+#define BN_PRIMETEST_COMPOSITE                    0
+#define BN_PRIMETEST_COMPOSITE_WITH_FACTOR        1
+#define BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME 2
+#define BN_PRIMETEST_PROBABLY_PRIME               3
+
+int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
+                             BN_GENCB *cb, int enhanced, int *status);
+
+const BIGNUM *bn_get0_small_factors(void);
+
+int bn_rsa_fips186_4_prime_MR_min_checks(int nbits);
+
+int bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout,
+                                     BIGNUM *p1, BIGNUM *p2,
+                                     const BIGNUM *Xp, const BIGNUM *Xp1,
+                                     const BIGNUM *Xp2, int nlen,
+                                     const BIGNUM *e, BN_CTX *ctx,
+                                     BN_GENCB *cb);
+
+int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin,
+                                  const BIGNUM *r1, const BIGNUM *r2, int nlen,
+                                  const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
+
+OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx);
+#endif
diff --git a/include/crypto/bn_conf.h.in b/include/crypto/bn_conf.h.in
new file mode 100644 (file)
index 0000000..9061d20
--- /dev/null
@@ -0,0 +1,27 @@
+{- join("\n",map { "/* $_ */" } @autowarntext) -}
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_BN_CONF_H
+# define HEADER_BN_CONF_H
+
+/*
+ * The contents of this file are not used in the UEFI build, as
+ * both 32-bit and 64-bit builds are supported from a single run
+ * of the Configure script.
+ */
+
+/* Should we define BN_DIV2W here? */
+
+/* Only one for the following should be defined */
+{- $config{b64l} ? "#define" : "#undef" -} SIXTY_FOUR_BIT_LONG
+{- $config{b64}  ? "#define" : "#undef" -} SIXTY_FOUR_BIT
+{- $config{b32}  ? "#define" : "#undef" -} THIRTY_TWO_BIT
+
+#endif
diff --git a/include/crypto/bn_dh.h b/include/crypto/bn_dh.h
new file mode 100644 (file)
index 0000000..9077234
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#define declare_dh_bn(x) \
+    extern const BIGNUM _bignum_dh##x##_p;              \
+    extern const BIGNUM _bignum_dh##x##_g;              \
+    extern const BIGNUM _bignum_dh##x##_q;
+
+declare_dh_bn(1024_160)
+declare_dh_bn(2048_224)
+declare_dh_bn(2048_256)
+
+extern const BIGNUM _bignum_ffdhe2048_p;
+extern const BIGNUM _bignum_ffdhe3072_p;
+extern const BIGNUM _bignum_ffdhe4096_p;
+extern const BIGNUM _bignum_ffdhe6144_p;
+extern const BIGNUM _bignum_ffdhe8192_p;
+extern const BIGNUM _bignum_const_2;
diff --git a/include/crypto/bn_srp.h b/include/crypto/bn_srp.h
new file mode 100644 (file)
index 0000000..897618c
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OPENSSL_NO_SRP
+
+extern const BIGNUM bn_group_1024;
+
+extern const BIGNUM bn_group_1536;
+
+extern const BIGNUM bn_group_2048;
+
+extern const BIGNUM bn_group_3072;
+
+extern const BIGNUM bn_group_4096;
+
+extern const BIGNUM bn_group_6144;
+
+extern const BIGNUM bn_group_8192;
+
+extern const BIGNUM bn_generator_19;
+
+extern const BIGNUM bn_generator_5;
+
+extern const BIGNUM bn_generator_2;
+
+#endif
diff --git a/include/crypto/chacha.h b/include/crypto/chacha.h
new file mode 100644 (file)
index 0000000..e095522
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_CHACHA_H
+#define HEADER_CHACHA_H
+
+#include <stddef.h>
+
+/*
+ * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and
+ * nonce and writes the result to |out|, which may be equal to |inp|.
+ * The |key| is not 32 bytes of verbatim key material though, but the
+ * said material collected into 8 32-bit elements array in host byte
+ * order. Same approach applies to nonce: the |counter| argument is
+ * pointer to concatenated nonce and counter values collected into 4
+ * 32-bit elements. This, passing crypto material collected into 32-bit
+ * elements as opposite to passing verbatim byte vectors, is chosen for
+ * efficiency in multi-call scenarios.
+ */
+void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
+                    size_t len, const unsigned int key[8],
+                    const unsigned int counter[4]);
+/*
+ * You can notice that there is no key setup procedure. Because it's
+ * as trivial as collecting bytes into 32-bit elements, it's reckoned
+ * that below macro is sufficient.
+ */
+#define CHACHA_U8TOU32(p)  ( \
+                ((unsigned int)(p)[0])     | ((unsigned int)(p)[1]<<8) | \
+                ((unsigned int)(p)[2]<<16) | ((unsigned int)(p)[3]<<24)  )
+
+#define CHACHA_KEY_SIZE         32
+#define CHACHA_CTR_SIZE         16
+#define CHACHA_BLK_SIZE         64
+
+#endif
diff --git a/include/crypto/ciphermode_platform.h b/include/crypto/ciphermode_platform.h
new file mode 100644 (file)
index 0000000..b16062f
--- /dev/null
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_INTERNAL_CIPHERMODE_PLATFORM_H
+# define HEADER_INTERNAL_CIPHERMODE_PLATFORM_H
+
+# include "openssl/aes.h"
+
+# ifdef VPAES_ASM
+int vpaes_set_encrypt_key(const unsigned char *userKey, int bits,
+                          AES_KEY *key);
+int vpaes_set_decrypt_key(const unsigned char *userKey, int bits,
+                          AES_KEY *key);
+void vpaes_encrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+void vpaes_decrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+void vpaes_cbc_encrypt(const unsigned char *in,
+                       unsigned char *out,
+                       size_t length,
+                       const AES_KEY *key, unsigned char *ivec, int enc);
+# endif /* VPAES_ASM */
+
+# ifdef BSAES_ASM
+void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                       size_t length, const AES_KEY *key,
+                       unsigned char ivec[16], int enc);
+void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
+                                size_t len, const AES_KEY *key,
+                                const unsigned char ivec[16]);
+void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
+                       size_t len, const AES_KEY *key1,
+                       const AES_KEY *key2, const unsigned char iv[16]);
+void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
+                       size_t len, const AES_KEY *key1,
+                       const AES_KEY *key2, const unsigned char iv[16]);
+# endif /* BSAES_ASM */
+
+# ifdef AES_CTR_ASM
+void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                       size_t blocks, const AES_KEY *key,
+                       const unsigned char ivec[AES_BLOCK_SIZE]);
+# endif /*  AES_CTR_ASM */
+
+# ifdef AES_XTS_ASM
+void AES_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len,
+                     const AES_KEY *key1, const AES_KEY *key2,
+                     const unsigned char iv[16]);
+void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
+                     const AES_KEY *key1, const AES_KEY *key2,
+                     const unsigned char iv[16]);
+# endif /* AES_XTS_ASM */
+
+# if defined(OPENSSL_CPUID_OBJ)
+#  if (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
+#   include "ppc_arch.h"
+#   ifdef VPAES_ASM
+#    define VPAES_CAPABLE (OPENSSL_ppccap_P & PPC_ALTIVEC)
+#   endif
+#   define HWAES_CAPABLE  (OPENSSL_ppccap_P & PPC_CRYPTO207)
+#   define HWAES_set_encrypt_key aes_p8_set_encrypt_key
+#   define HWAES_set_decrypt_key aes_p8_set_decrypt_key
+#   define HWAES_encrypt aes_p8_encrypt
+#   define HWAES_decrypt aes_p8_decrypt
+#   define HWAES_cbc_encrypt aes_p8_cbc_encrypt
+#   define HWAES_ctr32_encrypt_blocks aes_p8_ctr32_encrypt_blocks
+#   define HWAES_xts_encrypt aes_p8_xts_encrypt
+#   define HWAES_xts_decrypt aes_p8_xts_decrypt
+#  endif /* PPC */
+
+#  if (defined(__arm__) || defined(__arm) || defined(__aarch64__))
+#   include "arm_arch.h"
+#   if __ARM_MAX_ARCH__>=7
+#    if defined(BSAES_ASM)
+#     define BSAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
+#    endif
+#    if defined(VPAES_ASM)
+#     define VPAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
+#    endif
+#    define HWAES_CAPABLE (OPENSSL_armcap_P & ARMV8_AES)
+#    define HWAES_set_encrypt_key aes_v8_set_encrypt_key
+#    define HWAES_set_decrypt_key aes_v8_set_decrypt_key
+#    define HWAES_encrypt aes_v8_encrypt
+#    define HWAES_decrypt aes_v8_decrypt
+#    define HWAES_cbc_encrypt aes_v8_cbc_encrypt
+#    define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks
+#   endif
+#  endif
+# endif /* OPENSSL_CPUID_OBJ */
+
+# if     defined(AES_ASM) && !defined(I386_ONLY) &&      (  \
+         ((defined(__i386)       || defined(__i386__)    || \
+           defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
+         defined(__x86_64)       || defined(__x86_64__)  || \
+         defined(_M_AMD64)       || defined(_M_X64)      )
+
+/* AES-NI section */
+
+#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
+#  ifdef VPAES_ASM
+#   define VPAES_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
+#  endif
+#  ifdef BSAES_ASM
+#   define BSAES_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
+#  endif
+
+int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
+                          AES_KEY *key);
+int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
+                          AES_KEY *key);
+
+void aesni_encrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+void aesni_decrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+
+void aesni_ecb_encrypt(const unsigned char *in,
+                       unsigned char *out,
+                       size_t length, const AES_KEY *key, int enc);
+void aesni_cbc_encrypt(const unsigned char *in,
+                       unsigned char *out,
+                       size_t length,
+                       const AES_KEY *key, unsigned char *ivec, int enc);
+#  ifndef OPENSSL_NO_OCB
+void aesni_ocb_encrypt(const unsigned char *in, unsigned char *out,
+                       size_t blocks, const void *key,
+                       size_t start_block_num,
+                       unsigned char offset_i[16],
+                       const unsigned char L_[][16],
+                       unsigned char checksum[16]);
+void aesni_ocb_decrypt(const unsigned char *in, unsigned char *out,
+                       size_t blocks, const void *key,
+                       size_t start_block_num,
+                       unsigned char offset_i[16],
+                       const unsigned char L_[][16],
+                       unsigned char checksum[16]);
+#  endif /* OPENSSL_NO_OCB */
+
+void aesni_ctr32_encrypt_blocks(const unsigned char *in,
+                                unsigned char *out,
+                                size_t blocks,
+                                const void *key, const unsigned char *ivec);
+
+void aesni_xts_encrypt(const unsigned char *in,
+                       unsigned char *out,
+                       size_t length,
+                       const AES_KEY *key1, const AES_KEY *key2,
+                       const unsigned char iv[16]);
+
+void aesni_xts_decrypt(const unsigned char *in,
+                       unsigned char *out,
+                       size_t length,
+                       const AES_KEY *key1, const AES_KEY *key2,
+                       const unsigned char iv[16]);
+
+void aesni_ccm64_encrypt_blocks(const unsigned char *in,
+                                unsigned char *out,
+                                size_t blocks,
+                                const void *key,
+                                const unsigned char ivec[16],
+                                unsigned char cmac[16]);
+
+void aesni_ccm64_decrypt_blocks(const unsigned char *in,
+                                unsigned char *out,
+                                size_t blocks,
+                                const void *key,
+                                const unsigned char ivec[16],
+                                unsigned char cmac[16]);
+
+#  if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
+size_t aesni_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len,
+                         const void *key, unsigned char ivec[16], u64 *Xi);
+size_t aesni_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len,
+                         const void *key, unsigned char ivec[16], u64 *Xi);
+void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len);
+
+#   define AES_GCM_ASM(ctx)    (ctx->ctr == aesni_ctr32_encrypt_blocks && \
+                                ctx->gcm.ghash == gcm_ghash_avx)
+#  endif
+
+
+# elif defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
+
+/* Fujitsu SPARC64 X support */
+extern unsigned int OPENSSL_sparcv9cap_P[];
+#  include "sparc_arch.h"
+
+#  ifndef OPENSSL_NO_CAMELLIA
+#   define SPARC_CMLL_CAPABLE      (OPENSSL_sparcv9cap_P[1] & CFR_CAMELLIA)
+#   include "openssl/camellia.h"
+
+void cmll_t4_set_key(const unsigned char *key, int bits, CAMELLIA_KEY *ks);
+void cmll_t4_encrypt(const unsigned char *in, unsigned char *out,
+                     const CAMELLIA_KEY *key);
+void cmll_t4_decrypt(const unsigned char *in, unsigned char *out,
+                     const CAMELLIA_KEY *key);
+
+void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                            size_t len, const CAMELLIA_KEY *key,
+                            unsigned char *ivec);
+void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
+                            size_t len, const CAMELLIA_KEY *key,
+                            unsigned char *ivec);
+void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                            size_t len, const CAMELLIA_KEY *key,
+                            unsigned char *ivec);
+void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
+                            size_t len, const CAMELLIA_KEY *key,
+                            unsigned char *ivec);
+void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                              size_t blocks, const CAMELLIA_KEY *key,
+                              unsigned char *ivec);
+void cmll256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                              size_t blocks, const CAMELLIA_KEY *key,
+                              unsigned char *ivec);
+#  endif /* OPENSSL_NO_CAMELLIA */
+
+
+#  define SPARC_AES_CAPABLE       (OPENSSL_sparcv9cap_P[1] & CFR_AES)
+#  define SPARC_DES_CAPABLE       (OPENSSL_sparcv9cap_P[1] & CFR_DES)
+#  define HWAES_CAPABLE           (OPENSSL_sparcv9cap_P[0] & SPARCV9_FJAESX)
+#  define HWAES_set_encrypt_key aes_fx_set_encrypt_key
+#  define HWAES_set_decrypt_key aes_fx_set_decrypt_key
+#  define HWAES_encrypt aes_fx_encrypt
+#  define HWAES_decrypt aes_fx_decrypt
+#  define HWAES_cbc_encrypt aes_fx_cbc_encrypt
+#  define HWAES_ctr32_encrypt_blocks aes_fx_ctr32_encrypt_blocks
+
+void aes_t4_set_encrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
+void aes_t4_set_decrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
+void aes_t4_encrypt(const unsigned char *in, unsigned char *out,
+                    const AES_KEY *key);
+void aes_t4_decrypt(const unsigned char *in, unsigned char *out,
+                    const AES_KEY *key);
+/*
+ * Key-length specific subroutines were chosen for following reason.
+ * Each SPARC T4 core can execute up to 8 threads which share core's
+ * resources. Loading as much key material to registers allows to
+ * minimize references to shared memory interface, as well as amount
+ * of instructions in inner loops [much needed on T4]. But then having
+ * non-key-length specific routines would require conditional branches
+ * either in inner loops or on subroutines' entries. Former is hardly
+ * acceptable, while latter means code size increase to size occupied
+ * by multiple key-length specific subroutines, so why fight?
+ */
+void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const AES_KEY *key,
+                           unsigned char *ivec);
+void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t blocks, const AES_KEY *key,
+                             unsigned char *ivec);
+void aes192_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t blocks, const AES_KEY *key,
+                             unsigned char *ivec);
+void aes256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t blocks, const AES_KEY *key,
+                             unsigned char *ivec);
+void aes128_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t blocks, const AES_KEY *key1,
+                           const AES_KEY *key2, const unsigned char *ivec);
+void aes128_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t blocks, const AES_KEY *key1,
+                           const AES_KEY *key2, const unsigned char *ivec);
+void aes256_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t blocks, const AES_KEY *key1,
+                           const AES_KEY *key2, const unsigned char *ivec);
+void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t blocks, const AES_KEY *key1,
+                           const AES_KEY *key2, const unsigned char *ivec);
+
+#  ifndef OPENSSL_NO_DES
+#   include <openssl/des.h>
+void des_t4_key_expand(const void *key, DES_key_schedule *ks);
+void des_t4_ede3_cbc_encrypt(const void *inp, void *out, size_t len,
+                             const DES_key_schedule ks[3], unsigned char iv[8]);
+void des_t4_ede3_cbc_decrypt(const void *inp, void *out, size_t len,
+                             const DES_key_schedule ks[3], unsigned char iv[8]);
+void des_t4_cbc_encrypt(const void *inp, void *out, size_t len,
+                        const DES_key_schedule *ks, unsigned char iv[8]);
+void des_t4_cbc_decrypt(const void *inp, void *out, size_t len,
+                        const DES_key_schedule *ks, unsigned char iv[8]);
+#  endif /*  OPENSSL_NO_DES */
+
+# elif defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
+/* IBM S390X support */
+#  include "s390x_arch.h"
+
+
+/* Convert key size to function code: [16,24,32] -> [18,19,20]. */
+#  define S390X_AES_FC(keylen)  (S390X_AES_128 + ((((keylen) << 3) - 128) >> 6))
+
+/* Most modes of operation need km for partial block processing. */
+#  define S390X_aes_128_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
+                                S390X_CAPBIT(S390X_AES_128))
+#  define S390X_aes_192_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
+                                S390X_CAPBIT(S390X_AES_192))
+#  define S390X_aes_256_CAPABLE (OPENSSL_s390xcap_P.km[0] &  \
+                                S390X_CAPBIT(S390X_AES_256))
+
+#  define S390X_aes_128_cbc_CAPABLE     1       /* checked by callee */
+#  define S390X_aes_192_cbc_CAPABLE     1
+#  define S390X_aes_256_cbc_CAPABLE     1
+
+#  define S390X_aes_128_ecb_CAPABLE     S390X_aes_128_CAPABLE
+#  define S390X_aes_192_ecb_CAPABLE     S390X_aes_192_CAPABLE
+#  define S390X_aes_256_ecb_CAPABLE     S390X_aes_256_CAPABLE
+
+#  define S390X_aes_128_ofb_CAPABLE (S390X_aes_128_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmo[0] &        \
+                                     S390X_CAPBIT(S390X_AES_128)))
+#  define S390X_aes_192_ofb_CAPABLE (S390X_aes_192_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmo[0] &        \
+                                     S390X_CAPBIT(S390X_AES_192)))
+#  define S390X_aes_256_ofb_CAPABLE (S390X_aes_256_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmo[0] &        \
+                                     S390X_CAPBIT(S390X_AES_256)))
+
+#  define S390X_aes_128_cfb_CAPABLE (S390X_aes_128_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmf[0] &        \
+                                     S390X_CAPBIT(S390X_AES_128)))
+#  define S390X_aes_192_cfb_CAPABLE (S390X_aes_192_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmf[0] &        \
+                                     S390X_CAPBIT(S390X_AES_192)))
+#  define S390X_aes_256_cfb_CAPABLE (S390X_aes_256_CAPABLE &&           \
+                                    (OPENSSL_s390xcap_P.kmf[0] &        \
+                                     S390X_CAPBIT(S390X_AES_256)))
+#  define S390X_aes_128_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
+                                     S390X_CAPBIT(S390X_AES_128))
+#  define S390X_aes_192_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
+                                     S390X_CAPBIT(S390X_AES_192))
+#  define S390X_aes_256_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] &       \
+                                     S390X_CAPBIT(S390X_AES_256))
+#  define S390X_aes_128_cfb1_CAPABLE    0
+#  define S390X_aes_192_cfb1_CAPABLE    0
+#  define S390X_aes_256_cfb1_CAPABLE    0
+
+#  define S390X_aes_128_ctr_CAPABLE     1       /* checked by callee */
+#  define S390X_aes_192_ctr_CAPABLE     1
+#  define S390X_aes_256_ctr_CAPABLE     1
+
+#  define S390X_aes_128_xts_CAPABLE     1       /* checked by callee */
+#  define S390X_aes_256_xts_CAPABLE     1
+
+# define S390X_aes_128_gcm_CAPABLE (S390X_aes_128_CAPABLE &&        \
+                                    (OPENSSL_s390xcap_P.kma[0] &    \
+                                     S390X_CAPBIT(S390X_AES_128)))
+# define S390X_aes_192_gcm_CAPABLE (S390X_aes_192_CAPABLE &&        \
+                                    (OPENSSL_s390xcap_P.kma[0] &    \
+                                     S390X_CAPBIT(S390X_AES_192)))
+# define S390X_aes_256_gcm_CAPABLE (S390X_aes_256_CAPABLE &&        \
+                                    (OPENSSL_s390xcap_P.kma[0] &    \
+                                     S390X_CAPBIT(S390X_AES_256)))
+
+#  define S390X_aes_128_ccm_CAPABLE (S390X_aes_128_CAPABLE &&       \
+                                    (OPENSSL_s390xcap_P.kmac[0] &   \
+                                     S390X_CAPBIT(S390X_AES_128)))
+#  define S390X_aes_192_ccm_CAPABLE (S390X_aes_192_CAPABLE &&       \
+                                    (OPENSSL_s390xcap_P.kmac[0] &   \
+                                     S390X_CAPBIT(S390X_AES_192)))
+#  define S390X_aes_256_ccm_CAPABLE (S390X_aes_256_CAPABLE &&       \
+                                    (OPENSSL_s390xcap_P.kmac[0] &   \
+                                     S390X_CAPBIT(S390X_AES_256)))
+#  define S390X_CCM_AAD_FLAG    0x40
+
+#  ifndef OPENSSL_NO_OCB
+#   define S390X_aes_128_ocb_CAPABLE    0
+#   define S390X_aes_192_ocb_CAPABLE    0
+#   define S390X_aes_256_ocb_CAPABLE    0
+#  endif /* OPENSSL_NO_OCB */
+
+#  ifndef OPENSSL_NO_SIV
+#   define S390X_aes_128_siv_CAPABLE    0
+#   define S390X_aes_192_siv_CAPABLE    0
+#   define S390X_aes_256_siv_CAPABLE    0
+#  endif /* OPENSSL_NO_SIV */
+
+/* Convert key size to function code: [16,24,32] -> [18,19,20]. */
+#  define S390X_AES_FC(keylen)  (S390X_AES_128 + ((((keylen) << 3) - 128) >> 6))
+# endif
+
+# if defined(HWAES_CAPABLE)
+int HWAES_set_encrypt_key(const unsigned char *userKey, const int bits,
+                          AES_KEY *key);
+int HWAES_set_decrypt_key(const unsigned char *userKey, const int bits,
+                          AES_KEY *key);
+void HWAES_encrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+void HWAES_decrypt(const unsigned char *in, unsigned char *out,
+                   const AES_KEY *key);
+void HWAES_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                       size_t length, const AES_KEY *key,
+                       unsigned char *ivec, const int enc);
+void HWAES_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
+                                size_t len, const AES_KEY *key,
+                                const unsigned char ivec[16]);
+void HWAES_xts_encrypt(const unsigned char *inp, unsigned char *out,
+                       size_t len, const AES_KEY *key1,
+                       const AES_KEY *key2, const unsigned char iv[16]);
+void HWAES_xts_decrypt(const unsigned char *inp, unsigned char *out,
+                       size_t len, const AES_KEY *key1,
+                       const AES_KEY *key2, const unsigned char iv[16]);
+#  ifndef OPENSSL_NO_OCB
+#   ifdef HWAES_ocb_encrypt
+void HWAES_ocb_encrypt(const unsigned char *in, unsigned char *out,
+                       size_t blocks, const void *key,
+                       size_t start_block_num,
+                       unsigned char offset_i[16],
+                       const unsigned char L_[][16],
+                       unsigned char checksum[16]);
+#   else
+#     define HWAES_ocb_encrypt ((ocb128_f)NULL)
+#   endif
+#   ifdef HWAES_ocb_decrypt
+void HWAES_ocb_decrypt(const unsigned char *in, unsigned char *out,
+                       size_t blocks, const void *key,
+                       size_t start_block_num,
+                       unsigned char offset_i[16],
+                       const unsigned char L_[][16],
+                       unsigned char checksum[16]);
+#   else
+#     define HWAES_ocb_decrypt ((ocb128_f)NULL)
+#   endif
+#  endif /* OPENSSL_NO_OCB */
+
+# endif /* HWAES_CAPABLE */
+
+#endif /* HEADER_INTERNAL_CIPHERMODE_PLATFORM_H */
diff --git a/include/crypto/cms.h b/include/crypto/cms.h
new file mode 100644 (file)
index 0000000..c630991
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* internal CMS-ESS related stuff */
+
+int cms_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc);
+int cms_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc);
diff --git a/include/crypto/cryptlib.h b/include/crypto/cryptlib.h
new file mode 100644 (file)
index 0000000..69d94be
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/core.h>
+#include "internal/cryptlib.h"
+
+/* This file is not scanned by mkdef.pl, whereas cryptlib.h is */
+
+int ossl_init_thread_start(const void *index, void *arg,
+                           OSSL_thread_stop_handler_fn handfn);
+int ossl_init_thread_deregister(void *index);
+int ossl_init_thread(void);
+void ossl_cleanup_thread(void);
+void ossl_ctx_thread_stop(void *arg);
+
+/*
+ * OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below
+ * are those omitted from crypto.h because they are "reserved for internal
+ * use".
+ */
+# define OPENSSL_INIT_ZLIB                   0x00010000L
+# define OPENSSL_INIT_BASE_ONLY              0x00040000L
+
+void ossl_trace_cleanup(void);
+void ossl_malloc_setup_failures(void);
diff --git a/include/crypto/ctype.h b/include/crypto/ctype.h
new file mode 100644 (file)
index 0000000..d0660cf
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * This version of ctype.h provides a standardised and platform
+ * independent implementation that supports seven bit ASCII characters.
+ * The specific intent is to not pass extended ASCII characters (> 127)
+ * even if the host operating system would.
+ *
+ * There is EBCDIC support included for machines which use this.  However,
+ * there are a number of concerns about how well EBCDIC is supported
+ * throughout the rest of the source code.  Refer to issue #4154 for
+ * details.
+ */
+#ifndef INTERNAL_CTYPE_H
+# define INTERNAL_CTYPE_H
+
+# define CTYPE_MASK_lower       0x1
+# define CTYPE_MASK_upper       0x2
+# define CTYPE_MASK_digit       0x4
+# define CTYPE_MASK_space       0x8
+# define CTYPE_MASK_xdigit      0x10
+# define CTYPE_MASK_blank       0x20
+# define CTYPE_MASK_cntrl       0x40
+# define CTYPE_MASK_graph       0x80
+# define CTYPE_MASK_print       0x100
+# define CTYPE_MASK_punct       0x200
+# define CTYPE_MASK_base64      0x400
+# define CTYPE_MASK_asn1print   0x800
+
+# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
+# define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
+
+/*
+ * The ascii mask assumes that any other classification implies that
+ * the character is ASCII and that there are no ASCII characters
+ * that aren't in any of the classifications.
+ *
+ * This assumption holds at the moment, but it might not in the future.
+ */
+# define CTYPE_MASK_ascii   (~0)
+
+# ifdef CHARSET_EBCDIC
+int ossl_toascii(int c);
+int ossl_fromascii(int c);
+# else
+#  define ossl_toascii(c)       (c)
+#  define ossl_fromascii(c)     (c)
+# endif
+int ossl_ctype_check(int c, unsigned int mask);
+int ossl_tolower(int c);
+int ossl_toupper(int c);
+
+int ascii_isdigit(const char inchar);
+
+# define ossl_isalnum(c)        (ossl_ctype_check((c), CTYPE_MASK_alnum))
+# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
+# ifdef CHARSET_EBCDIC
+# define ossl_isascii(c)        (ossl_ctype_check((c), CTYPE_MASK_ascii))
+# else
+# define ossl_isascii(c)        (((c) & ~127) == 0)
+# endif
+# define ossl_isblank(c)        (ossl_ctype_check((c), CTYPE_MASK_blank))
+# define ossl_iscntrl(c)        (ossl_ctype_check((c), CTYPE_MASK_cntrl))
+# define ossl_isdigit(c)        (ossl_ctype_check((c), CTYPE_MASK_digit))
+# define ossl_isgraph(c)        (ossl_ctype_check((c), CTYPE_MASK_graph))
+# define ossl_islower(c)        (ossl_ctype_check((c), CTYPE_MASK_lower))
+# define ossl_isprint(c)        (ossl_ctype_check((c), CTYPE_MASK_print))
+# define ossl_ispunct(c)        (ossl_ctype_check((c), CTYPE_MASK_punct))
+# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
+# define ossl_isupper(c)        (ossl_ctype_check((c), CTYPE_MASK_upper))
+# define ossl_isxdigit(c)       (ossl_ctype_check((c), CTYPE_MASK_xdigit))
+# define ossl_isbase64(c)       (ossl_ctype_check((c), CTYPE_MASK_base64))
+# define ossl_isasn1print(c)    (ossl_ctype_check((c), CTYPE_MASK_asn1print))
+
+#endif
diff --git a/include/crypto/dso_conf.h.in b/include/crypto/dso_conf.h.in
new file mode 100644 (file)
index 0000000..9a373b2
--- /dev/null
@@ -0,0 +1,31 @@
+{- join("\n",map { "/* $_ */" } @autowarntext) -}
+/*
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_DSO_CONF_H
+# define HEADER_DSO_CONF_H
+{-  # The DSO code currently always implements all functions so that no
+    # applications will have to worry about that from a compilation point
+    # of view. However, the "method"s may return zero unless that platform
+    # has support compiled in for them. Currently each method is enabled
+    # by a define "DSO_<name>" ... we translate the "dso_scheme" config
+    # string entry into using the following logic;
+    my $scheme = $disabled{dso} ? undef : uc $target{dso_scheme};
+    if (!$scheme) {
+        $scheme = "NONE";
+    }
+    my @macros = ( "DSO_$scheme" );
+    if ($scheme eq 'DLFCN') {
+        @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
+    } elsif ($scheme eq "DLFCN_NO_H") {
+        @macros = ( "DSO_DLFCN" );
+    }
+    join("\n", map { "# define $_" } @macros); -}
+# define DSO_EXTENSION "{- platform->dsoext() -}"
+#endif
diff --git a/include/crypto/ec.h b/include/crypto/ec.h
new file mode 100644 (file)
index 0000000..9d8882d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* Internal EC functions for other submodules: not for application use */
+
+#ifndef HEADER_OSSL_EC_INTERNAL_H
+# define HEADER_OSSL_EC_INTERNAL_H
+# include <openssl/opensslconf.h>
+
+# ifndef OPENSSL_NO_EC
+
+#  include <openssl/ec.h>
+
+/*-
+ * Computes the multiplicative inverse of x in the range
+ * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the
+ * subgroup generated by the generator G:
+ *
+ *         res := x^(-1) (mod EC_GROUP::order).
+ *
+ * This function expects the following two conditions to hold:
+ *  - the EC_GROUP order is prime, and
+ *  - x is included in the range [1, EC_GROUP::order).
+ *
+ * This function returns 1 on success, 0 on error.
+ *
+ * If the EC_GROUP order is even, this function explicitly returns 0 as
+ * an error.
+ * In case any of the two conditions stated above is not satisfied,
+ * the correctness of its output is not guaranteed, even if the return
+ * value could still be 1 (as primality testing and a conditional modular
+ * reduction round on the input can be omitted by the underlying
+ * implementations for better SCA properties on regular input values).
+ */
+__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
+                                   const BIGNUM *x, BN_CTX *ctx);
+
+/*-
+ * ECDH Key Derivation Function as defined in ANSI X9.63
+ */
+int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
+                   const unsigned char *Z, size_t Zlen,
+                   const unsigned char *sinfo, size_t sinfolen,
+                   const EVP_MD *md);
+
+# endif /* OPENSSL_NO_EC */
+#endif
diff --git a/include/crypto/engine.h b/include/crypto/engine.h
new file mode 100644 (file)
index 0000000..fac6ed0
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/engine.h>
+
+void engine_load_openssl_int(void);
+void engine_load_devcrypto_int(void);
+void engine_load_rdrand_int(void);
+void engine_load_dynamic_int(void);
+void engine_load_padlock_int(void);
+void engine_load_capi_int(void);
+void engine_load_dasync_int(void);
+void engine_load_afalg_int(void);
+void engine_cleanup_int(void);
diff --git a/include/crypto/err.h b/include/crypto/err.h
new file mode 100644 (file)
index 0000000..68c6d62
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef INTERNAL_ERR_INT_H
+# define INTERNAL_ERR_INT_H
+
+int err_load_crypto_strings_int(void);
+void err_cleanup(void);
+int err_shelve_state(void **);
+void err_unshelve_state(void *);
+
+#endif
diff --git a/include/crypto/ess.h b/include/crypto/ess.h
new file mode 100644 (file)
index 0000000..ac6c5c6
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* internal ESS related stuff */
+
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si);
+int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc);
+
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,
+                                            STACK_OF(X509) *certs,
+                                            int issuer_needed);
+
+ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_get(PKCS7_SIGNER_INFO *si);
+int ESS_SIGNING_CERT_V2_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT_V2 *sc);
+
+ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new_init(const EVP_MD *hash_alg,
+                                                  X509 *signcert,
+                                                  STACK_OF(X509) *certs,
+                                                  int issuer_needed);
+
+/*-
+ * IssuerSerial ::= SEQUENCE {
+ *        issuer                  GeneralNames,
+ *        serialNumber            CertificateSerialNumber
+ * }
+ */
+
+struct ESS_issuer_serial {
+    STACK_OF(GENERAL_NAME) *issuer;
+    ASN1_INTEGER *serial;
+};
+
+/*-
+ * ESSCertID ::=  SEQUENCE {
+ *        certHash                Hash,
+ *        issuerSerial            IssuerSerial OPTIONAL
+ * }
+ */
+
+struct ESS_cert_id {
+    ASN1_OCTET_STRING *hash;    /* Always SHA-1 digest. */
+    ESS_ISSUER_SERIAL *issuer_serial;
+};
+
+/*-
+ * SigningCertificate ::=  SEQUENCE {
+ *        certs                   SEQUENCE OF ESSCertID,
+ *        policies                SEQUENCE OF PolicyInformation OPTIONAL
+ * }
+ */
+
+struct ESS_signing_cert {
+    STACK_OF(ESS_CERT_ID) *cert_ids;
+    STACK_OF(POLICYINFO) *policy_info;
+};
+
+/*-
+ * ESSCertIDv2 ::=  SEQUENCE {
+ *        hashAlgorithm           AlgorithmIdentifier DEFAULT id-sha256,
+ *        certHash                Hash,
+ *        issuerSerial            IssuerSerial OPTIONAL
+ * }
+ */
+
+struct ESS_cert_id_v2_st {
+    X509_ALGOR *hash_alg;       /* Default: SHA-256 */
+    ASN1_OCTET_STRING *hash;
+    ESS_ISSUER_SERIAL *issuer_serial;
+};
+
+/*-
+ * SigningCertificateV2 ::= SEQUENCE {
+ *        certs                   SEQUENCE OF ESSCertIDv2,
+ *        policies                SEQUENCE OF PolicyInformation OPTIONAL
+ * }
+ */
+
+struct ESS_signing_cert_v2_st {
+    STACK_OF(ESS_CERT_ID_V2) *cert_ids;
+    STACK_OF(POLICYINFO) *policy_info;
+};
diff --git a/include/crypto/evp.h b/include/crypto/evp.h
new file mode 100644 (file)
index 0000000..b9dc951
--- /dev/null
@@ -0,0 +1,619 @@
+/*
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/evp.h>
+#include <openssl/core_numbers.h>
+#include "internal/refcount.h"
+
+/*
+ * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag
+ * values in evp.h
+ */
+#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX   0x0400
+
+struct evp_pkey_ctx_st {
+    /* Actual operation */
+    int operation;
+
+    union {
+        struct {
+            EVP_KEYEXCH *exchange;
+            void *exchprovctx;
+        } kex;
+
+        struct {
+            EVP_SIGNATURE *signature;
+            void *sigprovctx;
+        } sig;
+    } op;
+
+    /* Legacy fields below */
+
+    /* Method associated with this operation */
+    const EVP_PKEY_METHOD *pmeth;
+    /* Engine that implements this method or NULL if builtin */
+    ENGINE *engine;
+    /* Key: may be NULL */
+    EVP_PKEY *pkey;
+    /* Peer key for key agreement, may be NULL */
+    EVP_PKEY *peerkey;
+    /* Algorithm specific data */
+    void *data;
+    /* Application specific data */
+    void *app_data;
+    /* Keygen callback */
+    EVP_PKEY_gen_cb *pkey_gencb;
+    /* implementation specific keygen data */
+    int *keygen_info;
+    int keygen_info_count;
+} /* EVP_PKEY_CTX */ ;
+
+#define EVP_PKEY_FLAG_DYNAMIC   1
+
+struct evp_pkey_method_st {
+    int pkey_id;
+    int flags;
+    int (*init) (EVP_PKEY_CTX *ctx);
+    int (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);
+    void (*cleanup) (EVP_PKEY_CTX *ctx);
+    int (*paramgen_init) (EVP_PKEY_CTX *ctx);
+    int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
+    int (*keygen_init) (EVP_PKEY_CTX *ctx);
+    int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
+    int (*sign_init) (EVP_PKEY_CTX *ctx);
+    int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+                 const unsigned char *tbs, size_t tbslen);
+    int (*verify_init) (EVP_PKEY_CTX *ctx);
+    int (*verify) (EVP_PKEY_CTX *ctx,
+                   const unsigned char *sig, size_t siglen,
+                   const unsigned char *tbs, size_t tbslen);
+    int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
+    int (*verify_recover) (EVP_PKEY_CTX *ctx,
+                           unsigned char *rout, size_t *routlen,
+                           const unsigned char *sig, size_t siglen);
+    int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
+    int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+                    EVP_MD_CTX *mctx);
+    int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
+    int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
+                      EVP_MD_CTX *mctx);
+    int (*encrypt_init) (EVP_PKEY_CTX *ctx);
+    int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+                    const unsigned char *in, size_t inlen);
+    int (*decrypt_init) (EVP_PKEY_CTX *ctx);
+    int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+                    const unsigned char *in, size_t inlen);
+    int (*derive_init) (EVP_PKEY_CTX *ctx);
+    int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
+    int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
+    int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
+    int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
+                       const unsigned char *tbs, size_t tbslen);
+    int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
+                         size_t siglen, const unsigned char *tbs,
+                         size_t tbslen);
+    int (*check) (EVP_PKEY *pkey);
+    int (*public_check) (EVP_PKEY *pkey);
+    int (*param_check) (EVP_PKEY *pkey);
+
+    int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
+} /* EVP_PKEY_METHOD */ ;
+
+DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
+
+void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
+
+const EVP_PKEY_METHOD *cmac_pkey_method(void);
+const EVP_PKEY_METHOD *dh_pkey_method(void);
+const EVP_PKEY_METHOD *dhx_pkey_method(void);
+const EVP_PKEY_METHOD *dsa_pkey_method(void);
+const EVP_PKEY_METHOD *ec_pkey_method(void);
+const EVP_PKEY_METHOD *sm2_pkey_method(void);
+const EVP_PKEY_METHOD *ecx25519_pkey_method(void);
+const EVP_PKEY_METHOD *ecx448_pkey_method(void);
+const EVP_PKEY_METHOD *ed25519_pkey_method(void);
+const EVP_PKEY_METHOD *ed448_pkey_method(void);
+const EVP_PKEY_METHOD *hmac_pkey_method(void);
+const EVP_PKEY_METHOD *rsa_pkey_method(void);
+const EVP_PKEY_METHOD *rsa_pss_pkey_method(void);
+const EVP_PKEY_METHOD *scrypt_pkey_method(void);
+const EVP_PKEY_METHOD *tls1_prf_pkey_method(void);
+const EVP_PKEY_METHOD *hkdf_pkey_method(void);
+const EVP_PKEY_METHOD *poly1305_pkey_method(void);
+const EVP_PKEY_METHOD *siphash_pkey_method(void);
+
+struct evp_mac_st {
+    OSSL_PROVIDER *prov;
+    int name_id;
+
+    CRYPTO_REF_COUNT refcnt;
+    CRYPTO_RWLOCK *lock;
+
+    OSSL_OP_mac_newctx_fn *newctx;
+    OSSL_OP_mac_dupctx_fn *dupctx;
+    OSSL_OP_mac_freectx_fn *freectx;
+    OSSL_OP_mac_size_fn *size;
+    OSSL_OP_mac_init_fn *init;
+    OSSL_OP_mac_update_fn *update;
+    OSSL_OP_mac_final_fn *final;
+    OSSL_OP_mac_gettable_params_fn *gettable_params;
+    OSSL_OP_mac_gettable_ctx_params_fn *gettable_ctx_params;
+    OSSL_OP_mac_settable_ctx_params_fn *settable_ctx_params;
+    OSSL_OP_mac_get_params_fn *get_params;
+    OSSL_OP_mac_get_ctx_params_fn *get_ctx_params;
+    OSSL_OP_mac_set_ctx_params_fn *set_ctx_params;
+};
+
+struct evp_kdf_st {
+    OSSL_PROVIDER *prov;
+    int name_id;
+    CRYPTO_REF_COUNT refcnt;
+    CRYPTO_RWLOCK *lock;
+
+    OSSL_OP_kdf_newctx_fn *newctx;
+    OSSL_OP_kdf_dupctx_fn *dupctx;
+    OSSL_OP_kdf_freectx_fn *freectx;
+    OSSL_OP_kdf_reset_fn *reset;
+    OSSL_OP_kdf_derive_fn *derive;
+    OSSL_OP_kdf_gettable_params_fn *gettable_params;
+    OSSL_OP_kdf_gettable_ctx_params_fn *gettable_ctx_params;
+    OSSL_OP_kdf_settable_ctx_params_fn *settable_ctx_params;
+    OSSL_OP_kdf_get_params_fn *get_params;
+    OSSL_OP_kdf_get_ctx_params_fn *get_ctx_params;
+    OSSL_OP_kdf_set_ctx_params_fn *set_ctx_params;
+};
+
+extern const EVP_KDF pbkdf2_kdf_meth;
+extern const EVP_KDF scrypt_kdf_meth;
+extern const EVP_KDF tls1_prf_kdf_meth;
+extern const EVP_KDF hkdf_kdf_meth;
+extern const EVP_KDF sshkdf_kdf_meth;
+extern const EVP_KDF ss_kdf_meth;
+extern const EVP_KDF x963_kdf_meth;
+extern const EVP_KDF x942_kdf_meth;
+
+struct evp_md_st {
+    /* nid */
+    int type;
+
+    /* Legacy structure members */
+    /* TODO(3.0): Remove these */
+    int pkey_type;
+    int md_size;
+    unsigned long flags;
+    int (*init) (EVP_MD_CTX *ctx);
+    int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
+    int (*final) (EVP_MD_CTX *ctx, unsigned char *md);
+    int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from);
+    int (*cleanup) (EVP_MD_CTX *ctx);
+    int block_size;
+    int ctx_size;               /* how big does the ctx->md_data need to be */
+    /* control function */
+    int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
+
+    /* New structure members */
+    /* TODO(3.0): Remove above comment when legacy has gone */
+    int name_id;
+    OSSL_PROVIDER *prov;
+    CRYPTO_REF_COUNT refcnt;
+    CRYPTO_RWLOCK *lock;
+    OSSL_OP_digest_newctx_fn *newctx;
+    OSSL_OP_digest_init_fn *dinit;
+    OSSL_OP_digest_update_fn *dupdate;
+    OSSL_OP_digest_final_fn *dfinal;
+    OSSL_OP_digest_digest_fn *digest;
+    OSSL_OP_digest_freectx_fn *freectx;
+    OSSL_OP_digest_dupctx_fn *dupctx;
+    OSSL_OP_digest_get_params_fn *get_params;
+    OSSL_OP_digest_set_ctx_params_fn *set_ctx_params;
+    OSSL_OP_digest_get_ctx_params_fn *get_ctx_params;
+    OSSL_OP_digest_gettable_params_fn *gettable_params;
+    OSSL_OP_digest_settable_ctx_params_fn *settable_ctx_params;
+    OSSL_OP_digest_gettable_ctx_params_fn *gettable_ctx_params;
+
+} /* EVP_MD */ ;
+
+struct evp_cipher_st {
+    int nid;
+
+    int block_size;
+    /* Default value for variable length ciphers */
+    int key_len;
+    int iv_len;
+
+    /* Legacy structure members */
+    /* TODO(3.0): Remove these */
+    /* Various flags */
+    unsigned long flags;
+    /* init key */
+    int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key,
+                 const unsigned char *iv, int enc);
+    /* encrypt/decrypt data */
+    int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out,
+                      const unsigned char *in, size_t inl);
+    /* cleanup ctx */
+    int (*cleanup) (EVP_CIPHER_CTX *);
+    /* how big ctx->cipher_data needs to be */
+    int ctx_size;
+    /* Populate a ASN1_TYPE with parameters */
+    int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
+    /* Get parameters from a ASN1_TYPE */
+    int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
+    /* Miscellaneous operations */
+    int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr);
+    /* Application data */
+    void *app_data;
+
+    /* New structure members */
+    /* TODO(3.0): Remove above comment when legacy has gone */
+    int name_id;
+    OSSL_PROVIDER *prov;
+    CRYPTO_REF_COUNT refcnt;
+    CRYPTO_RWLOCK *lock;
+    OSSL_OP_cipher_newctx_fn *newctx;
+    OSSL_OP_cipher_encrypt_init_fn *einit;
+    OSSL_OP_cipher_decrypt_init_fn *dinit;
+    OSSL_OP_cipher_update_fn *cupdate;
+    OSSL_OP_cipher_final_fn *cfinal;
+    OSSL_OP_cipher_cipher_fn *ccipher;
+    OSSL_OP_cipher_freectx_fn *freectx;
+    OSSL_OP_cipher_dupctx_fn *dupctx;
+    OSSL_OP_cipher_get_params_fn *get_params;
+    OSSL_OP_cipher_get_ctx_params_fn *get_ctx_params;
+    OSSL_OP_cipher_set_ctx_params_fn *set_ctx_params;
+    OSSL_OP_cipher_gettable_params_fn *gettable_params;
+    OSSL_OP_cipher_gettable_ctx_params_fn *gettable_ctx_params;
+    OSSL_OP_cipher_settable_ctx_params_fn *settable_ctx_params;
+} /* EVP_CIPHER */ ;
+
+/* Macros to code block cipher wrappers */
+
+/* Wrapper functions for each cipher mode */
+
+#define EVP_C_DATA(kstruct, ctx) \
+        ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
+
+#define BLOCK_CIPHER_ecb_loop() \
+        size_t i, bl; \
+        bl = EVP_CIPHER_CTX_cipher(ctx)->block_size;    \
+        if (inl < bl) return 1;\
+        inl -= bl; \
+        for (i=0; i <= inl; i+=bl)
+
+#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
+static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
+{\
+        BLOCK_CIPHER_ecb_loop() \
+            cprefix##_ecb_encrypt(in + i, out + i, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_encrypting(ctx)); \
+        return 1;\
+}
+
+#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))
+
+#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
+    static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
+{\
+        while(inl>=EVP_MAXCHUNK) {\
+            int num = EVP_CIPHER_CTX_num(ctx);\
+            cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
+            EVP_CIPHER_CTX_set_num(ctx, num);\
+            inl-=EVP_MAXCHUNK;\
+            in +=EVP_MAXCHUNK;\
+            out+=EVP_MAXCHUNK;\
+        }\
+        if (inl) {\
+            int num = EVP_CIPHER_CTX_num(ctx);\
+            cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
+            EVP_CIPHER_CTX_set_num(ctx, num);\
+        }\
+        return 1;\
+}
+
+#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
+static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
+{\
+        while(inl>=EVP_MAXCHUNK) \
+            {\
+            cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
+            inl-=EVP_MAXCHUNK;\
+            in +=EVP_MAXCHUNK;\
+            out+=EVP_MAXCHUNK;\
+            }\
+        if (inl)\
+            cprefix##_cbc_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
+        return 1;\
+}
+
+#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched)  \
+static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
+{\
+    size_t chunk = EVP_MAXCHUNK;\
+    if (cbits == 1)  chunk >>= 3;\
+    if (inl < chunk) chunk = inl;\
+    while (inl && inl >= chunk)\
+    {\
+        int num = EVP_CIPHER_CTX_num(ctx);\
+        cprefix##_cfb##cbits##_encrypt(in, out, (long) \
+            ((cbits == 1) \
+                && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
+                ? chunk*8 : chunk), \
+            &EVP_C_DATA(kstruct, ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx),\
+            &num, EVP_CIPHER_CTX_encrypting(ctx));\
+        EVP_CIPHER_CTX_set_num(ctx, num);\
+        inl -= chunk;\
+        in += chunk;\
+        out += chunk;\
+        if (inl < chunk) chunk = inl;\
+    }\
+    return 1;\
+}
+
+#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
+        BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
+        BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
+        BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
+        BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
+
+#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
+                          key_len, iv_len, flags, init_key, cleanup, \
+                          set_asn1, get_asn1, ctrl) \
+static const EVP_CIPHER cname##_##mode = { \
+        nid##_##nmode, block_size, key_len, iv_len, \
+        flags | EVP_CIPH_##MODE##_MODE, \
+        init_key, \
+        cname##_##mode##_cipher, \
+        cleanup, \
+        sizeof(kstruct), \
+        set_asn1, get_asn1,\
+        ctrl, \
+        NULL \
+}; \
+const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
+
+#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
+                             iv_len, flags, init_key, cleanup, set_asn1, \
+                             get_asn1, ctrl) \
+BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
+                  iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
+
+#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
+                             iv_len, cbits, flags, init_key, cleanup, \
+                             set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
+                  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
+                  get_asn1, ctrl)
+
+#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
+                             iv_len, cbits, flags, init_key, cleanup, \
+                             set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
+                  key_len, iv_len, flags, init_key, cleanup, set_asn1, \
+                  get_asn1, ctrl)
+
+#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
+                             flags, init_key, cleanup, set_asn1, \
+                             get_asn1, ctrl) \
+BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
+                  0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
+
+#define BLOCK_CIPHER_defs(cname, kstruct, \
+                          nid, block_size, key_len, iv_len, cbits, flags, \
+                          init_key, cleanup, set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
+                     init_key, cleanup, set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
+                     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
+                     flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
+BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
+                     init_key, cleanup, set_asn1, get_asn1, ctrl)
+
+/*-
+#define BLOCK_CIPHER_defs(cname, kstruct, \
+                                nid, block_size, key_len, iv_len, flags,\
+                                 init_key, cleanup, set_asn1, get_asn1, ctrl)\
+static const EVP_CIPHER cname##_cbc = {\
+        nid##_cbc, block_size, key_len, iv_len, \
+        flags | EVP_CIPH_CBC_MODE,\
+        init_key,\
+        cname##_cbc_cipher,\
+        cleanup,\
+        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
+                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
+        set_asn1, get_asn1,\
+        ctrl, \
+        NULL \
+};\
+const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
+static const EVP_CIPHER cname##_cfb = {\
+        nid##_cfb64, 1, key_len, iv_len, \
+        flags | EVP_CIPH_CFB_MODE,\
+        init_key,\
+        cname##_cfb_cipher,\
+        cleanup,\
+        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
+                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
+        set_asn1, get_asn1,\
+        ctrl,\
+        NULL \
+};\
+const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
+static const EVP_CIPHER cname##_ofb = {\
+        nid##_ofb64, 1, key_len, iv_len, \
+        flags | EVP_CIPH_OFB_MODE,\
+        init_key,\
+        cname##_ofb_cipher,\
+        cleanup,\
+        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
+                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
+        set_asn1, get_asn1,\
+        ctrl,\
+        NULL \
+};\
+const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
+static const EVP_CIPHER cname##_ecb = {\
+        nid##_ecb, block_size, key_len, iv_len, \
+        flags | EVP_CIPH_ECB_MODE,\
+        init_key,\
+        cname##_ecb_cipher,\
+        cleanup,\
+        sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
+                sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
+        set_asn1, get_asn1,\
+        ctrl,\
+        NULL \
+};\
+const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
+*/
+
+#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
+                               block_size, key_len, iv_len, cbits, \
+                               flags, init_key, \
+                               cleanup, set_asn1, get_asn1, ctrl) \
+        BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
+        BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
+                          cbits, flags, init_key, cleanup, set_asn1, \
+                          get_asn1, ctrl)
+
+#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,fl) \
+        BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
+        BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
+                             NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
+                             (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \
+                             cipher##_init_key, NULL, NULL, NULL, NULL)
+
+
+# ifndef OPENSSL_NO_EC
+
+#define X25519_KEYLEN        32
+#define X448_KEYLEN          56
+#define ED25519_KEYLEN       32
+#define ED448_KEYLEN         57
+
+#define MAX_KEYLEN  ED448_KEYLEN
+
+typedef struct {
+    unsigned char pubkey[MAX_KEYLEN];
+    unsigned char *privkey;
+} ECX_KEY;
+
+#endif
+
+/*
+ * Type needs to be a bit field Sub-type needs to be for variations on the
+ * method, as in, can it do arbitrary encryption....
+ */
+struct evp_pkey_st {
+    /* == Legacy attributes == */
+    int type;
+    int save_type;
+    const EVP_PKEY_ASN1_METHOD *ameth;
+    ENGINE *engine;
+    ENGINE *pmeth_engine; /* If not NULL public key ENGINE to use */
+    union {
+        void *ptr;
+# ifndef OPENSSL_NO_RSA
+        struct rsa_st *rsa;     /* RSA */
+# endif
+# ifndef OPENSSL_NO_DSA
+        struct dsa_st *dsa;     /* DSA */
+# endif
+# ifndef OPENSSL_NO_DH
+        struct dh_st *dh;       /* DH */
+# endif
+# ifndef OPENSSL_NO_EC
+        struct ec_key_st *ec;   /* ECC */
+        ECX_KEY *ecx;           /* X25519, X448, Ed25519, Ed448 */
+# endif
+    } pkey;
+
+    /* == Common attributes == */
+    CRYPTO_REF_COUNT references;
+    CRYPTO_RWLOCK *lock;
+    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
+    int save_parameters;
+
+    /* == Provider attributes == */
+    /*
+     * To support transparent export/import between providers that
+     * support the methods for it, and still not having to do the
+     * export/import every time a key is used, we maintain a cache
+     * of imported key, indexed by provider address.
+     * pkeys[0] is *always* the "original" key.
+     */
+    struct {
+        EVP_KEYMGMT *keymgmt;
+        void *provkey;
+    } pkeys[10];
+    /*
+     * If there is a legacy key assigned to this structure, we keep
+     * a copy of that key's dirty count.
+     */
+    size_t dirty_cnt_copy;
+} /* EVP_PKEY */ ;
+
+#define EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) \
+    ((ctx)->operation == EVP_PKEY_OP_SIGN \
+     || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
+     || (ctx)->operation == EVP_PKEY_OP_VERIFY \
+     || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
+     || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
+
+#define EVP_PKEY_CTX_IS_DERIVE_OP(ctx) \
+    ((ctx)->operation == EVP_PKEY_OP_DERIVE)
+
+void openssl_add_all_ciphers_int(void);
+void openssl_add_all_digests_int(void);
+void evp_cleanup_int(void);
+void evp_app_cleanup_int(void);
+
+/* KEYMGMT helper functions */
+void *evp_keymgmt_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
+void evp_keymgmt_clear_pkey_cache(EVP_PKEY *pk);
+
+/* KEYMGMT provider interface functions */
+void *evp_keymgmt_importdomparams(const EVP_KEYMGMT *keymgmt,
+                                  const OSSL_PARAM params[]);
+void *evp_keymgmt_gendomparams(const EVP_KEYMGMT *keymgmt,
+                            const OSSL_PARAM params[]);
+void evp_keymgmt_freedomparams(const EVP_KEYMGMT *keymgmt,
+                               void *provdomparams);
+int evp_keymgmt_exportdomparams(const EVP_KEYMGMT *keymgmt,
+                                void *provdomparams, OSSL_PARAM params[]);
+const OSSL_PARAM *
+evp_keymgmt_importdomparam_types(const EVP_KEYMGMT *keymgmt);
+const OSSL_PARAM *
+evp_keymgmt_exportdomparam_types(const EVP_KEYMGMT *keymgmt);
+
+void *evp_keymgmt_importkey(const EVP_KEYMGMT *keymgmt,
+                            const OSSL_PARAM params[]);
+void *evp_keymgmt_genkey(const EVP_KEYMGMT *keymgmt, void *domparams,
+                         const OSSL_PARAM params[]);
+void *evp_keymgmt_loadkey(const EVP_KEYMGMT *keymgmt,
+                          void *id, size_t idlen);
+void evp_keymgmt_freekey(const EVP_KEYMGMT *keymgmt, void *provkey);
+int evp_keymgmt_exportkey(const EVP_KEYMGMT *keymgmt,
+                               void *provkey, OSSL_PARAM params[]);
+const OSSL_PARAM *evp_keymgmt_importkey_types(const EVP_KEYMGMT *keymgmt);
+const OSSL_PARAM *evp_keymgmt_exportkey_types(const EVP_KEYMGMT *keymgmt);
+
+/* Pulling defines out of C source files */
+
+#define EVP_RC4_KEY_SIZE 16
+#ifndef TLS1_1_VERSION
+# define TLS1_1_VERSION   0x0302
+#endif
+
+void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags);
+
+/* EVP_ENCODE_CTX flags */
+/* Don't generate new lines when encoding */
+#define EVP_ENCODE_CTX_NO_NEWLINES          1
+/* Use the SRP base64 alphabet instead of the standard one */
+#define EVP_ENCODE_CTX_USE_SRP_ALPHABET     2
diff --git a/include/crypto/lhash.h b/include/crypto/lhash.h
new file mode 100644 (file)
index 0000000..de0c8b0
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef INTERNAL_LHASH_H
+# define INTERNAL_LHASH_H
+
+unsigned long openssl_lh_strcasehash(const char *);
+
+#endif
diff --git a/include/crypto/md32_common.h b/include/crypto/md32_common.h
new file mode 100644 (file)
index 0000000..3b16f1b
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*-
+ * This is a generic 32 bit "collector" for message digest algorithms.
+ * Whenever needed it collects input character stream into chunks of
+ * 32 bit values and invokes a block function that performs actual hash
+ * calculations.
+ *
+ * Porting guide.
+ *
+ * Obligatory macros:
+ *
+ * DATA_ORDER_IS_BIG_ENDIAN or DATA_ORDER_IS_LITTLE_ENDIAN
+ *      this macro defines byte order of input stream.
+ * HASH_CBLOCK
+ *      size of a unit chunk HASH_BLOCK operates on.
+ * HASH_LONG
+ *      has to be at least 32 bit wide.
+ * HASH_CTX
+ *      context structure that at least contains following
+ *      members:
+ *              typedef struct {
+ *                      ...
+ *                      HASH_LONG       Nl,Nh;
+ *                      either {
+ *                      HASH_LONG       data[HASH_LBLOCK];
+ *                      unsigned char   data[HASH_CBLOCK];
+ *                      };
+ *                      unsigned int    num;
+ *                      ...
+ *                      } HASH_CTX;
+ *      data[] vector is expected to be zeroed upon first call to
+ *      HASH_UPDATE.
+ * HASH_UPDATE
+ *      name of "Update" function, implemented here.
+ * HASH_TRANSFORM
+ *      name of "Transform" function, implemented here.
+ * HASH_FINAL
+ *      name of "Final" function, implemented here.
+ * HASH_BLOCK_DATA_ORDER
+ *      name of "block" function capable of treating *unaligned* input
+ *      message in original (data) byte order, implemented externally.
+ * HASH_MAKE_STRING
+ *      macro converting context variables to an ASCII hash string.
+ *
+ * MD5 example:
+ *
+ *      #define DATA_ORDER_IS_LITTLE_ENDIAN
+ *
+ *      #define HASH_LONG               MD5_LONG
+ *      #define HASH_CTX                MD5_CTX
+ *      #define HASH_CBLOCK             MD5_CBLOCK
+ *      #define HASH_UPDATE             MD5_Update
+ *      #define HASH_TRANSFORM          MD5_Transform
+ *      #define HASH_FINAL              MD5_Final
+ *      #define HASH_BLOCK_DATA_ORDER   md5_block_data_order
+ */
+
+#include <openssl/crypto.h>
+
+#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN)
+# error "DATA_ORDER must be defined!"
+#endif
+
+#ifndef HASH_CBLOCK
+# error "HASH_CBLOCK must be defined!"
+#endif
+#ifndef HASH_LONG
+# error "HASH_LONG must be defined!"
+#endif
+#ifndef HASH_CTX
+# error "HASH_CTX must be defined!"
+#endif
+
+#ifndef HASH_UPDATE
+# error "HASH_UPDATE must be defined!"
+#endif
+#ifndef HASH_TRANSFORM
+# error "HASH_TRANSFORM must be defined!"
+#endif
+#ifndef HASH_FINAL
+# error "HASH_FINAL must be defined!"
+#endif
+
+#ifndef HASH_BLOCK_DATA_ORDER
+# error "HASH_BLOCK_DATA_ORDER must be defined!"
+#endif
+
+#define ROTATE(a,n)     (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
+
+#if defined(DATA_ORDER_IS_BIG_ENDIAN)
+
+# define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))<<24),          \
+                         l|=(((unsigned long)(*((c)++)))<<16),          \
+                         l|=(((unsigned long)(*((c)++)))<< 8),          \
+                         l|=(((unsigned long)(*((c)++)))    )           )
+# define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
+                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
+                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
+                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
+                         l)
+
+#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
+
+# define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))    ),          \
+                         l|=(((unsigned long)(*((c)++)))<< 8),          \
+                         l|=(((unsigned long)(*((c)++)))<<16),          \
+                         l|=(((unsigned long)(*((c)++)))<<24)           )
+# define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)    )&0xff),      \
+                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
+                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
+                         *((c)++)=(unsigned char)(((l)>>24)&0xff),      \
+                         l)
+
+#endif
+
+/*
+ * Time for some action :-)
+ */
+
+int HASH_UPDATE(HASH_CTX *c, const void *data_, size_t len)
+{
+    const unsigned char *data = data_;
+    unsigned char *p;
+    HASH_LONG l;
+    size_t n;
+
+    if (len == 0)
+        return 1;
+
+    l = (c->Nl + (((HASH_LONG) len) << 3)) & 0xffffffffUL;
+    if (l < c->Nl)              /* overflow */
+        c->Nh++;
+    c->Nh += (HASH_LONG) (len >> 29); /* might cause compiler warning on
+                                       * 16-bit */
+    c->Nl = l;
+
+    n = c->num;
+    if (n != 0) {
+        p = (unsigned char *)c->data;
+
+        if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) {
+            memcpy(p + n, data, HASH_CBLOCK - n);
+            HASH_BLOCK_DATA_ORDER(c, p, 1);
+            n = HASH_CBLOCK - n;
+            data += n;
+            len -= n;
+            c->num = 0;
+            /*
+             * We use memset rather than OPENSSL_cleanse() here deliberately.
+             * Using OPENSSL_cleanse() here could be a performance issue. It
+             * will get properly cleansed on finalisation so this isn't a
+             * security problem.
+             */
+            memset(p, 0, HASH_CBLOCK); /* keep it zeroed */
+        } else {
+            memcpy(p + n, data, len);
+            c->num += (unsigned int)len;
+            return 1;
+        }
+    }
+
+    n = len / HASH_CBLOCK;
+    if (n > 0) {
+        HASH_BLOCK_DATA_ORDER(c, data, n);
+        n *= HASH_CBLOCK;
+        data += n;
+        len -= n;
+    }
+
+    if (len != 0) {
+        p = (unsigned char *)c->data;
+        c->num = (unsigned int)len;
+        memcpy(p, data, len);
+    }
+    return 1;
+}
+
+void HASH_TRANSFORM(HASH_CTX *c, const unsigned char *data)
+{
+    HASH_BLOCK_DATA_ORDER(c, data, 1);
+}
+
+int HASH_FINAL(unsigned char *md, HASH_CTX *c)
+{
+    unsigned char *p = (unsigned char *)c->data;
+    size_t n = c->num;
+
+    p[n] = 0x80;                /* there is always room for one */
+    n++;
+
+    if (n > (HASH_CBLOCK - 8)) {
+        memset(p + n, 0, HASH_CBLOCK - n);
+        n = 0;
+        HASH_BLOCK_DATA_ORDER(c, p, 1);
+    }
+    memset(p + n, 0, HASH_CBLOCK - 8 - n);
+
+    p += HASH_CBLOCK - 8;
+#if   defined(DATA_ORDER_IS_BIG_ENDIAN)
+    (void)HOST_l2c(c->Nh, p);
+    (void)HOST_l2c(c->Nl, p);
+#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
+    (void)HOST_l2c(c->Nl, p);
+    (void)HOST_l2c(c->Nh, p);
+#endif
+    p -= HASH_CBLOCK;
+    HASH_BLOCK_DATA_ORDER(c, p, 1);
+    c->num = 0;
+    OPENSSL_cleanse(p, HASH_CBLOCK);
+
+#ifndef HASH_MAKE_STRING
+# error "HASH_MAKE_STRING must be defined!"
+#else
+    HASH_MAKE_STRING(c, md);
+#endif
+
+    return 1;
+}
+
+#ifndef MD32_REG_T
+# if defined(__alpha) || defined(__sparcv9) || defined(__mips)
+#  define MD32_REG_T long
+/*
+ * This comment was originally written for MD5, which is why it
+ * discusses A-D. But it basically applies to all 32-bit digests,
+ * which is why it was moved to common header file.
+ *
+ * In case you wonder why A-D are declared as long and not
+ * as MD5_LONG. Doing so results in slight performance
+ * boost on LP64 architectures. The catch is we don't
+ * really care if 32 MSBs of a 64-bit register get polluted
+ * with eventual overflows as we *save* only 32 LSBs in
+ * *either* case. Now declaring 'em long excuses the compiler
+ * from keeping 32 MSBs zeroed resulting in 13% performance
+ * improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
+ * Well, to be honest it should say that this *prevents*
+ * performance degradation.
+ */
+# else
+/*
+ * Above is not absolute and there are LP64 compilers that
+ * generate better code if MD32_REG_T is defined int. The above
+ * pre-processor condition reflects the circumstances under which
+ * the conclusion was made and is subject to further extension.
+ */
+#  define MD32_REG_T int
+# endif
+#endif
diff --git a/include/crypto/modes.h b/include/crypto/modes.h
new file mode 100644 (file)
index 0000000..08e4ffa
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2010-2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* TODO(3.0) Move this header into provider when dependencies are removed */
+#include <openssl/modes.h>
+
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+typedef __int64 i64;
+typedef unsigned __int64 u64;
+# define U64(C) C##UI64
+#elif defined(__arch64__)
+typedef long i64;
+typedef unsigned long u64;
+# define U64(C) C##UL
+#else
+typedef long long i64;
+typedef unsigned long long u64;
+# define U64(C) C##ULL
+#endif
+
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+#define STRICT_ALIGNMENT 1
+#ifndef PEDANTIC
+# if defined(__i386)    || defined(__i386__)    || \
+     defined(__x86_64)  || defined(__x86_64__)  || \
+     defined(_M_IX86)   || defined(_M_AMD64)    || defined(_M_X64) || \
+     defined(__aarch64__)                       || \
+     defined(__s390__)  || defined(__s390x__)
+#  undef STRICT_ALIGNMENT
+# endif
+#endif
+
+#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+# if defined(__GNUC__) && __GNUC__>=2
+#  if defined(__x86_64) || defined(__x86_64__)
+#   define BSWAP8(x) ({ u64 ret_=(x);                   \
+                        asm ("bswapq %0"                \
+                        : "+r"(ret_));   ret_;          })
+#   define BSWAP4(x) ({ u32 ret_=(x);                   \
+                        asm ("bswapl %0"                \
+                        : "+r"(ret_));   ret_;          })
+#  elif (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
+#   define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x);   \
+                        asm ("bswapl %0; bswapl %1"     \
+                        : "+r"(hi_),"+r"(lo_));         \
+                        (u64)hi_<<32|lo_;               })
+#   define BSWAP4(x) ({ u32 ret_=(x);                   \
+                        asm ("bswapl %0"                \
+                        : "+r"(ret_));   ret_;          })
+#  elif defined(__aarch64__)
+#   define BSWAP8(x) ({ u64 ret_;                       \
+                        asm ("rev %0,%1"                \
+                        : "=r"(ret_) : "r"(x)); ret_;   })
+#   define BSWAP4(x) ({ u32 ret_;                       \
+                        asm ("rev %w0,%w1"              \
+                        : "=r"(ret_) : "r"(x)); ret_;   })
+#  elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT)
+#   define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x);   \
+                        asm ("rev %0,%0; rev %1,%1"     \
+                        : "+r"(hi_),"+r"(lo_));         \
+                        (u64)hi_<<32|lo_;               })
+#   define BSWAP4(x) ({ u32 ret_;                       \
+                        asm ("rev %0,%1"                \
+                        : "=r"(ret_) : "r"((u32)(x)));  \
+                        ret_;                           })
+#  endif
+# elif defined(_MSC_VER)
+#  if _MSC_VER>=1300
+#   include <stdlib.h>
+#   pragma intrinsic(_byteswap_uint64,_byteswap_ulong)
+#   define BSWAP8(x)    _byteswap_uint64((u64)(x))
+#   define BSWAP4(x)    _byteswap_ulong((u32)(x))
+#  elif defined(_M_IX86)
+__inline u32 _bswap4(u32 val)
+{
+_asm mov eax, val _asm bswap eax}
+#   define BSWAP4(x)    _bswap4(x)
+#  endif
+# endif
+#endif
+#if defined(BSWAP4) && !defined(STRICT_ALIGNMENT)
+# define GETU32(p)       BSWAP4(*(const u32 *)(p))
+# define PUTU32(p,v)     *(u32 *)(p) = BSWAP4(v)
+#else
+# define GETU32(p)       ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
+# define PUTU32(p,v)     ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
+#endif
+/*- GCM definitions */ typedef struct {
+    u64 hi, lo;
+} u128;
+
+#ifdef  TABLE_BITS
+# undef  TABLE_BITS
+#endif
+/*
+ * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
+ * never be set to 8 [or 1]. For further information see gcm128.c.
+ */
+#define TABLE_BITS 4
+
+struct gcm128_context {
+    /* Following 6 names follow names in GCM specification */
+    union {
+        u64 u[2];
+        u32 d[4];
+        u8 c[16];
+        size_t t[16 / sizeof(size_t)];
+    } Yi, EKi, EK0, len, Xi, H;
+    /*
+     * Relative position of Xi, H and pre-computed Htable is used in some
+     * assembler modules, i.e. don't change the order!
+     */
+#if TABLE_BITS==8
+    u128 Htable[256];
+#else
+    u128 Htable[16];
+    void (*gmult) (u64 Xi[2], const u128 Htable[16]);
+    void (*ghash) (u64 Xi[2], const u128 Htable[16], const u8 *inp,
+                   size_t len);
+#endif
+    unsigned int mres, ares;
+    block128_f block;
+    void *key;
+#if !defined(OPENSSL_SMALL_FOOTPRINT)
+    unsigned char Xn[48];
+#endif
+};
+
+/*
+ * The maximum permitted number of cipher blocks per data unit in XTS mode.
+ * Reference IEEE Std 1619-2018.
+ */
+#define XTS_MAX_BLOCKS_PER_DATA_UNIT            (1<<20)
+
+struct xts128_context {
+    void *key1, *key2;
+    block128_f block1, block2;
+};
+
+struct ccm128_context {
+    union {
+        u64 u[2];
+        u8 c[16];
+    } nonce, cmac;
+    u64 blocks;
+    block128_f block;
+    void *key;
+};
+
+#ifndef OPENSSL_NO_OCB
+
+typedef union {
+    u64 a[2];
+    unsigned char c[16];
+} OCB_BLOCK;
+# define ocb_block16_xor(in1,in2,out) \
+    ( (out)->a[0]=(in1)->a[0]^(in2)->a[0], \
+      (out)->a[1]=(in1)->a[1]^(in2)->a[1] )
+# if STRICT_ALIGNMENT
+#  define ocb_block16_xor_misaligned(in1,in2,out) \
+    ocb_block_xor((in1)->c,(in2)->c,16,(out)->c)
+# else
+#  define ocb_block16_xor_misaligned ocb_block16_xor
+# endif
+
+struct ocb128_context {
+    /* Need both encrypt and decrypt key schedules for decryption */
+    block128_f encrypt;
+    block128_f decrypt;
+    void *keyenc;
+    void *keydec;
+    ocb128_f stream;    /* direction dependent */
+    /* Key dependent variables. Can be reused if key remains the same */
+    size_t l_index;
+    size_t max_l_index;
+    OCB_BLOCK l_star;
+    OCB_BLOCK l_dollar;
+    OCB_BLOCK *l;
+    /* Must be reset for each session */
+    struct {
+        u64 blocks_hashed;
+        u64 blocks_processed;
+        OCB_BLOCK offset_aad;
+        OCB_BLOCK sum;
+        OCB_BLOCK offset;
+        OCB_BLOCK checksum;
+    } sess;
+};
+#endif                          /* OPENSSL_NO_OCB */
+
+#ifndef OPENSSL_NO_SIV
+
+#define SIV_LEN 16
+
+typedef union siv_block_u {
+    uint64_t word[SIV_LEN/sizeof(uint64_t)];
+    unsigned char byte[SIV_LEN];
+} SIV_BLOCK;
+
+struct siv128_context {
+    /* d stores intermediate results of S2V; it corresponds to D from the
+       pseudocode in section 2.4 of RFC 5297. */
+    SIV_BLOCK d;
+    SIV_BLOCK tag;
+    EVP_CIPHER_CTX *cipher_ctx;
+    EVP_MAC *mac;
+    EVP_MAC_CTX *mac_ctx_init;
+    int final_ret;
+    int crypto_ok;
+};
+
+#endif /* OPENSSL_NO_SIV */
diff --git a/include/crypto/objects.h b/include/crypto/objects.h
new file mode 100644 (file)
index 0000000..7db718f
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/objects.h>
+
+void obj_cleanup_int(void);
diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h
new file mode 100644 (file)
index 0000000..46f834e
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <stddef.h>
+
+#define POLY1305_BLOCK_SIZE  16
+#define POLY1305_DIGEST_SIZE 16
+#define POLY1305_KEY_SIZE    32
+
+typedef struct poly1305_context POLY1305;
+
+size_t Poly1305_ctx_size(void);
+void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]);
+void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len);
+void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]);
diff --git a/include/crypto/rand.h b/include/crypto/rand.h
new file mode 100644 (file)
index 0000000..bc427e3
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * Licensed under the Apache License 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.openssl.org/source/license.html
+ * or in the file LICENSE in the source distribution.
+ */
+
+#ifndef HEADER_RAND_INT_H
+# define HEADER_RAND_INT_H
+
+# include <openssl/rand.h>
+
+/* forward declaration */
+typedef struct rand_pool_st RAND_POOL;
+
+void rand_cleanup_int(void);
+
+/* Hardware-based seeding functions. */
+size_t rand_acquire_entropy_from_tsc(RAND_POOL *pool);
+size_t rand_acquire_entropy_from_cpu(RAND_POOL *pool);
+
+/* DRBG entropy callbacks. */
+size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
+                             unsigned char **pout,
+                             int entropy, size_t min_len, size_t max_len,
+                             int prediction_resistance);
+void rand_drbg_cleanup_entropy(RAND_DRBG *drbg,
+                               unsigned char *out, size_t outlen);
+size_t rand_drbg_get_nonce(RAND_DRBG *drbg,
+                           unsigned char **pout,
+                           int entropy, size_t min_len, size_t max_len);
+void rand_drbg_cleanup_nonce(RAND_DRBG *drbg,
+                             unsigned char *out, size_t outlen);
+
+size_t rand_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout);
+
+void rand_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out);
+
+/* CRNG test entropy filter callbacks. */
+size_t rand_crngt_get_entropy(RAND_DRBG *drbg,
+                              unsigned char **pout,
+                              int entropy, size_t min_len, size_t max_len,
+                              int prediction_resistance);
+void rand_crngt_cleanup_entropy(RAND_DRBG *drbg,
+                                unsigned char *out, size_t outlen);
+
+/*
+ * RAND_POOL functions
+ */
+RAND_POOL *rand_pool_new(int entropy_requested, int secure,
+                         size_t min_len, size_t max_len);
+RAND_POOL *rand_pool_attach(const unsigned char *buffer, size_t len,
+                            size_t entropy);
+void rand_pool_free(RAND_POOL *pool);
+
+const unsigned char *rand_pool_buffer(RAND_POOL *pool);
+unsigned char *rand_pool_detach(RAND_POOL *pool);
+void rand_pool_reattach(RAND_POOL *pool, unsigned char *buffer);
+
+size_t rand_pool_entropy(RAND_POOL *pool);
+size_t rand_pool_length(RAND_POOL *pool);
+
+size_t rand_pool_entropy_available(RAND_POOL *pool);
+size_t rand_pool_entropy_needed(RAND_POOL *pool);
+/* |entropy_factor| expresses how many bits of data contain 1 bit of entropy */
+size_t rand_pool_bytes_needed(RAND_POOL *pool, unsigned int entropy_factor);
+size_t rand_pool_bytes_remaining(RAND_POOL *pool);
+
+int rand_pool_add(RAND_POOL *pool,
+                  const unsigned char *buffer, size_t len, size_t entropy);
+unsigned char *rand_pool_add_begin(RAND_POOL *pool, size_t len);
+int rand_pool_add_end(RAND_POOL *pool, size_t len, size_t entropy);
+
+
+/*
+ * Add random bytes to the pool to acquire requested amount of entropy
+ *
+ * This function is platform specific and tries to acquire the requested
+ * amount of entropy by polling platform specific entropy sources.
+ *
+ * If the function succeeds in acquiring at least |entropy_requested| bits
+ * of entropy, the total entropy count is returned. If it fails, it returns
+ * an entropy count of 0.
+ */
+size_t rand_pool_acquire_entropy(RAND_POOL *pool);
+
+/*
+ * Add some application specific nonce data
+ *
+ * This function is platform specific and adds some application specific
+ * data to the nonce used for instantiating the drbg.
+ *
+ * This data currently consists of the process and thread id, and a high
+ * resolution timestamp. The data does not include an atomic counter,
+ * because that is added by the calling function rand_drbg_get_nonce().
+ *
+ * Returns 1 on success and 0 on failure.
+ */
+int rand_pool_add_nonce_data(RAND_POOL *pool);
+
+
+/*
+ * Add some platform specific additional data
+ *
+ * This function is platform specific and adds some random noise to the
+ * additional data used for generating random bytes and for reseeding
+ * the drbg.
+ *
+ * Returns 1 on success and 0 on failure.
+ */
+int rand_pool_add_additional_data(RAND_POOL *pool);
+
+/*
+ * Initialise the random pool reseeding sources.
+ *
+ * Returns 1 on success and 0 on failure.
+ */
+int rand_pool_init(void);
+
+/*
+ * Finalise the random pool reseeding sources.
+ */
+void rand_pool_cleanup(void);
+
+/*
+ * Control the random pool use of open file descriptors.
+ */
+void rand_pool_keep_random_devices_open(int keep);
+
+/* Equivalent of RAND_priv_bytes() but additionally taking an OPENSSL_CTX */
+int rand_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
+
+/* Equivalent of RAND_bytes() but additionally taking an OPENSSL_CTX */
+int rand_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
+
+#endif
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
new file mode 100644 (file)
index 0000000..3863261
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates.  All rights reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_INTERNAL_SHA_H
+# define HEADER_INTERNAL_SHA_H
+
+# include <openssl/opensslconf.h>
+
+int sha512_224_init(SHA512_CTX *);
+int sha512_256_init(SHA512_CTX *);
+int sha1_ctrl(SHA_CTX *ctx, int cmd, int mslen, void *ms);
+
+#endif
diff --git a/include/crypto/siphash.h b/include/crypto/siphash.h
new file mode 100644 (file)
index 0000000..1575141
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <stddef.h>
+
+#define SIPHASH_BLOCK_SIZE        8
+#define SIPHASH_KEY_SIZE         16
+#define SIPHASH_MIN_DIGEST_SIZE   8
+#define SIPHASH_MAX_DIGEST_SIZE  16
+
+typedef struct siphash_st SIPHASH;
+
+size_t SipHash_ctx_size(void);
+size_t SipHash_hash_size(SIPHASH *ctx);
+int SipHash_set_hash_size(SIPHASH *ctx, size_t hash_size);
+int SipHash_Init(SIPHASH *ctx, const unsigned char *k,
+                 int crounds, int drounds);
+void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen);
+int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen);
diff --git a/include/crypto/siv.h b/include/crypto/siv.h
new file mode 100644 (file)
index 0000000..8a8ef6e
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OPENSSL_NO_SIV
+
+typedef struct siv128_context SIV128_CONTEXT;
+
+SIV128_CONTEXT *CRYPTO_siv128_new(const unsigned char *key, int klen,
+                                  EVP_CIPHER* cbc, EVP_CIPHER* ctr);
+int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
+                       const EVP_CIPHER* cbc, const EVP_CIPHER* ctr);
+int CRYPTO_siv128_copy_ctx(SIV128_CONTEXT *dest, SIV128_CONTEXT *src);
+int CRYPTO_siv128_aad(SIV128_CONTEXT *ctx, const unsigned char *aad,
+                      size_t len);
+int CRYPTO_siv128_encrypt(SIV128_CONTEXT *ctx,
+                          const unsigned char *in, unsigned char *out,
+                          size_t len);
+int CRYPTO_siv128_decrypt(SIV128_CONTEXT *ctx,
+                          const unsigned char *in, unsigned char *out,
+                          size_t len);
+int CRYPTO_siv128_finish(SIV128_CONTEXT *ctx);
+int CRYPTO_siv128_set_tag(SIV128_CONTEXT *ctx, const unsigned char *tag,
+                          size_t len);
+int CRYPTO_siv128_get_tag(SIV128_CONTEXT *ctx, unsigned char *tag, size_t len);
+int CRYPTO_siv128_cleanup(SIV128_CONTEXT *ctx);
+int CRYPTO_siv128_speed(SIV128_CONTEXT *ctx, int arg);
+
+#endif /* OPENSSL_NO_SIV */
diff --git a/include/crypto/sm2.h b/include/crypto/sm2.h
new file mode 100644 (file)
index 0000000..dad70e6
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017 Ribose Inc. All Rights Reserved.
+ * Ported from Ribose contributions from Botan.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_SM2_H
+# define HEADER_SM2_H
+# include <openssl/opensslconf.h>
+
+# ifndef OPENSSL_NO_SM2
+
+#  include <openssl/ec.h>
+
+/* The default user id as specified in GM/T 0009-2012 */
+#  define SM2_DEFAULT_USERID "1234567812345678"
+
+int sm2_compute_z_digest(uint8_t *out,
+                         const EVP_MD *digest,
+                         const uint8_t *id,
+                         const size_t id_len,
+                         const EC_KEY *key);
+
+/*
+ * SM2 signature operation. Computes Z and then signs H(Z || msg) using SM2
+ */
+ECDSA_SIG *sm2_do_sign(const EC_KEY *key,
+                       const EVP_MD *digest,
+                       const uint8_t *id,
+                       const size_t id_len,
+                       const uint8_t *msg, size_t msg_len);
+
+int sm2_do_verify(const EC_KEY *key,
+                  const EVP_MD *digest,
+                  const ECDSA_SIG *signature,
+                  const uint8_t *id,
+                  const size_t id_len,
+                  const uint8_t *msg, size_t msg_len);
+
+/*
+ * SM2 signature generation.
+ */
+int sm2_sign(const unsigned char *dgst, int dgstlen,
+             unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
+
+/*
+ * SM2 signature verification.
+ */
+int sm2_verify(const unsigned char *dgst, int dgstlen,
+               const unsigned char *sig, int siglen, EC_KEY *eckey);
+
+/*
+ * SM2 encryption
+ */
+int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
+                        size_t *ct_size);
+
+int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
+                       size_t *pt_size);
+
+int sm2_encrypt(const EC_KEY *key,
+                const EVP_MD *digest,
+                const uint8_t *msg,
+                size_t msg_len,
+                uint8_t *ciphertext_buf, size_t *ciphertext_len);
+
+int sm2_decrypt(const EC_KEY *key,
+                const EVP_MD *digest,
+                const uint8_t *ciphertext,
+                size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len);
+
+# endif /* OPENSSL_NO_SM2 */
+#endif
diff --git a/include/crypto/sm2err.h b/include/crypto/sm2err.h
new file mode 100644 (file)
index 0000000..923bb6c
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Generated by util/mkerr.pl DO NOT EDIT
+ * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_SM2ERR_H
+# define HEADER_SM2ERR_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/symhacks.h>
+
+
+# include <openssl/opensslconf.h>
+
+# ifndef OPENSSL_NO_SM2
+
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+int ERR_load_SM2_strings(void);
+
+/*
+ * SM2 function codes.
+ */
+# if !OPENSSL_API_3
+#   define SM2_F_PKEY_SM2_COPY                              0
+#   define SM2_F_PKEY_SM2_CTRL                              0
+#   define SM2_F_PKEY_SM2_CTRL_STR                          0
+#   define SM2_F_PKEY_SM2_DIGEST_CUSTOM                     0
+#   define SM2_F_PKEY_SM2_INIT                              0
+#   define SM2_F_PKEY_SM2_SIGN                              0
+#   define SM2_F_SM2_COMPUTE_MSG_HASH                       0
+#   define SM2_F_SM2_COMPUTE_USERID_DIGEST                  0
+#   define SM2_F_SM2_COMPUTE_Z_DIGEST                       0
+#   define SM2_F_SM2_DECRYPT                                0
+#   define SM2_F_SM2_ENCRYPT                                0
+#   define SM2_F_SM2_PLAINTEXT_SIZE                         0
+#   define SM2_F_SM2_SIGN                                   0
+#   define SM2_F_SM2_SIG_GEN                                0
+#   define SM2_F_SM2_SIG_VERIFY                             0
+#   define SM2_F_SM2_VERIFY                                 0
+# endif
+
+/*
+ * SM2 reason codes.
+ */
+#  define SM2_R_ASN1_ERROR                                 100
+#  define SM2_R_BAD_SIGNATURE                              101
+#  define SM2_R_BUFFER_TOO_SMALL                           107
+#  define SM2_R_DIST_ID_TOO_LARGE                          110
+#  define SM2_R_ID_NOT_SET                                 112
+#  define SM2_R_ID_TOO_LARGE                               111
+#  define SM2_R_INVALID_CURVE                              108
+#  define SM2_R_INVALID_DIGEST                             102
+#  define SM2_R_INVALID_DIGEST_TYPE                        103
+#  define SM2_R_INVALID_ENCODING                           104
+#  define SM2_R_INVALID_FIELD                              105
+#  define SM2_R_NO_PARAMETERS_SET                          109
+#  define SM2_R_USER_ID_TOO_LARGE                          106
+
+# endif
+#endif
diff --git a/include/crypto/sm4.h b/include/crypto/sm4.h
new file mode 100644 (file)
index 0000000..f2e1728
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017 Ribose Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_SM4_H
+# define HEADER_SM4_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/e_os2.h>
+
+# ifdef OPENSSL_NO_SM4
+#  error SM4 is disabled.
+# endif
+
+# define SM4_ENCRYPT     1
+# define SM4_DECRYPT     0
+
+# define SM4_BLOCK_SIZE    16
+# define SM4_KEY_SCHEDULE  32
+
+typedef struct SM4_KEY_st {
+    uint32_t rk[SM4_KEY_SCHEDULE];
+} SM4_KEY;
+
+int SM4_set_key(const uint8_t *key, SM4_KEY *ks);
+
+void SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks);
+
+void SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks);
+
+#endif
diff --git a/include/crypto/sparse_array.h b/include/crypto/sparse_array.h
new file mode 100644 (file)
index 0000000..037ccfe
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_SPARSE_ARRAY_H
+# define HEADER_SPARSE_ARRAY_H
+
+# include <openssl/e_os2.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define SPARSE_ARRAY_OF(type) struct sparse_array_st_ ## type
+
+# define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
+    SPARSE_ARRAY_OF(type); \
+    static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * \
+        ossl_sa_##type##_new(void) \
+    { \
+        return (SPARSE_ARRAY_OF(type) *)OPENSSL_SA_new(); \
+    } \
+    static ossl_unused ossl_inline void ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) *sa) \
+    { \
+        OPENSSL_SA_free((OPENSSL_SA *)sa); \
+    } \
+    static ossl_unused ossl_inline void ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) *sa) \
+    { \
+        OPENSSL_SA_free_leaves((OPENSSL_SA *)sa); \
+    } \
+    static ossl_unused ossl_inline size_t ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) *sa) \
+    { \
+        return OPENSSL_SA_num((OPENSSL_SA *)sa); \
+    } \
+    static ossl_unused ossl_inline void ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) *sa, \
+                                                   void (*leaf)(ossl_uintmax_t, \
+                                                                type *)) \
+    { \
+        OPENSSL_SA_doall((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *))leaf); \
+    } \
+    static ossl_unused ossl_inline \
+    void ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) *sa, \
+                                    void (*leaf)(ossl_uintmax_t, type *, void *), \
+                                    void *arg) \
+    { \
+        OPENSSL_SA_doall_arg((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *, \
+                                                void *))leaf, \
+                             arg); \
+    } \
+    static ossl_unused ossl_inline ctype *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) *sa, \
+                                                  ossl_uintmax_t n) \
+    { \
+        return (type *)OPENSSL_SA_get((OPENSSL_SA *)sa, n); \
+    } \
+    static ossl_unused ossl_inline int ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) *sa, \
+                                                ossl_uintmax_t n, ctype *val) \
+    { \
+        return OPENSSL_SA_set((OPENSSL_SA *)sa, n, (void *)val); \
+    } \
+    SPARSE_ARRAY_OF(type)
+
+# define DEFINE_SPARSE_ARRAY_OF(type) \
+    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
+# define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
+    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
+
+typedef struct sparse_array_st OPENSSL_SA;
+OPENSSL_SA *OPENSSL_SA_new(void);
+void OPENSSL_SA_free(OPENSSL_SA *sa);
+void OPENSSL_SA_free_leaves(OPENSSL_SA *sa);
+size_t OPENSSL_SA_num(const OPENSSL_SA *sa);
+void OPENSSL_SA_doall(const OPENSSL_SA *sa,
+                      void (*leaf)(ossl_uintmax_t, void *));
+void OPENSSL_SA_doall_arg(const OPENSSL_SA *sa,
+                          void (*leaf)(ossl_uintmax_t, void *, void *), void *);
+void *OPENSSL_SA_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
+int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
+
+# ifdef  __cplusplus
+}
+# endif
+#endif
diff --git a/include/crypto/store.h b/include/crypto/store.h
new file mode 100644 (file)
index 0000000..afad09c
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_STORE_H
+# define HEADER_STORE_H
+
+# include <openssl/bio.h>
+# include <openssl/store.h>
+# include <openssl/ui.h>
+
+/*
+ * Two functions to read PEM data off an already opened BIO.  To be used
+ * instead of OSSLSTORE_open() and OSSLSTORE_close().  Everything is done
+ * as usual with OSSLSTORE_load() and OSSLSTORE_eof().
+ */
+OSSL_STORE_CTX *ossl_store_attach_pem_bio(BIO *bp, const UI_METHOD *ui_method,
+                                          void *ui_data);
+int ossl_store_detach_pem_bio(OSSL_STORE_CTX *ctx);
+
+void ossl_store_cleanup_int(void);
+
+#endif
diff --git a/include/crypto/x509.h b/include/crypto/x509.h
new file mode 100644 (file)
index 0000000..11a7769
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include "internal/refcount.h"
+
+/* Internal X509 structures and functions: not for application use */
+
+/* Note: unless otherwise stated a field pointer is mandatory and should
+ * never be set to NULL: the ASN.1 code and accessors rely on mandatory
+ * fields never being NULL.
+ */
+
+/*
+ * name entry structure, equivalent to AttributeTypeAndValue defined
+ * in RFC5280 et al.
+ */
+struct X509_name_entry_st {
+    ASN1_OBJECT *object;        /* AttributeType */
+    ASN1_STRING *value;         /* AttributeValue */
+    int set;                    /* index of RDNSequence for this entry */
+    int size;                   /* temp variable */
+};
+
+/* Name from RFC 5280. */
+struct X509_name_st {
+    STACK_OF(X509_NAME_ENTRY) *entries; /* DN components */
+    int modified;               /* true if 'bytes' needs to be built */
+    BUF_MEM *bytes;             /* cached encoding: cannot be NULL */
+    /* canonical encoding used for rapid Name comparison */
+    unsigned char *canon_enc;
+    int canon_enclen;
+} /* X509_NAME */ ;
+
+/* Signature info structure */
+
+struct x509_sig_info_st {
+    /* NID of message digest */
+    int mdnid;
+    /* NID of public key algorithm */
+    int pknid;
+    /* Security bits */
+    int secbits;
+    /* Various flags */
+    uint32_t flags;
+};
+
+/* PKCS#10 certificate request */
+
+struct X509_req_info_st {
+    ASN1_ENCODING enc;          /* cached encoding of signed part */
+    ASN1_INTEGER *version;      /* version, defaults to v1(0) so can be NULL */
+    X509_NAME *subject;         /* certificate request DN */
+    X509_PUBKEY *pubkey;        /* public key of request */
+    /*
+     * Zero or more attributes.
+     * NB: although attributes is a mandatory field some broken
+     * encodings omit it so this may be NULL in that case.
+     */
+    STACK_OF(X509_ATTRIBUTE) *attributes;
+};
+
+struct X509_req_st {
+    X509_REQ_INFO req_info;     /* signed certificate request data */
+    X509_ALGOR sig_alg;         /* signature algorithm */
+    ASN1_BIT_STRING *signature; /* signature */
+    CRYPTO_REF_COUNT references;
+    CRYPTO_RWLOCK *lock;
+# ifndef OPENSSL_NO_SM2
+    ASN1_OCTET_STRING *sm2_id;
+# endif
+};
+
+struct X509_crl_info_st {
+    ASN1_INTEGER *version;      /* version: defaults to v1(0) so may be NULL */
+    X509_ALGOR sig_alg;         /* signature algorithm */
+    X509_NAME *issuer;          /* CRL issuer name */
+    ASN1_TIME *lastUpdate;      /* lastUpdate field */
+    ASN1_TIME *nextUpdate;      /* nextUpdate field: optional */
+    STACK_OF(X509_REVOKED) *revoked;        /* revoked entries: optional */
+    STACK_OF(X509_EXTENSION) *extensions;   /* extensions: optional */
+    ASN1_ENCODING enc;                      /* encoding of signed portion of CRL */
+};
+
+struct X509_crl_st {
+    X509_CRL_INFO crl;          /* signed CRL data */
+    X509_ALGOR sig_alg;         /* CRL signature algorithm */
+    ASN1_BIT_STRING signature;  /* CRL signature */
+    CRYPTO_REF_COUNT references;
+    int flags;
+    /*
+     * Cached copies of decoded extension values, since extensions
+     * are optional any of these can be NULL.
+     */
+    AUTHORITY_KEYID *akid;
+    ISSUING_DIST_POINT *idp;
+    /* Convenient breakdown of IDP */
+    int idp_flags;
+    int idp_reasons;
+    /* CRL and base CRL numbers for delta processing */
+    ASN1_INTEGER *crl_number;
+    ASN1_INTEGER *base_crl_number;
+    STACK_OF(GENERAL_NAMES) *issuers;
+    /* hash of CRL */
+    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+    /* alternative method to handle this CRL */
+    const X509_CRL_METHOD *meth;
+    void *meth_data;
+    CRYPTO_RWLOCK *lock;
+};
+
+struct x509_revoked_st {
+    ASN1_INTEGER serialNumber; /* revoked entry serial number */
+    ASN1_TIME *revocationDate;  /* revocation date */
+    STACK_OF(X509_EXTENSION) *extensions;   /* CRL entry extensions: optional */
+    /* decoded value of CRLissuer extension: set if indirect CRL */
+    STACK_OF(GENERAL_NAME) *issuer;
+    /* revocation reason: set to CRL_REASON_NONE if reason extension absent */
+    int reason;
+    /*
+     * CRL entries are reordered for faster lookup of serial numbers. This
+     * field contains the original load sequence for this entry.
+     */
+    int sequence;
+};
+
+/*
+ * This stuff is certificate "auxiliary info": it contains details which are
+ * useful in certificate stores and databases. When used this is tagged onto
+ * the end of the certificate itself. OpenSSL specific structure not defined
+ * in any RFC.
+ */
+
+struct x509_cert_aux_st {
+    STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */
+    STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */
+    ASN1_UTF8STRING *alias;     /* "friendly name" */
+    ASN1_OCTET_STRING *keyid;   /* key id of private key */
+    STACK_OF(X509_ALGOR) *other; /* other unspecified info */
+};
+
+struct x509_cinf_st {
+    ASN1_INTEGER *version;      /* [ 0 ] default of v1 */
+    ASN1_INTEGER serialNumber;
+    X509_ALGOR signature;
+    X509_NAME *issuer;
+    X509_VAL validity;
+    X509_NAME *subject;
+    X509_PUBKEY *key;
+    ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */
+    ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */
+    STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */
+    ASN1_ENCODING enc;
+};
+
+struct x509_st {
+    X509_CINF cert_info;
+    X509_ALGOR sig_alg;
+    ASN1_BIT_STRING signature;
+    X509_SIG_INFO siginf;
+    CRYPTO_REF_COUNT references;
+    CRYPTO_EX_DATA ex_data;
+    /* These contain copies of various extension values */
+    long ex_pathlen;
+    long ex_pcpathlen;
+    uint32_t ex_flags;
+    uint32_t ex_kusage;
+    uint32_t ex_xkusage;
+    uint32_t ex_nscert;
+    ASN1_OCTET_STRING *skid;
+    AUTHORITY_KEYID *akid;
+    X509_POLICY_CACHE *policy_cache;
+    STACK_OF(DIST_POINT) *crldp;
+    STACK_OF(GENERAL_NAME) *altname;
+    NAME_CONSTRAINTS *nc;
+# ifndef OPENSSL_NO_RFC3779
+    STACK_OF(IPAddressFamily) *rfc3779_addr;
+    struct ASIdentifiers_st *rfc3779_asid;
+# endif
+    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+    X509_CERT_AUX *aux;
+    CRYPTO_RWLOCK *lock;
+    volatile int ex_cached;
+# ifndef OPENSSL_NO_SM2
+    ASN1_OCTET_STRING *sm2_id;
+# endif
+} /* X509 */ ;
+
+/*
+ * This is a used when verifying cert chains.  Since the gathering of the
+ * cert chain can take some time (and have to be 'retried', this needs to be
+ * kept and passed around.
+ */
+struct x509_store_ctx_st {      /* X509_STORE_CTX */
+    X509_STORE *store;
+    /* The following are set by the caller */
+    /* The cert to check */
+    X509 *cert;
+    /* chain of X509s - untrusted - passed in */
+    STACK_OF(X509) *untrusted;
+    /* set of CRLs passed in */
+    STACK_OF(X509_CRL) *crls;
+    X509_VERIFY_PARAM *param;
+    /* Other info for use with get_issuer() */
+    void *other_ctx;
+    /* Callbacks for various operations */
+    /* called to verify a certificate */
+    int (*verify) (X509_STORE_CTX *ctx);
+    /* error callback */
+    int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
+    /* get issuers cert from ctx */
+    int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+    /* check issued */
+    int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
+    /* Check revocation status of chain */
+    int (*check_revocation) (X509_STORE_CTX *ctx);
+    /* retrieve CRL */
+    int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
+    /* Check CRL validity */
+    int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
+    /* Check certificate against CRL */
+    int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
+    /* Check policy status of the chain */
+    int (*check_policy) (X509_STORE_CTX *ctx);
+    STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    int (*cleanup) (X509_STORE_CTX *ctx);
+    /* The following is built up */
+    /* if 0, rebuild chain */
+    int valid;
+    /* number of untrusted certs */
+    int num_untrusted;
+    /* chain of X509s - built up and trusted */
+    STACK_OF(X509) *chain;
+    /* Valid policy tree */
+    X509_POLICY_TREE *tree;
+    /* Require explicit policy value */
+    int explicit_policy;
+    /* When something goes wrong, this is why */
+    int error_depth;
+    int error;
+    X509 *current_cert;
+    /* cert currently being tested as valid issuer */
+    X509 *current_issuer;
+    /* current CRL */
+    X509_CRL *current_crl;
+    /* score of current CRL */
+    int current_crl_score;
+    /* Reason mask */
+    unsigned int current_reasons;
+    /* For CRL path validation: parent context */
+    X509_STORE_CTX *parent;
+    CRYPTO_EX_DATA ex_data;
+    SSL_DANE *dane;
+    /* signed via bare TA public key, rather than CA certificate */
+    int bare_ta_signed;
+};
+
+/* PKCS#8 private key info structure */
+
+struct pkcs8_priv_key_info_st {
+    ASN1_INTEGER *version;
+    X509_ALGOR *pkeyalg;
+    ASN1_OCTET_STRING *pkey;
+    STACK_OF(X509_ATTRIBUTE) *attributes;
+};
+
+struct X509_sig_st {
+    X509_ALGOR *algor;
+    ASN1_OCTET_STRING *digest;
+};
+
+struct x509_object_st {
+    /* one of the above types */
+    X509_LOOKUP_TYPE type;
+    union {
+        char *ptr;
+        X509 *x509;
+        X509_CRL *crl;
+        EVP_PKEY *pkey;
+    } data;
+};
+
+int a2i_ipadd(unsigned char *ipout, const char *ipasc);
+int x509_set1_time(ASN1_TIME **ptm, const ASN1_TIME *tm);
+
+void x509_init_sig_info(X509 *x);
index 9642a3c1531f1fb8d5fe9811db1083e0b0480c03..80b2952494a1850952a7582e6064afb5d4aef59d 100644 (file)
@@ -9,7 +9,7 @@ IF[{- !$disabled{fips} -}]
     SOURCE[fips]=fips.ld
     GENERATE[fips.ld]=../util/providers.num
   ENDIF
-  INCLUDE[fips]=.. ../include ../crypto/include common/include
+  INCLUDE[fips]=.. ../include common/include
   DEFINE[fips]=FIPS_MODE
 ENDIF
 
@@ -25,6 +25,6 @@ IF[{- !$disabled{legacy} -}]
       GENERATE[legacy.ld]=../util/providers.num
     ENDIF
     DEPEND[legacy]=../libcrypto
-    INCLUDE[legacy]=.. ../include ../crypto/include common/include
+    INCLUDE[legacy]=.. ../include common/include
   ENDIF
 ENDIF
index b5c79daee747f57c41030be10347aa28b8c89e72..09cd70cc536ba254c21518873c97e9a7eae6fe5a 100644 (file)
@@ -12,7 +12,7 @@
 #include "cipher_locl.h"
 #include "internal/ciphers/cipher_gcm.h"
 #include "internal/providercommonerr.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "internal/provider_ctx.h"
 
 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len);
index e3e80d186ab3c01152877a552aa1eac3b71502b3..05485316788d91252be65609a970eb6e75c06d29 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "cipher_locl.h"
 #include "internal/ciphers/cipher_tdes.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "internal/provider_algs.h"
 #include "internal/providercommonerr.h"
 
index b87267650601d56f9c53a3ffa292292b56bb62b0..d2c7df2ee684028baa2c34b7292907d8ac34790e 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/core_names.h>
 #include "internal/digestcommon.h"
 #include "internal/provider_algs.h"
-#include "internal/sha.h"
+#include "crypto/sha.h"
 
 static OSSL_OP_digest_set_ctx_params_fn sha1_set_ctx_params;
 static OSSL_OP_digest_settable_ctx_params_fn sha1_settable_ctx_params;
index 7539d8cb8108684b0d6d81e17d7735d998333adc..9a01abf6cba0b2c387e3bfdb4803b714431ba34c 100644 (file)
@@ -12,8 +12,8 @@
 #include <openssl/core_names.h>
 #include <openssl/evp.h>
 #include "internal/cryptlib.h"
-#include "internal/modes_int.h"
-#include "internal/ciphermode_platform.h"
+#include "crypto/modes.h"
+#include "crypto/ciphermode_platform.h"
 
 #define MAXCHUNK    ((size_t)1 << (sizeof(long) * 8 - 2))
 #define MAXBITCHUNK ((size_t)1 << (sizeof(size_t) * 8 - 4))
index ac5cc34a215e7d1326693bb9eaec39b26c0f4829..041811f0e16122c6a551e4fa878e1c84498013fc 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index 77cee258e8fdff6f1065a4e48894e2e7966852a2..ffffef0b17c75e6828eadaa3d1dc5dce4d6a1ded 100644 (file)
@@ -35,7 +35,7 @@
 #include <openssl/params.h>
 
 #include "internal/cryptlib.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "internal/provider_algs.h"
 #include "internal/provider_ctx.h"
index c8480125b20e81f35c5d7f39283871a7e350169d..b98123b8729cadc26f1c637c66df3ffd6b7eb1dd 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index d74da436a2712e068683ed1ea49ee29c9d5067d5..1e538a9c0afc1b80a96ad54c1c7762303f8f95a8 100644 (file)
@@ -44,7 +44,7 @@
 #include <openssl/params.h>
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index 3053b756dc68157a19c043ee24e2b6c74fc76ded..af49b1b044a000579c0a8a17e8a09b1ce13f30a0 100644 (file)
@@ -54,7 +54,7 @@
 #include <openssl/params.h>
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index 984be8f4aae856e06e5d23af72c3e8bc32dce122..e95e4ca93c7bfad2c99026b9d324e37113d96085 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/aria.h"
+#include "crypto/aria.h"
 #include "internal/ciphers/ciphercommon.h"
 
 typedef struct prov_aria_ctx_st {
index b3e990766df635fec01831c653e4474da6dbe2a5..fe0a3908bc02686a3b64ff539bbafeb36694cff7 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/aria.h"
+#include "crypto/aria.h"
 #include "internal/ciphers/ciphercommon.h"
 #include "internal/ciphers/cipher_ccm.h"
 
index 3499ceaaf7506a1c4aa38bc832f94cd90f0ac457..ac5c248201b3529c8c1f62828cac52c20e087ef3 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/aria.h"
+#include "crypto/aria.h"
 #include "internal/ciphers/ciphercommon.h"
 #include "internal/ciphers/cipher_gcm.h"
 
index a1976fb7370e7adc2e6c8bd285a3a4a0b37cf646..9456c205b8ff32b109f4eea9bb5e5481ba4d8654 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "cipher_locl.h"
 #include "cipher_des.h"
-#include "internal/rand_int.h"
+#include "crypto/rand.h"
 #include "internal/provider_algs.h"
 #include "internal/providercommonerr.h"
 
index 842c218f3079aa76c376eb003ced253d98aa2d7d..4740bb33559f9734728ae05104ec32a6f7f50415 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "internal/ciphers/ciphercommon.h"
-#include "internal/sm4.h"
+#include "crypto/sm4.h"
 
 typedef struct prov_cast_ctx_st {
     PROV_CIPHER_CTX base;      /* Must be first */
index 08662dbdb026529efa78444b9536adce671ddeed..b48b3c973375d4950bd04e0b1401ae1ffed2a801 100644 (file)
@@ -9,8 +9,8 @@
 
 #include <openssl/sha.h>
 #include "cipher_tdes_default.h"
-#include "internal/evp_int.h"
-#include "internal/rand_int.h"
+#include "crypto/evp.h"
+#include "crypto/rand.h"
 #include "internal/provider_algs.h"
 #include "internal/providercommonerr.h"
 
index abb4437d706ac2f39f4a9845b4c6465c5a6d2c83..505963eec51cc187b07d77d8f9ecd40c93a01219 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/kdf.h>
 #include <openssl/err.h>
 #include <openssl/core_names.h>
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "internal/provider_algs.h"
 #include "internal/provider_ctx.h"
index 2db539729417aad4925c3409c24244d23aca9de4..7e6445dbddb41e01a357e6580e4cb6c1aef1f564 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index 7c3afef91113830d20ac7dee93960538c11a2e58..65c586fb999dfb703249fa2045de347ff95cc898 100644 (file)
@@ -24,7 +24,7 @@
 # include <openssl/core_names.h>
 # include "internal/cryptlib.h"
 # include "internal/numbers.h"
-# include "internal/evp_int.h"
+# include "crypto/evp.h"
 # include "internal/provider_ctx.h"
 # include "internal/providercommonerr.h"
 # include "internal/provider_algs.h"
index e76f982ace207c6848a39a04fe78c95f46df9f40..88005716e6ca3adb348c2a44c8c24891a6959f9b 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/evp.h>
 #include <openssl/err.h>
 
-#include "internal/poly1305.h"
+#include "crypto/poly1305.h"
 /*
  * TODO(3.0) when poly1305 has moved entirely to our providers, this
  * header should be moved to the provider include directory.  For the
index 1a36846bfe36b588861305724cea517021256a87..a9511925f0e2a675ae70b42d9962c71b41d9ee32 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/evp.h>
 #include <openssl/err.h>
 
-#include "internal/siphash.h"
+#include "crypto/siphash.h"
 /*
  * TODO(3.0) when siphash has moved entirely to our providers, this
  * header should be moved to the provider include directory.  For the
index ce843552d7a57a83d8fe627c90575d0a20a6e75e..166d02496e6ff4456bab50eb7c40036a4dd802dc 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "internal/cryptlib.h"
 #include "internal/property.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider_algs.h"
 #include "internal/provider_ctx.h"
 #include "internal/providercommon.h"
index a62f5e4cd4a0cd9fe2e20369cdac5da01b73f1cd..21e574d3fba986d22c23c10de65bc162f7cd6b98 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 
 #include <openssl/bn.h>
-#include "internal/asn1_dsa.h"
+#include "crypto/asn1_dsa.h"
 #include "testutil.h"
 
 static unsigned char t_dsa_sig[] = {
index 753449cabb44ee4b2e2c1b50ba489941791ebc97..e77299a7c8e38e1c3797d0a1da16de1cc28090e3 100644 (file)
@@ -59,7 +59,7 @@ static int test_tbl_standard(void)
  *
  ***/
 
-#include "internal/asn1_int.h"
+#include "crypto/asn1.h"
 #include "../crypto/asn1/standard_methods.h"
 
 static int test_standard_methods(void)
index cf47e8b7346277b356608b5c9f206273372cc69b..f3e874960db747965f29e23e24046728151a4cd1 100644 (file)
@@ -20,7 +20,7 @@
 #include "internal/numbers.h"
 #include "testutil.h"
 #include "bn_prime.h"
-#include "internal/bn_int.h"
+#include "crypto/bn.h"
 
 static BN_CTX *ctx;
 
index caa70da821fc13a49f6efd306511eeb451da4677..7328641243f41f0f220e1d3948fb17343167e7ad 100644 (file)
@@ -546,7 +546,7 @@ IF[{- !$disabled{tests} -}]
     DEPEND[property_test]=../libcrypto.a libtestutil.a
 
     SOURCE[ctype_internal_test]=ctype_internal_test.c
-    INCLUDE[ctype_internal_test]=.. ../crypto/include ../include ../apps/include
+    INCLUDE[ctype_internal_test]=.. ../include ../apps/include
     DEPEND[ctype_internal_test]=../libcrypto.a libtestutil.a
 
     SOURCE[sparse_array_test]=sparse_array_test.c
@@ -578,11 +578,11 @@ IF[{- !$disabled{tests} -}]
     DEPEND[rdrand_sanitytest]=../libcrypto.a libtestutil.a
 
     SOURCE[rsa_sp800_56b_test]=rsa_sp800_56b_test.c
-    INCLUDE[rsa_sp800_56b_test]=.. ../include ../crypto/include ../crypto/rsa ../apps/include
+    INCLUDE[rsa_sp800_56b_test]=.. ../include ../crypto/rsa ../apps/include
     DEPEND[rsa_sp800_56b_test]=../libcrypto.a libtestutil.a
 
     SOURCE[bn_internal_test]=bn_internal_test.c
-    INCLUDE[bn_internal_test]=.. ../include ../crypto/include ../crypto/bn ../apps/include
+    INCLUDE[bn_internal_test]=.. ../include ../crypto/bn ../apps/include
     DEPEND[bn_internal_test]=../libcrypto.a libtestutil.a
 
     SOURCE[asn1_dsa_internal_test]=asn1_dsa_internal_test.c
index 40f1f12fcd00f6b4533c235928a840e8fdcf93ff..878bd752e054bb70d56c9fd4ddd590154afba3eb 100644 (file)
@@ -15,7 +15,7 @@
 #include <string.h>
 #include <openssl/opensslconf.h>
 #include "testutil.h"
-#include "internal/chacha.h"
+#include "crypto/chacha.h"
 
 static const unsigned int key[] = {
     0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
index b0aac6a4d2fca7e2dc389bd839090c06470aba57..e2e7dc0bac92ce8339d88051b1c566817201d139 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "testutil.h"
-#include "internal/ctype.h"
+#include "crypto/ctype.h"
 #include "internal/nelem.h"
 #include <ctype.h>
 #include <stdio.h>
index 4559ffd635aff53436e937e8236692fb7fcf38e0..f5b19344b6fd3fccabe3075e9b6bb8f2b992d763 100644 (file)
@@ -16,7 +16,7 @@
 #include <openssl/evp.h>
 #include <openssl/aes.h>
 #include "../crypto/rand/rand_lcl.h"
-#include "../crypto/include/internal/rand_int.h"
+#include "../include/crypto/rand.h"
 
 #if defined(_WIN32)
 # include <windows.h>
index 1898e31de8dd04b147b7487b21d812bccb82a97d..12c21e195c20279e2060c6d609c25bd0a8045f9c 100644 (file)
@@ -24,7 +24,7 @@
 #include <openssl/dsa.h>
 #include "testutil.h"
 #include "internal/nelem.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 
 /*
  * kExampleRSAKeyDER is an RSA private key in ASN.1, DER format. Of course, you
index 02e5c8d0a8c93666db0beed314b10387eecc45dd..37ca2b14bd7c5e6c99ad8e968dd1f442834f6a8d 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/aes.h>
 #include <openssl/modes.h>
 #include "testutil.h"
-#include "internal/modes_int.h"
+#include "crypto/modes.h"
 #include "internal/nelem.h"
 
 typedef struct {
index e2f93816214114809e07ecc8cd639c6ea507efc0..504e474b7c39c531dad6f246f39f57f2c1aded60 100644 (file)
@@ -13,7 +13,7 @@
 #include <string.h>
 
 #include "testutil.h"
-#include "internal/poly1305.h"
+#include "crypto/poly1305.h"
 #include "../crypto/poly1305/poly1305_local.h"
 #include "internal/nelem.h"
 
index 6934b89dc036db1a33ad4624ae8071fc05ebb730..84d90daeebfa0a95020c45e4884098a2a95d5ad0 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/opensslv.h>
 #include <openssl/ssl.h>
 #include <openssl/ossl_typ.h>
-#include "internal/dso_conf.h"
+#include "crypto/dso_conf.h"
 
 typedef void DSO;
 
index 75caefd8992153a7e0edcb1c910b4392e95ea150..e77e9d265f977fde47c05c7dab0d94b3b5310e69 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <openssl/bio.h>
 #include "testutil.h"
-#include "internal/siphash.h"
+#include "crypto/siphash.h"
 #include "../crypto/siphash/siphash_local.h"
 #include "internal/nelem.h"
 
index 8e76daa913fad559fd360f425dcb53527fb0f9b0..0c626526b1985e673850aa689f0c18838f3fb50c 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef OPENSSL_NO_SM2
 
-# include "internal/sm2.h"
+# include "crypto/sm2.h"
 
 static RAND_METHOD fake_rand;
 static const RAND_METHOD *saved_rand;
index 7ccd6e46db33d7184393474cbe5b6622ba6c25d6..0a5ea738e59dceeb6adc710940a01d65730b68bb 100644 (file)
@@ -17,7 +17,7 @@
 #include "testutil.h"
 
 #ifndef OPENSSL_NO_SM4
-# include "internal/sm4.h"
+# include "crypto/sm4.h"
 
 static int test_sm4_ecb(void)
 {
index 5cc8038f7f779c31a19515a3abd76b4f6cc26922..2c7f5a878cc2c6ad34702ed7710cb1523154bdfd 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/crypto.h>
 #include <internal/nelem.h>
 
-#include "internal/sparse_array.h"
+#include "crypto/sparse_array.h"
 #include "testutil.h"
 
 /* The macros below generate unused functions which error out one of the clang