35 Ret = OPENSSL_init_ssl (
36 OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS,
66 SSL_CTX_free ((SSL_CTX *)(TlsCtx));
91 ProtoVersion = (MajorVer << 8) | MinorVer;
93 TlsCtx = SSL_CTX_new (SSLv23_client_method ());
101 SSL_CTX_set_options (TlsCtx, SSL_OP_NO_SSLv3);
107 SSL_CTX_set_min_proto_version (TlsCtx, ProtoVersion);
109 return (VOID *)TlsCtx;
130 if (TlsConn ==
NULL) {
137 if (TlsConn->Ssl !=
NULL) {
138 SSL_free (TlsConn->Ssl);
165 X509_STORE *X509Store;
173 if (TlsConn ==
NULL) {
182 TlsConn->Ssl = SSL_new ((SSL_CTX *)TlsCtx);
183 if (TlsConn->Ssl ==
NULL) {
191 SSL_set_security_level (TlsConn->Ssl, 0);
196 SSL_set_info_callback (TlsConn->Ssl,
NULL);
198 TlsConn->InBio =
NULL;
203 TlsConn->InBio = BIO_new (BIO_s_mem ());
204 if (TlsConn->InBio ==
NULL) {
213 BIO_set_mem_eof_return (TlsConn->InBio, -1);
215 TlsConn->OutBio =
NULL;
220 TlsConn->OutBio = BIO_new (BIO_s_mem ());
221 if (TlsConn->OutBio ==
NULL) {
230 BIO_set_mem_eof_return (TlsConn->OutBio, -1);
232 ASSERT (TlsConn->Ssl !=
NULL && TlsConn->InBio !=
NULL && TlsConn->OutBio !=
NULL);
237 SSL_set_bio (TlsConn->Ssl, TlsConn->InBio, TlsConn->OutBio);
242 SslCtx = SSL_get_SSL_CTX (TlsConn->Ssl);
243 X509Store = SSL_CTX_get_cert_store (SslCtx);
244 if (X509Store ==
NULL) {
245 X509Store = X509_STORE_new ();
246 if (X509Store ==
NULL) {
251 SSL_CTX_set1_verify_cert_store (SslCtx, X509Store);
252 X509_STORE_free (X509Store);
258 X509_STORE_set_flags (
260 X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME
262 return (VOID *)TlsConn;
BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize)
VOID *EFIAPI TlsCtxNew(IN UINT8 MajorVer, IN UINT8 MinorVer)
VOID EFIAPI TlsFree(IN VOID *Tls)
VOID *EFIAPI TlsNew(IN VOID *TlsCtx)
VOID EFIAPI TlsCtxFree(IN VOID *TlsCtx)
BOOLEAN EFIAPI TlsInitialize(VOID)