From 89a85134f8261f17672825b092f55a448027a7fe Mon Sep 17 00:00:00 2001
From: janbar <jlbarriere68@gmail.com>
Date: Sat, 3 Nov 2018 21:47:12 +0100
Subject: [PATCH] cmake project for openssl-1.1.1

---
 CMakeLists.txt          |   2 +-
 apps/CMakeLists.txt     |   4 +-
 apps/progs.h.cmake      | 441 ++++++++++++++++++++++++----------------
 crypto/CMakeLists.txt   |  62 +++---
 crypto/buildinf.h.cmake |   2 +
 opensslconf.h.cmake     |  46 +++--
 ssl/CMakeLists.txt      |  10 +-
 7 files changed, 348 insertions(+), 219 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3a7ad7..cc0efa5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,7 @@ cmake_minimum_required( VERSION 3.1.0 )
 
 set( VERSION_MAJOR 1  )
 set( VERSION_MINOR 1  )
-set( VERSION_PATCH 0i )
+set( VERSION_PATCH 1  )
 
 set( VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} )
 set( LIB_VERSION ${VERSION_MAJOR}.${VERSION_MINOR} )
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 9de6660..800fde7 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -38,11 +38,11 @@ include_directories( BEFORE SYSTEM ${CMAKE_CURRENT_BINARY_DIR} )
 add_definitions ( -DMONOLITH )
 
 set ( E_SRC
-  app_rand.c apps.c asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c
+  app_rand.c apps.c asn1pars.c bf_prefix.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c
   dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c genpkey.c
   genrsa.c nseq.c ocsp.c openssl.c opt.c passwd.c pkcs12.c pkcs7.c pkcs8.c pkey.c
   pkeyparam.c pkeyutl.c prime.c rand.c rehash.c req.c rsa.c rsautl.c s_cb.c
-  s_client.c s_server.c s_socket.c s_time.c sess_id.c smime.c speed.c spkac.c srp.c
+  s_client.c s_server.c s_socket.c s_time.c sess_id.c smime.c speed.c spkac.c storeutl.c srp.c
   ts.c verify.c version.c x509.c )
 
 add_executable ( openssl ${E_SRC} )
diff --git a/apps/progs.h.cmake b/apps/progs.h.cmake
index 6f7ebc3..0d38218 100644
--- a/apps/progs.h.cmake
+++ b/apps/progs.h.cmake
@@ -39,7 +39,6 @@ extern int ecparam_main(int argc, char *argv[]);
 extern int enc_main(int argc, char *argv[]);
 extern int engine_main(int argc, char *argv[]);
 extern int errstr_main(int argc, char *argv[]);
-extern int exit_main(int argc, char *argv[]);
 extern int gendsa_main(int argc, char *argv[]);
 extern int genpkey_main(int argc, char *argv[]);
 extern int genrsa_main(int argc, char *argv[]);
@@ -68,351 +67,441 @@ extern int smime_main(int argc, char *argv[]);
 extern int speed_main(int argc, char *argv[]);
 extern int spkac_main(int argc, char *argv[]);
 extern int srp_main(int argc, char *argv[]);
+extern int storeutl_main(int argc, char *argv[]);
 extern int ts_main(int argc, char *argv[]);
 extern int verify_main(int argc, char *argv[]);
 extern int version_main(int argc, char *argv[]);
 extern int x509_main(int argc, char *argv[]);
 
-extern OPTIONS asn1parse_options[];
-extern OPTIONS ca_options[];
-extern OPTIONS ciphers_options[];
-extern OPTIONS cms_options[];
-extern OPTIONS crl_options[];
-extern OPTIONS crl2pkcs7_options[];
-extern OPTIONS dgst_options[];
-extern OPTIONS dhparam_options[];
-extern OPTIONS dsa_options[];
-extern OPTIONS dsaparam_options[];
-extern OPTIONS ec_options[];
-extern OPTIONS ecparam_options[];
-extern OPTIONS enc_options[];
-extern OPTIONS engine_options[];
-extern OPTIONS errstr_options[];
-extern OPTIONS exit_options[];
-extern OPTIONS gendsa_options[];
-extern OPTIONS genpkey_options[];
-extern OPTIONS genrsa_options[];
-extern OPTIONS help_options[];
-extern OPTIONS list_options[];
-extern OPTIONS nseq_options[];
-extern OPTIONS ocsp_options[];
-extern OPTIONS passwd_options[];
-extern OPTIONS pkcs12_options[];
-extern OPTIONS pkcs7_options[];
-extern OPTIONS pkcs8_options[];
-extern OPTIONS pkey_options[];
-extern OPTIONS pkeyparam_options[];
-extern OPTIONS pkeyutl_options[];
-extern OPTIONS prime_options[];
-extern OPTIONS rand_options[];
-extern OPTIONS rehash_options[];
-extern OPTIONS req_options[];
-extern OPTIONS rsa_options[];
-extern OPTIONS rsautl_options[];
-extern OPTIONS s_client_options[];
-extern OPTIONS s_server_options[];
-extern OPTIONS s_time_options[];
-extern OPTIONS sess_id_options[];
-extern OPTIONS smime_options[];
-extern OPTIONS speed_options[];
-extern OPTIONS spkac_options[];
-extern OPTIONS srp_options[];
-extern OPTIONS ts_options[];
-extern OPTIONS verify_options[];
-extern OPTIONS version_options[];
-extern OPTIONS x509_options[];
+extern const OPTIONS asn1parse_options[];
+extern const OPTIONS ca_options[];
+extern const OPTIONS ciphers_options[];
+extern const OPTIONS cms_options[];
+extern const OPTIONS crl_options[];
+extern const OPTIONS crl2pkcs7_options[];
+extern const OPTIONS dgst_options[];
+extern const OPTIONS dhparam_options[];
+extern const OPTIONS dsa_options[];
+extern const OPTIONS dsaparam_options[];
+extern const OPTIONS ec_options[];
+extern const OPTIONS ecparam_options[];
+extern const OPTIONS enc_options[];
+extern const OPTIONS engine_options[];
+extern const OPTIONS errstr_options[];
+extern const OPTIONS gendsa_options[];
+extern const OPTIONS genpkey_options[];
+extern const OPTIONS genrsa_options[];
+extern const OPTIONS help_options[];
+extern const OPTIONS list_options[];
+extern const OPTIONS nseq_options[];
+extern const OPTIONS ocsp_options[];
+extern const OPTIONS passwd_options[];
+extern const OPTIONS pkcs12_options[];
+extern const OPTIONS pkcs7_options[];
+extern const OPTIONS pkcs8_options[];
+extern const OPTIONS pkey_options[];
+extern const OPTIONS pkeyparam_options[];
+extern const OPTIONS pkeyutl_options[];
+extern const OPTIONS prime_options[];
+extern const OPTIONS rand_options[];
+extern const OPTIONS rehash_options[];
+extern const OPTIONS req_options[];
+extern const OPTIONS rsa_options[];
+extern const OPTIONS rsautl_options[];
+extern const OPTIONS s_client_options[];
+extern const OPTIONS s_server_options[];
+extern const OPTIONS s_time_options[];
+extern const OPTIONS sess_id_options[];
+extern const OPTIONS smime_options[];
+extern const OPTIONS speed_options[];
+extern const OPTIONS spkac_options[];
+extern const OPTIONS srp_options[];
+extern const OPTIONS storeutl_options[];
+extern const OPTIONS ts_options[];
+extern const OPTIONS verify_options[];
+extern const OPTIONS version_options[];
+extern const OPTIONS x509_options[];
 
 #ifdef INCLUDE_FUNCTION_TABLE
 static FUNCTION functions[] = {
-    { FT_general, "asn1parse", asn1parse_main, asn1parse_options },
-    { FT_general, "ca", ca_main, ca_options },
+    {FT_general, "asn1parse", asn1parse_main, asn1parse_options},
+    {FT_general, "ca", ca_main, ca_options},
 #ifndef OPENSSL_NO_SOCK
-    { FT_general, "ciphers", ciphers_main, ciphers_options },
+    {FT_general, "ciphers", ciphers_main, ciphers_options},
 #endif
 #ifndef OPENSSL_NO_CMS
-    { FT_general, "cms", cms_main, cms_options },
+    {FT_general, "cms", cms_main, cms_options},
 #endif
-    { FT_general, "crl", crl_main, crl_options },
-    { FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options },
-    { FT_general, "dgst", dgst_main, dgst_options },
+    {FT_general, "crl", crl_main, crl_options},
+    {FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options},
+    {FT_general, "dgst", dgst_main, dgst_options},
 #ifndef OPENSSL_NO_DH
-    { FT_general, "dhparam", dhparam_main, dhparam_options },
+    {FT_general, "dhparam", dhparam_main, dhparam_options},
 #endif
 #ifndef OPENSSL_NO_DSA
-    { FT_general, "dsa", dsa_main, dsa_options },
+    {FT_general, "dsa", dsa_main, dsa_options},
 #endif
 #ifndef OPENSSL_NO_DSA
-    { FT_general, "dsaparam", dsaparam_main, dsaparam_options },
+    {FT_general, "dsaparam", dsaparam_main, dsaparam_options},
 #endif
 #ifndef OPENSSL_NO_EC
-    { FT_general, "ec", ec_main, ec_options },
+    {FT_general, "ec", ec_main, ec_options},
 #endif
 #ifndef OPENSSL_NO_EC
-    { FT_general, "ecparam", ecparam_main, ecparam_options },
+    {FT_general, "ecparam", ecparam_main, ecparam_options},
 #endif
-    { FT_general, "enc", enc_main, enc_options },
+    {FT_general, "enc", enc_main, enc_options},
 #ifndef OPENSSL_NO_ENGINE
-    { FT_general, "engine", engine_main, engine_options },
+    {FT_general, "engine", engine_main, engine_options},
 #endif
-    { FT_general, "errstr", errstr_main, errstr_options },
-    { FT_general, "exit", exit_main, exit_options },
+    {FT_general, "errstr", errstr_main, errstr_options},
 #ifndef OPENSSL_NO_DSA
-    { FT_general, "gendsa", gendsa_main, gendsa_options },
+    {FT_general, "gendsa", gendsa_main, gendsa_options},
 #endif
-    { FT_general, "genpkey", genpkey_main, genpkey_options },
+    {FT_general, "genpkey", genpkey_main, genpkey_options},
 #ifndef OPENSSL_NO_RSA
-    { FT_general, "genrsa", genrsa_main, genrsa_options },
+    {FT_general, "genrsa", genrsa_main, genrsa_options},
 #endif
-    { FT_general, "help", help_main, help_options },
-    { FT_general, "list", list_main, list_options },
-    { FT_general, "nseq", nseq_main, nseq_options },
+    {FT_general, "help", help_main, help_options},
+    {FT_general, "list", list_main, list_options},
+    {FT_general, "nseq", nseq_main, nseq_options},
 #ifndef OPENSSL_NO_OCSP
-    { FT_general, "ocsp", ocsp_main, ocsp_options },
+    {FT_general, "ocsp", ocsp_main, ocsp_options},
 #endif
-    { FT_general, "passwd", passwd_main, passwd_options },
+    {FT_general, "passwd", passwd_main, passwd_options},
 #ifndef OPENSSL_NO_DES
-    { FT_general, "pkcs12", pkcs12_main, pkcs12_options },
+    {FT_general, "pkcs12", pkcs12_main, pkcs12_options},
 #endif
-    { FT_general, "pkcs7", pkcs7_main, pkcs7_options },
-    { FT_general, "pkcs8", pkcs8_main, pkcs8_options },
-    { FT_general, "pkey", pkey_main, pkey_options },
-    { FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options },
-    { FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options },
-    { FT_general, "prime", prime_main, prime_options },
-    { FT_general, "rand", rand_main, rand_options },
-    { FT_general, "rehash", rehash_main, rehash_options },
-    { FT_general, "req", req_main, req_options },
-    { FT_general, "rsa", rsa_main, rsa_options },
+    {FT_general, "pkcs7", pkcs7_main, pkcs7_options},
+    {FT_general, "pkcs8", pkcs8_main, pkcs8_options},
+    {FT_general, "pkey", pkey_main, pkey_options},
+    {FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options},
+    {FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options},
+    {FT_general, "prime", prime_main, prime_options},
+    {FT_general, "rand", rand_main, rand_options},
+    {FT_general, "rehash", rehash_main, rehash_options},
+    {FT_general, "req", req_main, req_options},
+    {FT_general, "rsa", rsa_main, rsa_options},
 #ifndef OPENSSL_NO_RSA
-    { FT_general, "rsautl", rsautl_main, rsautl_options },
+    {FT_general, "rsautl", rsautl_main, rsautl_options},
 #endif
 #ifndef OPENSSL_NO_SOCK
-    { FT_general, "s_client", s_client_main, s_client_options },
+    {FT_general, "s_client", s_client_main, s_client_options},
 #endif
 #ifndef OPENSSL_NO_SOCK
-    { FT_general, "s_server", s_server_main, s_server_options },
+    {FT_general, "s_server", s_server_main, s_server_options},
 #endif
 #ifndef OPENSSL_NO_SOCK
-    { FT_general, "s_time", s_time_main, s_time_options },
+    {FT_general, "s_time", s_time_main, s_time_options},
 #endif
-    { FT_general, "sess_id", sess_id_main, sess_id_options },
-    { FT_general, "smime", smime_main, smime_options },
-    { FT_general, "speed", speed_main, speed_options },
-    { FT_general, "spkac", spkac_main, spkac_options },
+    {FT_general, "sess_id", sess_id_main, sess_id_options},
+    {FT_general, "smime", smime_main, smime_options},
+    {FT_general, "speed", speed_main, speed_options},
+    {FT_general, "spkac", spkac_main, spkac_options},
 #ifndef OPENSSL_NO_SRP
-    { FT_general, "srp", srp_main, srp_options },
+    {FT_general, "srp", srp_main, srp_options},
 #endif
+    {FT_general, "storeutl", storeutl_main, storeutl_options},
 #ifndef OPENSSL_NO_TS
-    { FT_general, "ts", ts_main, ts_options },
+    {FT_general, "ts", ts_main, ts_options},
 #endif
-    { FT_general, "verify", verify_main, verify_options },
-    { FT_general, "version", version_main, version_options },
-    { FT_general, "x509", x509_main, x509_options },
+    {FT_general, "verify", verify_main, verify_options},
+    {FT_general, "version", version_main, version_options},
+    {FT_general, "x509", x509_main, x509_options},
 #ifndef OPENSSL_NO_MD2
-    { FT_md, "md2", dgst_main},
+    {FT_md, "md2", dgst_main},
 #endif
 #ifndef OPENSSL_NO_MD4
-    { FT_md, "md4", dgst_main},
+    {FT_md, "md4", dgst_main},
 #endif
-    { FT_md, "md5", dgst_main},
+    {FT_md, "md5", dgst_main},
 #ifndef OPENSSL_NO_GOST
-    { FT_md, "gost", dgst_main},
+    {FT_md, "gost", dgst_main},
 #endif
-    { FT_md, "sha1", dgst_main},
-    { FT_md, "sha224", dgst_main},
-    { FT_md, "sha256", dgst_main},
-    { FT_md, "sha384", dgst_main},
-    { FT_md, "sha512", dgst_main},
+    {FT_md, "sha1", dgst_main},
+    {FT_md, "sha224", dgst_main},
+    {FT_md, "sha256", dgst_main},
+    {FT_md, "sha384", dgst_main},
+    {FT_md, "sha512", dgst_main},
+    {FT_md, "sha512-224", dgst_main},
+    {FT_md, "sha512-256", dgst_main},
+    {FT_md, "sha3-224", dgst_main},
+    {FT_md, "sha3-256", dgst_main},
+    {FT_md, "sha3-384", dgst_main},
+    {FT_md, "sha3-512", dgst_main},
+    {FT_md, "shake128", dgst_main},
+    {FT_md, "shake256", dgst_main},
 #ifndef OPENSSL_NO_MDC2
-    { FT_md, "mdc2", dgst_main},
+    {FT_md, "mdc2", dgst_main},
 #endif
 #ifndef OPENSSL_NO_RMD160
-    { FT_md, "rmd160", dgst_main},
+    {FT_md, "rmd160", dgst_main},
 #endif
 #ifndef OPENSSL_NO_BLAKE2
-    { FT_md, "blake2b512", dgst_main},
+    {FT_md, "blake2b512", dgst_main},
 #endif
 #ifndef OPENSSL_NO_BLAKE2
-    { FT_md, "blake2s256", dgst_main},
+    {FT_md, "blake2s256", dgst_main},
 #endif
-    { FT_cipher, "aes-128-cbc", enc_main, enc_options },
-    { FT_cipher, "aes-128-ecb", enc_main, enc_options },
-    { FT_cipher, "aes-192-cbc", enc_main, enc_options },
-    { FT_cipher, "aes-192-ecb", enc_main, enc_options },
-    { FT_cipher, "aes-256-cbc", enc_main, enc_options },
-    { FT_cipher, "aes-256-ecb", enc_main, enc_options },
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-128-cbc", enc_main, enc_options },
+#ifndef OPENSSL_NO_SM3
+    {FT_md, "sm3", dgst_main},
+#endif
+    {FT_cipher, "aes-128-cbc", enc_main, enc_options},
+    {FT_cipher, "aes-128-ecb", enc_main, enc_options},
+    {FT_cipher, "aes-192-cbc", enc_main, enc_options},
+    {FT_cipher, "aes-192-ecb", enc_main, enc_options},
+    {FT_cipher, "aes-256-cbc", enc_main, enc_options},
+    {FT_cipher, "aes-256-ecb", enc_main, enc_options},
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-cbc", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-cfb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-ctr", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-ecb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-ofb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-cfb1", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-128-cfb8", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-cbc", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-cfb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-ctr", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-ecb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-ofb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-cfb1", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-192-cfb8", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-cbc", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-cfb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-ctr", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-ecb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-ofb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-cfb1", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_ARIA
+    {FT_cipher, "aria-256-cfb8", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-128-ecb", enc_main, enc_options },
+    {FT_cipher, "camellia-128-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-192-cbc", enc_main, enc_options },
+    {FT_cipher, "camellia-128-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-192-ecb", enc_main, enc_options },
+    {FT_cipher, "camellia-192-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-256-cbc", enc_main, enc_options },
+    {FT_cipher, "camellia-192-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-256-ecb", enc_main, enc_options },
+    {FT_cipher, "camellia-256-cbc", enc_main, enc_options},
 #endif
-    { FT_cipher, "base64", enc_main, enc_options },
+#ifndef OPENSSL_NO_CAMELLIA
+    {FT_cipher, "camellia-256-ecb", enc_main, enc_options},
+#endif
+    {FT_cipher, "base64", enc_main, enc_options},
 #ifdef ZLIB
-    { FT_cipher, "zlib", enc_main, enc_options },
+    {FT_cipher, "zlib", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des", enc_main, enc_options },
+    {FT_cipher, "des", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des3", enc_main, enc_options },
+    {FT_cipher, "des3", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "desx", enc_main, enc_options },
+    {FT_cipher, "desx", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea", enc_main, enc_options },
+    {FT_cipher, "idea", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed", enc_main, enc_options },
+    {FT_cipher, "seed", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC4
-    { FT_cipher, "rc4", enc_main, enc_options },
+    {FT_cipher, "rc4", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC4
-    { FT_cipher, "rc4-40", enc_main, enc_options },
+    {FT_cipher, "rc4-40", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2", enc_main, enc_options },
+    {FT_cipher, "rc2", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf", enc_main, enc_options },
+    {FT_cipher, "bf", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast", enc_main, enc_options },
+    {FT_cipher, "cast", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5", enc_main, enc_options },
+    {FT_cipher, "rc5", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ecb", enc_main, enc_options },
+    {FT_cipher, "des-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede", enc_main, enc_options },
+    {FT_cipher, "des-ede", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3", enc_main, enc_options },
+    {FT_cipher, "des-ede3", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-cbc", enc_main, enc_options },
+    {FT_cipher, "des-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-cbc", enc_main, enc_options },
+    {FT_cipher, "des-ede-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-cbc", enc_main, enc_options },
+    {FT_cipher, "des-ede3-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-cfb", enc_main, enc_options },
+    {FT_cipher, "des-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-cfb", enc_main, enc_options },
+    {FT_cipher, "des-ede-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-cfb", enc_main, enc_options },
+    {FT_cipher, "des-ede3-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ofb", enc_main, enc_options },
+    {FT_cipher, "des-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-ofb", enc_main, enc_options },
+    {FT_cipher, "des-ede-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-ofb", enc_main, enc_options },
+    {FT_cipher, "des-ede3-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-cbc", enc_main, enc_options },
+    {FT_cipher, "idea-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-ecb", enc_main, enc_options },
+    {FT_cipher, "idea-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-cfb", enc_main, enc_options },
+    {FT_cipher, "idea-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-ofb", enc_main, enc_options },
+    {FT_cipher, "idea-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-cbc", enc_main, enc_options },
+    {FT_cipher, "seed-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-ecb", enc_main, enc_options },
+    {FT_cipher, "seed-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-cfb", enc_main, enc_options },
+    {FT_cipher, "seed-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-ofb", enc_main, enc_options },
+    {FT_cipher, "seed-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-cbc", enc_main, enc_options },
+    {FT_cipher, "rc2-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-ecb", enc_main, enc_options },
+    {FT_cipher, "rc2-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-cfb", enc_main, enc_options },
+    {FT_cipher, "rc2-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-ofb", enc_main, enc_options },
+    {FT_cipher, "rc2-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-64-cbc", enc_main, enc_options },
+    {FT_cipher, "rc2-64-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-40-cbc", enc_main, enc_options },
+    {FT_cipher, "rc2-40-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-cbc", enc_main, enc_options },
+    {FT_cipher, "bf-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-ecb", enc_main, enc_options },
+    {FT_cipher, "bf-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-cfb", enc_main, enc_options },
+    {FT_cipher, "bf-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-ofb", enc_main, enc_options },
+    {FT_cipher, "bf-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-cbc", enc_main, enc_options },
+    {FT_cipher, "cast5-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-ecb", enc_main, enc_options },
+    {FT_cipher, "cast5-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-cfb", enc_main, enc_options },
+    {FT_cipher, "cast5-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-ofb", enc_main, enc_options },
+    {FT_cipher, "cast5-ofb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast-cbc", enc_main, enc_options },
+    {FT_cipher, "cast-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-cbc", enc_main, enc_options },
+    {FT_cipher, "rc5-cbc", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-ecb", enc_main, enc_options },
+    {FT_cipher, "rc5-ecb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-cfb", enc_main, enc_options },
+    {FT_cipher, "rc5-cfb", enc_main, enc_options},
 #endif
 #ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-ofb", enc_main, enc_options },
+    {FT_cipher, "rc5-ofb", enc_main, enc_options},
 #endif
-    { 0, NULL, NULL}
+#ifndef OPENSSL_NO_SM4
+    {FT_cipher, "sm4-cbc", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_SM4
+    {FT_cipher, "sm4-ecb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_SM4
+    {FT_cipher, "sm4-cfb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_SM4
+    {FT_cipher, "sm4-ofb", enc_main, enc_options},
+#endif
+#ifndef OPENSSL_NO_SM4
+    {FT_cipher, "sm4-ctr", enc_main, enc_options},
+#endif
+    {0, NULL, NULL}
 };
 #endif
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 4e64932..d49c460 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -52,10 +52,10 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bn_conf.h.cmake ${CMAKE_CURRENT_BINA
 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/dso_conf.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/internal/dso_conf.h )
 
 set( LIBSRC
-  cpt_err.c cryptlib.c cversion.c ebcdic.c ex_data.c init.c mem.c mem_clr.c mem_dbg.c mem_sec.c o_dir.c o_fips.c
+  cpt_err.c cryptlib.c ctype.c cversion.c ebcdic.c ex_data.c init.c mem.c mem_clr.c mem_dbg.c mem_sec.c o_dir.c o_fips.c
   o_fopen.c o_init.c o_str.c o_time.c uid.c )
 
-include_directories( BEFORE SYSTEM include modes )
+include_directories( BEFORE SYSTEM include modes ec/curve448 ec/curve448/arch_32 )
 
 if( BUILD_SHARED_LIBS )
   add_definitions( -DOPENSSL_BUILD_SHLIBCRYPTO )
@@ -81,11 +81,13 @@ macro( add_submodule dir )
 endmacro( add_submodule )
 
 add_submodule ( aes aes_cbc.c aes_cfb.c aes_core.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c
-  aes_wrap.c EXHEADERS aes.h )
+  aes_wrap.c aes_x86core.c )
+
+add_submodule ( aria aria.c )
 
 add_submodule ( asn1 a_bitstr.c a_d2i_fp.c a_digest.c a_dup.c a_gentm.c a_i2d_fp.c a_int.c
   a_mbstr.c a_object.c a_octet.c a_print.c a_sign.c a_strex.c a_strnid.c a_time.c a_type.c
-  a_utctm.c a_utf8.c a_verify.c ameth_lib.c asn1_err.c asn1_gen.c asn1_lib.c asn1_par.c
+  a_utctm.c a_utf8.c a_verify.c ameth_lib.c asn1_err.c asn1_gen.c asn1_item_list.c asn1_lib.c asn1_par.c
   asn_mime.c asn_moid.c asn_mstbl.c asn_pack.c bio_asn1.c bio_ndef.c d2i_pr.c d2i_pu.c
   evp_asn1.c f_int.c f_string.c i2d_pr.c i2d_pu.c n_pkey.c nsseq.c p5_pbe.c p5_pbev2.c
   p5_scrypt.c p8_pkey.c t_bitst.c t_pkey.c t_spki.c tasn_dec.c tasn_enc.c tasn_fre.c
@@ -106,7 +108,7 @@ add_submodule ( blake2 blake2b.c blake2s.c m_blake2b.c m_blake2s.c )
 add_submodule ( bn bn_add.c bn_asm.c bn_blind.c bn_const.c bn_ctx.c bn_depr.c bn_dh.c
   bn_div.c bn_err.c bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_intern.c bn_kron.c bn_lib.c
   bn_mod.c bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c bn_recp.c
-  bn_shift.c bn_sqr.c bn_sqrt.c bn_srp.c bn_word.c bn_x931p.c )
+  bn_shift.c bn_sqr.c bn_sqrt.c bn_srp.c bn_word.c bn_x931p.c rsaz_exp.c )
 
 add_submodule ( buffer buf_err.c buffer.c )
 
@@ -131,11 +133,11 @@ add_submodule ( ct ct_b64.c ct_err.c ct_log.c ct_oct.c ct_policy.c ct_prn.c ct_s
   ct_sct_ctx.c ct_vfy.c ct_x509v3.c )
 
 add_submodule ( des cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c des_enc.c
-  ecb3_enc.c ecb_enc.c fcrypt.c fcrypt_b.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c
-  qud_cksm.c rand_key.c rpc_enc.c set_key.c str2key.c xcbc_enc.c )
+  ecb3_enc.c ecb_enc.c fcrypt.c fcrypt_b.c ncbc_enc.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c
+  qud_cksm.c rand_key.c set_key.c str2key.c xcbc_enc.c )
 
 add_submodule ( dh dh_ameth.c dh_asn1.c dh_check.c dh_depr.c dh_err.c dh_gen.c dh_kdf.c
-  dh_key.c dh_lib.c dh_meth.c dh_pmeth.c dh_prn.c dh_rfc5114.c )
+  dh_key.c dh_lib.c dh_meth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_rfc7919.c )
 
 add_submodule ( dsa dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_key.c
   dsa_lib.c dsa_meth.c dsa_ossl.c dsa_pmeth.c dsa_prn.c dsa_sign.c dsa_vrf.c )
@@ -143,13 +145,15 @@ add_submodule ( dsa dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_ke
 add_submodule ( dso dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_openssl.c dso_vms.c
   dso_win32.c )
 
-add_submodule ( ec curve25519.c ec2_mult.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c
+add_submodule ( ec curve25519.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c
   ec_check.c ec_curve.c ec_cvt.c ec_err.c ec_key.c ec_kmeth.c ec_lib.c ec_mult.c
   ec_oct.c ec_pmeth.c ec_print.c ecdh_kdf.c ecdh_ossl.c ecdsa_ossl.c ecdsa_sign.c
   ecdsa_vrf.c eck_prn.c ecp_mont.c ecp_nist.c ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c
-  ecp_nistputil.c ecp_oct.c ecp_smpl.c ecx_meth.c )
+  ecp_nistputil.c ecp_oct.c ecp_smpl.c ecx_meth.c
+  curve448/curve448.c curve448/curve448_tables.c curve448/eddsa.c curve448/f_generic.c
+  curve448/scalar.c curve448/arch_32/f_impl.c )
 
-add_submodule ( engine eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c eng_err.c
+add_submodule ( engine eng_all.c eng_cnf.c eng_ctrl.c eng_dyn.c eng_err.c
   eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c eng_rdrand.c
   eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c tb_digest.c tb_dsa.c tb_eckey.c tb_pkmeth.c
   tb_rand.c tb_rsa.c )
@@ -157,19 +161,19 @@ add_submodule ( engine eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c
 add_submodule ( err err.c err_all.c err_prn.c )
 
 add_submodule ( evp bio_b64.c bio_enc.c bio_md.c bio_ok.c c_allc.c c_alld.c cmeth_lib.c
-  digest.c e_aes.c e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_bf.c e_camellia.c
+  digest.c e_aes.c e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_aria.c e_bf.c e_camellia.c
   e_cast.c e_chacha20_poly1305.c e_des.c e_des3.c e_idea.c e_null.c e_old.c e_rc2.c
-  e_rc4.c e_rc4_hmac_md5.c e_rc5.c e_seed.c e_xcbc_d.c encode.c evp_cnf.c evp_enc.c
+  e_rc4.c e_rc4_hmac_md5.c e_rc5.c e_sm4.c e_seed.c e_xcbc_d.c encode.c evp_cnf.c evp_enc.c
   evp_err.c evp_key.c evp_lib.c evp_pbe.c evp_pkey.c m_md2.c m_md4.c m_md5.c m_md5_sha1.c
-  m_mdc2.c m_null.c m_ripemd.c m_sha1.c m_sigver.c m_wp.c names.c p5_crpt.c p5_crpt2.c
-  p_dec.c p_enc.c p_lib.c p_open.c p_seal.c p_sign.c p_verify.c pmeth_fn.c pmeth_gn.c
-  pmeth_lib.c scrypt.c )
+  m_sha3.c m_mdc2.c m_null.c m_ripemd.c m_sha1.c m_sigver.c m_wp.c names.c p5_crpt.c p5_crpt2.c
+  p_dec.c p_enc.c p_lib.c p_open.c p_seal.c p_sign.c p_verify.c pbe_scrypt.c
+  pmeth_fn.c pmeth_gn.c pmeth_lib.c )
 
 add_submodule ( hmac hm_ameth.c hm_pmeth.c hmac.c )
 
 add_submodule ( idea i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c )
 
-add_submodule ( kdf hkdf.c kdf_err.c tls1_prf.c )
+add_submodule ( kdf hkdf.c kdf_err.c scrypt.c tls1_prf.c )
 
 add_submodule ( lhash lh_stats.c lhash.c )
 
@@ -197,35 +201,47 @@ add_submodule ( pkcs12 p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_d
 add_submodule ( pkcs7 bio_pk7.c pk7_asn1.c pk7_attr.c pk7_doit.c pk7_lib.c pk7_mime.c
   pk7_smime.c pkcs7err.c )
 
-add_submodule ( poly1305 poly1305.c )
+add_submodule ( poly1305 poly1305.c poly1305_ameth.c poly1305_ieee754.c poly1305_pmeth.c)
 
-add_submodule ( rand md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c rand_vms.c
+add_submodule ( rand drbg_ctr.c drbg_lib.c rand_egd.c rand_err.c rand_lib.c rand_unix.c rand_vms.c
  rand_win.c randfile.c )
 
 add_submodule ( rc2 rc2_cbc.c rc2_ecb.c rc2_skey.c rc2cfb64.c rc2ofb64.c )
 
 add_submodule ( rc4 rc4_enc.c rc4_skey.c )
 
+#add_submodule ( rc5 rc5_ecb.c rc5_enc.c rc5_skey.c rc5cfb64.c rc5ofb64.c )
+
 add_submodule ( ripemd rmd_dgst.c rmd_one.c )
 
 add_submodule ( rsa rsa_ameth.c rsa_asn1.c rsa_chk.c rsa_crpt.c rsa_depr.c rsa_err.c
-  rsa_gen.c rsa_lib.c rsa_meth.c rsa_none.c rsa_null.c rsa_oaep.c rsa_ossl.c rsa_pk1.c
+  rsa_gen.c rsa_lib.c rsa_meth.c rsa_mp.c rsa_none.c rsa_oaep.c rsa_ossl.c rsa_pk1.c
   rsa_pmeth.c rsa_prn.c rsa_pss.c rsa_saos.c rsa_sign.c rsa_ssl.c rsa_x931.c rsa_x931g.c )
 
 add_submodule ( seed seed.c seed_cbc.c seed_cfb.c seed_ecb.c seed_ofb.c )
 
-add_submodule ( sha sha1_one.c sha1dgst.c sha256.c sha512.c )
+add_submodule ( sha keccak1600.c sha1_one.c sha1dgst.c sha256.c sha512.c )
+ 
+add_submodule ( siphash siphash.c siphash_ameth.c siphash_pmeth.c )
+
+add_submodule ( sm2 sm2_crypt.c sm2_err.c sm2_pmeth.c sm2_sign.c )
+
+add_submodule ( sm3 m_sm3.c sm3.c )
+
+add_submodule ( sm4 sm4.c )
 
 add_submodule ( srp srp_lib.c srp_vfy.c )
 
 add_submodule ( stack stack.c )
 
+add_submodule ( store loader_file.c store_err.c store_init.c store_lib.c store_register.c store_strings.c )
+
 add_submodule ( ts ts_asn1.c ts_conf.c ts_err.c ts_lib.c ts_req_print.c ts_req_utils.c
   ts_rsp_print.c ts_rsp_sign.c ts_rsp_utils.c ts_rsp_verify.c ts_verify_ctx.c )
 
 add_submodule ( txt_db txt_db.c )
 
-add_submodule ( ui ui_err.c ui_lib.c ui_openssl.c ui_util.c )
+add_submodule ( ui ui_err.c ui_lib.c ui_null.c ui_openssl.c ui_util.c )
 
 add_submodule ( whrlpool wp_block.c wp_dgst.c )
 
@@ -236,7 +252,7 @@ add_submodule ( x509 by_dir.c by_file.c t_crl.c t_req.c t_x509.c x509_att.c x509
   x_pubkey.c x_req.c x_x509.c x_x509a.c )
 
 add_submodule ( x509v3 pcy_cache.c pcy_data.c pcy_lib.c pcy_map.c pcy_node.c pcy_tree.c
-  v3_addr.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c v3_bcons.c v3_bitst.c v3_conf.c v3_cpols.c
+  v3_addr.c v3_admis.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c v3_bcons.c v3_bitst.c v3_conf.c v3_cpols.c
   v3_crld.c v3_enum.c v3_extku.c v3_genn.c v3_ia5.c v3_info.c v3_int.c v3_lib.c v3_ncons.c
   v3_pci.c v3_pcia.c v3_pcons.c v3_pku.c v3_pmaps.c v3_prn.c v3_purp.c v3_skey.c v3_sxnet.c
   v3_tlsf.c v3_utl.c v3err.c )
diff --git a/crypto/buildinf.h.cmake b/crypto/buildinf.h.cmake
index 985eb73..df320f4 100644
--- a/crypto/buildinf.h.cmake
+++ b/crypto/buildinf.h.cmake
@@ -2,3 +2,5 @@
 #define CFLAGS "@CMAKE_C_COMPILER@ @CMAKE_C_FLAGS@"
 #define PLATFORM "@CMAKE_SYSTEM_NAME@"
 #define DATE "@BUILDINF_DATE@"
+static const char *compiler_flags = CFLAGS;
+
diff --git a/opensslconf.h.cmake b/opensslconf.h.cmake
index 0947c23..c5a5133 100644
--- a/opensslconf.h.cmake
+++ b/opensslconf.h.cmake
@@ -7,6 +7,8 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include <openssl/opensslv.h>
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -16,8 +18,8 @@ extern "C" {
 #endif
 
 /*
-* OpenSSL was configured with the following options:
-*/
+ * OpenSSL was configured with the following options:
+ */
 
 #ifndef OPENSSL_NO_MD2
 # define OPENSSL_NO_MD2
@@ -28,6 +30,9 @@ extern "C" {
 #ifndef OPENSSL_THREADS
 # define OPENSSL_THREADS
 #endif
+#ifndef OPENSSL_RAND_SEED_OS
+# define OPENSSL_RAND_SEED_OS
+#endif
 #ifndef OPENSSL_NO_ASAN
 # define OPENSSL_NO_ASAN
 #endif
@@ -40,12 +45,18 @@ extern "C" {
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
 # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
 #endif
+#ifndef OPENSSL_NO_DEVCRYPTOENG
+# define OPENSSL_NO_DEVCRYPTOENG
+#endif
 #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
 # define OPENSSL_NO_EC_NISTP_64_GCC_128
 #endif
 #ifndef OPENSSL_NO_EGD
 # define OPENSSL_NO_EGD
 #endif
+#ifndef OPENSSL_NO_EXTERNAL_TESTS
+# define OPENSSL_NO_EXTERNAL_TESTS
+#endif
 #ifndef OPENSSL_NO_FUZZ_AFL
 # define OPENSSL_NO_FUZZ_AFL
 #endif
@@ -79,6 +90,9 @@ extern "C" {
 #ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
 # define OPENSSL_NO_WEAK_SSL_CIPHERS
 #endif
+#ifndef OPENSSL_NO_STATIC_ENGINE
+# define OPENSSL_NO_STATIC_ENGINE
+#endif
 #ifndef OPENSSL_NO_AFALGENG
 # define OPENSSL_NO_AFALGENG
 #endif
@@ -96,15 +110,11 @@ extern "C" {
  * functions.
  */
 #ifndef DECLARE_DEPRECATED
-# if defined(OPENSSL_NO_DEPRECATED)
-#  define DECLARE_DEPRECATED(f)
-# else
-#  define DECLARE_DEPRECATED(f)   f;
-#  ifdef __GNUC__
-#   if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
-#    undef DECLARE_DEPRECATED
-#    define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
-#   endif
+# define DECLARE_DEPRECATED(f)   f;
+# ifdef __GNUC__
+#  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
+#   undef DECLARE_DEPRECATED
+#   define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
 #  endif
 # endif
 #endif
@@ -128,6 +138,18 @@ extern "C" {
 # define OPENSSL_API_COMPAT OPENSSL_MIN_API
 #endif
 
+/*
+ * Do not deprecate things to be deprecated in version 1.2.0 before the
+ * OpenSSL version number matches.
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10200000L
+# define DEPRECATEDIN_1_2_0(f)   f;
+#elif OPENSSL_API_COMPAT < 0x10200000L
+# define DEPRECATEDIN_1_2_0(f)   DECLARE_DEPRECATED(f)
+#else
+# define DEPRECATEDIN_1_2_0(f)
+#endif
+
 #if OPENSSL_API_COMPAT < 0x10100000L
 # define DEPRECATEDIN_1_1_0(f)   DECLARE_DEPRECATED(f)
 #else
@@ -146,8 +168,6 @@ extern "C" {
 # define DEPRECATEDIN_0_9_8(f)
 #endif
 
-
-
 /* Generate 80386 code? */
 #undef I386_ONLY
 
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt
index 148fecb..b581652 100644
--- a/ssl/CMakeLists.txt
+++ b/ssl/CMakeLists.txt
@@ -28,12 +28,14 @@ if( BUILD_SHARED_LIBS )
 endif()
 
 set ( LIBSRC
-  bio_ssl.c d1_lib.c d1_msg.c d1_srtp.c methods.c pqueue.c s3_cbc.c s3_enc.c s3_lib.c
+  bio_ssl.c d1_lib.c d1_msg.c d1_srtp.c methods.c packet.c pqueue.c s3_cbc.c s3_enc.c s3_lib.c
   s3_msg.c ssl_asn1.c ssl_cert.c ssl_ciph.c ssl_conf.c ssl_err.c ssl_init.c ssl_lib.c
-  ssl_mcnf.c ssl_rsa.c ssl_sess.c ssl_stat.c ssl_txt.c ssl_utst.c t1_enc.c t1_ext.c
-  t1_lib.c t1_reneg.c t1_trce.c tls_srp.c
+  ssl_mcnf.c ssl_rsa.c ssl_sess.c ssl_stat.c ssl_txt.c ssl_utst.c t1_enc.c t1_lib.c
+  t1_trce.c tls13_enc.c tls_srp.c
   record/dtls1_bitmap.c record/rec_layer_d1.c record/rec_layer_s3.c record/ssl3_buffer.c
-  record/ssl3_record.c statem/statem.c statem/statem_clnt.c statem/statem_dtls.c
+  record/ssl3_record.c record/ssl3_record_tls13.c
+  statem/extensions.c statem/extensions_clnt.c statem/extensions_cust.c
+  statem/extensions_srvr.c statem/statem.c statem/statem_clnt.c statem/statem_dtls.c
   statem/statem_lib.c statem/statem_srvr.c
   )