mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-23 13:43:44 +08:00
jni api
This commit is contained in:
@@ -2891,7 +2891,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = {
|
||||
256},
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
/* (GmSSL specific) */
|
||||
{
|
||||
1,
|
||||
|
||||
@@ -1699,7 +1699,7 @@ struct ssl_st {
|
||||
# include <openssl/dtls1.h> /* Datagram TLS */
|
||||
# include <openssl/ssl23.h>
|
||||
# include <openssl/srtp.h> /* Support for the use_srtp extension */
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# include <openssl/gmssl1.h>
|
||||
# endif
|
||||
|
||||
@@ -2392,7 +2392,7 @@ const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */
|
||||
const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */
|
||||
const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */
|
||||
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
const SSL_METHOD *GMSSLv1_method(void);
|
||||
const SSL_METHOD *GMSSLv1_server_method(void);
|
||||
const SSL_METHOD *GMSSLv1_client_method(void);
|
||||
|
||||
@@ -137,7 +137,7 @@ int SSL_library_init(void)
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
EVP_add_digest(EVP_ecdsa());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
EVP_add_cipher(EVP_sms4_cbc());
|
||||
EVP_add_digest(EVP_sm3());
|
||||
#endif
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
#define SSL_ENC_SEED_IDX 11
|
||||
#define SSL_ENC_AES128GCM_IDX 12
|
||||
#define SSL_ENC_AES256GCM_IDX 13
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
#define SSL_ENC_SM4_IDX 14
|
||||
#define SSL_ENC_NUM_IDX 15
|
||||
#else
|
||||
@@ -174,7 +174,7 @@
|
||||
static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL,
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
NULL
|
||||
#endif
|
||||
};
|
||||
@@ -191,7 +191,7 @@ static STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
|
||||
#define SSL_MD_GOST89MAC_IDX 3
|
||||
#define SSL_MD_SHA256_IDX 4
|
||||
#define SSL_MD_SHA384_IDX 5
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
#define SSL_MD_SM3_IDX 6
|
||||
#endif
|
||||
|
||||
@@ -202,7 +202,7 @@ static STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
|
||||
#define SSL_MD_NUM_IDX SSL_MAX_DIGEST
|
||||
static const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
NULL
|
||||
#endif
|
||||
};
|
||||
@@ -215,14 +215,14 @@ static const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX] = {
|
||||
static int ssl_mac_pkey_id[SSL_MD_NUM_IDX] = {
|
||||
EVP_PKEY_HMAC, EVP_PKEY_HMAC, EVP_PKEY_HMAC, NID_undef,
|
||||
EVP_PKEY_HMAC, EVP_PKEY_HMAC,
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
EVP_PKEY_HMAC
|
||||
#endif
|
||||
};
|
||||
|
||||
static int ssl_mac_secret_size[SSL_MD_NUM_IDX] = {
|
||||
0, 0, 0, 0, 0, 0,
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
0
|
||||
#endif
|
||||
};
|
||||
@@ -231,7 +231,7 @@ static int ssl_handshake_digest_flag[SSL_MD_NUM_IDX] = {
|
||||
SSL_HANDSHAKE_MAC_MD5, SSL_HANDSHAKE_MAC_SHA,
|
||||
SSL_HANDSHAKE_MAC_GOST94, 0, SSL_HANDSHAKE_MAC_SHA256,
|
||||
SSL_HANDSHAKE_MAC_SHA384,
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
SSL_HANDSHAKE_MAC_SM3,
|
||||
#endif
|
||||
};
|
||||
@@ -482,7 +482,7 @@ void ssl_load_ciphers(void)
|
||||
ssl_mac_secret_size[SSL_MD_SHA384_IDX] =
|
||||
EVP_MD_size(ssl_digest_methods[SSL_MD_SHA384_IDX]);
|
||||
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
ssl_cipher_methods[SSL_ENC_SM4_IDX] = EVP_get_cipherbyname(SN_sms4_cbc);
|
||||
ssl_digest_methods[SSL_MD_SM3_IDX] = EVP_get_digestbyname(SN_sm3);
|
||||
ssl_mac_secret_size[SSL_MD_SM3_IDX] = EVP_MD_size(ssl_digest_methods[SSL_MD_SM3_IDX]);
|
||||
@@ -609,7 +609,7 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
|
||||
case SSL_AES256GCM:
|
||||
i = SSL_ENC_AES256GCM_IDX;
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_SM4:
|
||||
i = SSL_ENC_SM4_IDX;
|
||||
break;
|
||||
@@ -647,7 +647,7 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
|
||||
case SSL_GOST89MAC:
|
||||
i = SSL_MD_GOST89MAC_IDX;
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_SM3:
|
||||
i = SSL_MD_SM3_IDX;
|
||||
break;
|
||||
@@ -706,7 +706,7 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
|
||||
c->algorithm_mac == SSL_SHA256 &&
|
||||
(evp = EVP_get_cipherbyname("AES-256-CBC-HMAC-SHA256")))
|
||||
*enc = evp, *md = NULL;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
else if (c->algorithm_enc == SSL_SM4 &&
|
||||
c->algorithm_mac == SSL_SM3 &&
|
||||
(evp = EVP_get_cipherbyname("SM4-CBC-HMAC-SM3")))
|
||||
@@ -859,7 +859,7 @@ static void ssl_cipher_get_disabled(unsigned long *mkey, unsigned long *auth,
|
||||
|| ssl_mac_pkey_id[SSL_MD_GOST89MAC_IDX] ==
|
||||
NID_undef) ? SSL_GOST89MAC : 0;
|
||||
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
/* what we should do? */
|
||||
#endif
|
||||
}
|
||||
@@ -1745,7 +1745,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
||||
ver = "SSLv3";
|
||||
else if (alg_ssl & SSL_TLSV1_2)
|
||||
ver = "TLSv1.2";
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
else if (alg_ssl & SSL_GMV1)
|
||||
ver = "GMSSLv1.1";
|
||||
#endif
|
||||
@@ -1786,7 +1786,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
||||
case SSL_kGOST:
|
||||
kx = "GOST";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_kECDHE2:
|
||||
kx = "ECDHE2";
|
||||
break;
|
||||
@@ -1841,7 +1841,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
||||
case SSL_aGOST01:
|
||||
au = "GOST01";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_aSM2:
|
||||
au = "SM2";
|
||||
break;
|
||||
@@ -1895,7 +1895,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
||||
case SSL_eGOST2814789CNT:
|
||||
enc = "GOST89(256)";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_SM4:
|
||||
enc = "SM4(128)";
|
||||
break;
|
||||
@@ -1927,7 +1927,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
||||
case SSL_GOST94:
|
||||
mac = "GOST94";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case SSL_SM3:
|
||||
mac = "SM3";
|
||||
break;
|
||||
@@ -1966,7 +1966,7 @@ char *SSL_CIPHER_get_version(const SSL_CIPHER *c)
|
||||
return ("TLSv1/SSLv3");
|
||||
else if (i == 2)
|
||||
return ("SSLv2");
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
else if (i == 1)
|
||||
return ("GMSSLv1");
|
||||
#endif
|
||||
|
||||
@@ -2850,7 +2850,7 @@ const char *SSL_get_version(const SSL *s)
|
||||
return ("DTLSv1");
|
||||
else if (s->version == DTLS1_2_VERSION)
|
||||
return ("DTLSv1.2");
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
else if (s->version == GM1_VERSION)
|
||||
return ("GMSSLv1.1");
|
||||
#endif
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
# define SSL_kGOST 0x00000200L
|
||||
/* SRP */
|
||||
# define SSL_kSRP 0x00000400L
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
/* GM/T 0024 ECDHE */
|
||||
# define SSL_kECDHE2 0x00000800L
|
||||
/* GM/T 0024 ECC */
|
||||
@@ -350,7 +350,7 @@
|
||||
# define SSL_aGOST01 0x00000200L
|
||||
/* SRP auth */
|
||||
# define SSL_aSRP 0x00000400L
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
/* GM/T 0024 ECDHE, ECC, IBSDH, IBC */
|
||||
# define SSL_aSM2 0x00000800L
|
||||
# endif
|
||||
@@ -371,7 +371,7 @@
|
||||
# define SSL_SEED 0x00000800L
|
||||
# define SSL_AES128GCM 0x00001000L
|
||||
# define SSL_AES256GCM 0x00002000L
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define SSL_SM4 0x00004000L
|
||||
# define SSL_SM1 0x00008000L
|
||||
# endif
|
||||
@@ -389,7 +389,7 @@
|
||||
# define SSL_SHA384 0x00000020L
|
||||
/* Not a real MAC, just an indication it is part of cipher */
|
||||
# define SSL_AEAD 0x00000040L
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define SSL_SM3 0x00000080L
|
||||
# endif
|
||||
|
||||
@@ -398,7 +398,7 @@
|
||||
# define SSL_SSLV3 0x00000002UL
|
||||
# define SSL_TLSV1 SSL_SSLV3/* for now */
|
||||
# define SSL_TLSV1_2 0x00000004UL
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define SSL_GMV1 0x00000008UL
|
||||
# endif
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
# define SSL_HANDSHAKE_MAC_GOST94 0x40
|
||||
# define SSL_HANDSHAKE_MAC_SHA256 0x80
|
||||
# define SSL_HANDSHAKE_MAC_SHA384 0x100
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define SSL_HANDSHAKE_MAC_SM3 0x200
|
||||
# endif
|
||||
# define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA)
|
||||
@@ -418,7 +418,7 @@
|
||||
* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX make
|
||||
* sure to update this constant too
|
||||
*/
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
#define SSL_MAX_DIGEST 7
|
||||
#else
|
||||
#define SSL_MAX_DIGEST 6
|
||||
@@ -534,7 +534,7 @@
|
||||
# define SSL_PKEY_ECC 5
|
||||
# define SSL_PKEY_GOST94 6
|
||||
# define SSL_PKEY_GOST01 7
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define SSL_PKEY_SM9 8
|
||||
# define SSL_PKEY_NUM 9
|
||||
# else
|
||||
@@ -886,11 +886,11 @@ extern SSL3_ENC_METHOD TLSv1_2_enc_data;
|
||||
extern SSL3_ENC_METHOD SSLv3_enc_data;
|
||||
extern SSL3_ENC_METHOD DTLSv1_enc_data;
|
||||
extern SSL3_ENC_METHOD DTLSv1_2_enc_data;
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
extern SSL3_ENC_METHOD GMSSLv1_enc_data;
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
# define IMPLEMENT_gm1_meth_func(func_name, s_accept, s_connect, \
|
||||
s_get_meth) \
|
||||
const SSL_METHOD *func_name(void) \
|
||||
@@ -1385,7 +1385,7 @@ void tls1_clear(SSL *s);
|
||||
long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
|
||||
long tls1_callback_ctrl(SSL *s, int cmd, void (*fp) (void));
|
||||
|
||||
# ifndef OPENSSL_NO_GMSSL
|
||||
# ifndef NO_GMSSL
|
||||
int gm1_num_ciphers(void);
|
||||
const SSL_CIPHER *gm1_get_cipher(unsigned int u);
|
||||
# endif
|
||||
|
||||
@@ -447,7 +447,7 @@ int ssl_get_new_session(SSL *s, int session)
|
||||
} else if (s->version == DTLS1_2_VERSION) {
|
||||
ss->ssl_version = DTLS1_2_VERSION;
|
||||
ss->session_id_length = SSL3_SSL_SESSION_ID_LENGTH;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
} else if (s->version == GM1_VERSION) {
|
||||
ss->ssl_version = GM1_VERSION;
|
||||
ss->session_id_length = SSL3_SSL_SESSION_ID_LENGTH;
|
||||
|
||||
@@ -823,7 +823,7 @@ const char *SSL_state_string(const SSL *s)
|
||||
str = "DWCHVB";
|
||||
break;
|
||||
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
/* GMSSL */
|
||||
#endif
|
||||
|
||||
@@ -951,7 +951,7 @@ const char *SSL_alert_desc_string(int value)
|
||||
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
||||
str = "UP";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case GM1_AD_UNSUPPORTED_SITE2SITE:
|
||||
str = "U2";
|
||||
break;
|
||||
@@ -1073,7 +1073,7 @@ const char *SSL_alert_desc_string_long(int value)
|
||||
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
||||
str = "unknown PSK identity";
|
||||
break;
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
case GM1_AD_UNSUPPORTED_SITE2SITE:
|
||||
str = "unsupported site2site";
|
||||
break;
|
||||
|
||||
@@ -128,7 +128,7 @@ int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
|
||||
s = "DTLSv1.2";
|
||||
else if (x->ssl_version == DTLS1_BAD_VER)
|
||||
s = "DTLSv1-bad";
|
||||
#ifndef OPENSSL_NO_GMSSL
|
||||
#ifndef NO_GMSSL
|
||||
else if (x->ssl_version == GM1_VERSION)
|
||||
s = "GMSSLv1.1";
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user