diff --git a/components/openssl/include/internal/ssl_types.h b/components/openssl/include/internal/ssl_types.h index 417350627c..7f8503e2ab 100644 --- a/components/openssl/include/internal/ssl_types.h +++ b/components/openssl/include/internal/ssl_types.h @@ -20,7 +20,6 @@ typedef void SSL_CIPHER; typedef void X509_STORE_CTX; -typedef void X509_NAME; typedef void X509_STORE; typedef void RSA; @@ -28,7 +27,19 @@ typedef void RSA; typedef void STACK; typedef void BIO; -#define STACK_OF(x) x +#define STACK_OF(type) struct stack_st_##type + +#define SKM_DEFINE_STACK_OF(t1, t2, t3) \ + STACK_OF(t1); \ + static ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ + } \ + +#define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) + +struct stack_st; +typedef struct stack_st OPENSSL_STACK; struct ssl_method_st; typedef struct ssl_method_st SSL_METHOD; @@ -66,6 +77,10 @@ typedef struct x509_method_st X509_METHOD; struct pkey_method_st; typedef struct pkey_method_st PKEY_METHOD; +struct stack_st { + char *data; +}; + struct evp_pkey_st { void *pkey_pm; diff --git a/components/openssl/include/internal/ssl_x509.h b/components/openssl/include/internal/ssl_x509.h index a169352bac..0583cd94e4 100644 --- a/components/openssl/include/internal/ssl_x509.h +++ b/components/openssl/include/internal/ssl_x509.h @@ -17,6 +17,8 @@ #include "ssl_types.h" +DEFINE_STACK_OF(X509_NAME) + X509* sk_X509_NAME_new_null(void); X509* d2i_X509(X509 **cert, const unsigned char *buffer, long len); diff --git a/components/openssl/library/ssl_x509.c b/components/openssl/library/ssl_x509.c index 219f283991..e322b6ad3d 100644 --- a/components/openssl/library/ssl_x509.c +++ b/components/openssl/library/ssl_x509.c @@ -119,6 +119,21 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x) return 1; } +/* + * SSL_add_client_CA - add CA client certification into the SSL + * + * @param ssl - SSL point + * @param x - CA certification point + * + * @return + * 1 : OK + * 0 : failed + */ +int SSL_add_client_CA(SSL *ssl, X509 *x) +{ + +} + /* * SSL_CTX_use_certificate - set the SSL context certification * @@ -139,6 +154,18 @@ int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) return 1; } +/* + * SSL_get_certificate - get the SSL certification point + * + * @param ssl - SSL point + * + * @return SSL certification point + */ +X509 *SSL_get_certificate(const SSL *ssl) +{ + return ssl->cert->x509; +} + /* * SSL_CTX_use_certificate_ASN1 - load certification into the SSL context *