mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/openssl: [TW7411] supply doxygen type note
This commit is contained in:
parent
db9becfa74
commit
59bb9a9a01
@ -17,7 +17,22 @@
|
||||
|
||||
#include "ssl_types.h"
|
||||
|
||||
/**
|
||||
* @brief create a certification object include private key object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return certification object point
|
||||
*/
|
||||
CERT* ssl_cert_new(void);
|
||||
void ssl_cert_free(CERT *c);
|
||||
|
||||
/**
|
||||
* @brief free a certification object
|
||||
*
|
||||
* @param cert - certification object point
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void ssl_cert_free(CERT *cert);
|
||||
|
||||
#endif
|
||||
|
@ -72,6 +72,7 @@ typedef enum {
|
||||
MSG_FLOW_FINISHED
|
||||
} MSG_FLOW_STATE;
|
||||
|
||||
/* SSL subsystem states */
|
||||
typedef enum {
|
||||
TLS_ST_BEFORE,
|
||||
TLS_ST_OK,
|
||||
|
@ -15,6 +15,9 @@
|
||||
#ifndef _SSL_METHODS_H_
|
||||
#define _SSL_METHODS_H_
|
||||
|
||||
/**
|
||||
* TLS method function implement
|
||||
*/
|
||||
#define IMPLEMENT_TLS_METHOD_FUNC(func_name, \
|
||||
new, free, \
|
||||
handshake, shutdown, clear, \
|
||||
@ -89,7 +92,22 @@
|
||||
return &func_name##_data; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get X509 object method
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return X509 object method point
|
||||
*/
|
||||
const X509_METHOD* X509_method(void);
|
||||
|
||||
/**
|
||||
* @brief get private key object method
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return private key object method point
|
||||
*/
|
||||
const PKEY_METHOD* EVP_PKEY_method(void);
|
||||
|
||||
#endif
|
||||
|
@ -17,13 +17,38 @@
|
||||
|
||||
#include "ssl_types.h"
|
||||
|
||||
/**
|
||||
* @brief create a private key object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return private key object point
|
||||
*/
|
||||
EVP_PKEY* EVP_PKEY_new(void);
|
||||
|
||||
/**
|
||||
* @brief load a character key context into system context. If '*a' is pointed to the
|
||||
* private key, then load key into it. Or create a new private key object
|
||||
*
|
||||
* @param type - private key type
|
||||
* @param a - a point pointed to a private key point
|
||||
* @param pp - a point pointed to the key context memory point
|
||||
* @param length - key bytes
|
||||
*
|
||||
* @return private key object point
|
||||
*/
|
||||
EVP_PKEY* d2i_PrivateKey(int type,
|
||||
EVP_PKEY **a,
|
||||
const unsigned char **pp,
|
||||
long length);
|
||||
|
||||
/**
|
||||
* @brief free a private key object
|
||||
*
|
||||
* @param pkey - private key object point
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void EVP_PKEY_free(EVP_PKEY *x);
|
||||
|
||||
#endif
|
||||
|
@ -20,17 +20,34 @@
|
||||
|
||||
DEFINE_STACK_OF(X509_NAME)
|
||||
|
||||
/*
|
||||
* sk_X509_NAME_new_null - create a X509 certification object
|
||||
/**
|
||||
* @brief create a X509 certification object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return X509 certification object point or NULL if failed
|
||||
* @return X509 certification object point
|
||||
*/
|
||||
X509* X509_new(void);
|
||||
|
||||
/**
|
||||
* @brief load a character certification context into system context. If '*cert' is pointed to the
|
||||
* certification, then load certification into it. Or create a new X509 certification object
|
||||
*
|
||||
* @param cert - a point pointed to X509 certification
|
||||
* @param buffer - a point pointed to the certification context memory point
|
||||
* @param length - certification bytes
|
||||
*
|
||||
* @return X509 certification object point
|
||||
*/
|
||||
X509* d2i_X509(X509 **cert, const unsigned char *buffer, long len);
|
||||
|
||||
void X509_free(X509 *cert);
|
||||
/**
|
||||
* @brief free a X509 certification object
|
||||
*
|
||||
* @param x - X509 certification object point
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void X509_free(X509 *x);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,12 +18,8 @@
|
||||
#include "ssl_dbg.h"
|
||||
#include "ssl_port.h"
|
||||
|
||||
/*
|
||||
* ssl_cert_new - create a certification object include private key object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return certification object point or NULL if failed
|
||||
/**
|
||||
* @brief create a certification object include private key object
|
||||
*/
|
||||
CERT *ssl_cert_new(void)
|
||||
{
|
||||
@ -51,18 +47,14 @@ failed1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ssl_cert_free - free a certification object
|
||||
*
|
||||
* @param c - certification object point
|
||||
*
|
||||
* @return none
|
||||
/**
|
||||
* @brief free a certification object
|
||||
*/
|
||||
void ssl_cert_free(CERT *c)
|
||||
void ssl_cert_free(CERT *cert)
|
||||
{
|
||||
X509_free(c->x509);
|
||||
X509_free(cert->x509);
|
||||
|
||||
EVP_PKEY_free(c->pkey);
|
||||
EVP_PKEY_free(cert->pkey);
|
||||
|
||||
ssl_free(c);
|
||||
ssl_free(cert);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
||||
#include "ssl_methods.h"
|
||||
#include "ssl_pm.h"
|
||||
|
||||
/*
|
||||
/**
|
||||
* TLS method function collection
|
||||
*/
|
||||
IMPLEMENT_TLS_METHOD_FUNC(TLS_method_func,
|
||||
@ -28,7 +28,7 @@ IMPLEMENT_TLS_METHOD_FUNC(TLS_method_func,
|
||||
ssl_pm_get_verify_result,
|
||||
ssl_pm_get_state);
|
||||
|
||||
/*
|
||||
/**
|
||||
* TLS or SSL client method collection
|
||||
*/
|
||||
IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, 0, TLS_method_func, TLS_client_method);
|
||||
@ -41,7 +41,7 @@ IMPLEMENT_TLS_METHOD(TLS1_VERSION, 0, TLS_method_func, TLSv1_client_method);
|
||||
|
||||
IMPLEMENT_SSL_METHOD(SSL3_VERSION, 0, TLS_method_func, SSLv3_client_method);
|
||||
|
||||
/*
|
||||
/**
|
||||
* TLS or SSL server method collection
|
||||
*/
|
||||
IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, 1, TLS_method_func, TLS_server_method);
|
||||
@ -54,7 +54,7 @@ IMPLEMENT_TLS_METHOD(TLS1_VERSION, 0, TLS_method_func, TLSv1_server_method);
|
||||
|
||||
IMPLEMENT_SSL_METHOD(SSL3_VERSION, 1, TLS_method_func, SSLv3_server_method);
|
||||
|
||||
/*
|
||||
/**
|
||||
* TLS or SSL method collection
|
||||
*/
|
||||
IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, -1, TLS_method_func, TLS_method);
|
||||
@ -67,15 +67,15 @@ IMPLEMENT_SSL_METHOD(TLS1_VERSION, -1, TLS_method_func, TLSv1_method);
|
||||
|
||||
IMPLEMENT_SSL_METHOD(SSL3_VERSION, -1, TLS_method_func, SSLv3_method);
|
||||
|
||||
/*
|
||||
* X509 certification method collection
|
||||
/**
|
||||
* @brief get X509 object method
|
||||
*/
|
||||
IMPLEMENT_X509_METHOD(X509_method,
|
||||
x509_pm_new, x509_pm_free,
|
||||
x509_pm_load, x509_pm_unload);
|
||||
|
||||
/*
|
||||
* private key method collection
|
||||
/**
|
||||
* @brief get private key object method
|
||||
*/
|
||||
IMPLEMENT_PKEY_METHOD(EVP_PKEY_method,
|
||||
pkey_pm_new, pkey_pm_free,
|
||||
|
@ -19,12 +19,8 @@
|
||||
#include "ssl_dbg.h"
|
||||
#include "ssl_port.h"
|
||||
|
||||
/*
|
||||
* EVP_PKEY_new - create a private key object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return private key object point or NULL if failed
|
||||
/**
|
||||
* @brief create a private key object
|
||||
*/
|
||||
EVP_PKEY* EVP_PKEY_new(void)
|
||||
{
|
||||
@ -49,12 +45,8 @@ failed1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* EVP_PKEY_free - free a private key object
|
||||
*
|
||||
* @param pkey - private key object point
|
||||
*
|
||||
* @return none
|
||||
/**
|
||||
* @brief free a private key object
|
||||
*/
|
||||
void EVP_PKEY_free(EVP_PKEY *pkey)
|
||||
{
|
||||
@ -63,16 +55,9 @@ void EVP_PKEY_free(EVP_PKEY *pkey)
|
||||
ssl_free(pkey);
|
||||
}
|
||||
|
||||
/*
|
||||
* d2i_PrivateKey - load a character key context into system context. If '*a' is pointed to the
|
||||
/**
|
||||
* @brief load a character key context into system context. If '*a' is pointed to the
|
||||
* private key, then load key into it. Or create a new private key object
|
||||
*
|
||||
* @param type - private key type
|
||||
* @param a - a point pointed to a private key point
|
||||
* @param pp - a point pointed to the key context memory point
|
||||
* @param length - key bytes
|
||||
*
|
||||
* @return private key object point or NULL if failed
|
||||
*/
|
||||
EVP_PKEY *d2i_PrivateKey(int type,
|
||||
EVP_PKEY **a,
|
||||
@ -112,15 +97,8 @@ failed1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate - set the SSL context private key
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param x - private key point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief set the SSL context private key
|
||||
*/
|
||||
int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
|
||||
{
|
||||
@ -135,15 +113,8 @@ int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate - set the SSL private key
|
||||
*
|
||||
* @param ctx - SSL point
|
||||
* @param x - private key point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief set the SSL private key
|
||||
*/
|
||||
int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
|
||||
{
|
||||
@ -163,17 +134,8 @@ int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_PrivateKey_ASN1 - load private key into the SSL context
|
||||
*
|
||||
* @param type - private key type
|
||||
* @param ctx - SSL context point
|
||||
* @param d - private key context point
|
||||
* @param len - private key context bytes
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load private key into the SSL context
|
||||
*/
|
||||
int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx,
|
||||
const unsigned char *d, long len)
|
||||
@ -197,17 +159,8 @@ failed1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_use_PrivateKey_ASN1 - load private key into the SSL
|
||||
*
|
||||
* @param type - private key type
|
||||
* @param ctx - SSL context point
|
||||
* @param d - private key context point
|
||||
* @param len - private key context bytes
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load private key into the SSL
|
||||
*/
|
||||
int SSL_use_PrivateKey_ASN1(int type, SSL *ssl,
|
||||
const unsigned char *d, long len)
|
||||
@ -255,48 +208,24 @@ failed1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate_file - load the private key file into SSL context
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param file - private key file name
|
||||
* @param type - private key encoding type
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load the private key file into SSL context
|
||||
*/
|
||||
int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_use_PrivateKey_file - load the private key file into SSL
|
||||
*
|
||||
* @param ctx - SSL point
|
||||
* @param file - private key file name
|
||||
* @param type - private key encoding type
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load the private key file into SSL
|
||||
*/
|
||||
int SSL_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate_ASN1 - load the RSA ASN1 private key into SSL context
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param d - data point
|
||||
* @param len - RSA private key length
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load the RSA ASN1 private key into SSL context
|
||||
*/
|
||||
int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
|
||||
{
|
||||
|
@ -18,12 +18,8 @@
|
||||
#include "ssl_dbg.h"
|
||||
#include "ssl_port.h"
|
||||
|
||||
/*
|
||||
* sk_X509_NAME_new_null - create a X509 certification object
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return X509 certification object point or NULL if failed
|
||||
/**
|
||||
* @brief create a X509 certification object
|
||||
*/
|
||||
X509* X509_new(void)
|
||||
{
|
||||
@ -48,12 +44,8 @@ failed1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* X509_free - free a X509 certification object
|
||||
*
|
||||
* @param x - X509 certification object point
|
||||
*
|
||||
* @return none
|
||||
/**
|
||||
* @brief free a X509 certification object
|
||||
*/
|
||||
void X509_free(X509 *x)
|
||||
{
|
||||
@ -62,15 +54,9 @@ void X509_free(X509 *x)
|
||||
ssl_free(x);
|
||||
};
|
||||
|
||||
/*
|
||||
* d2i_X509 - load a character certification context into system context. If '*cert' is pointed to the
|
||||
/**
|
||||
* @brief load a character certification context into system context. If '*cert' is pointed to the
|
||||
* certification, then load certification into it. Or create a new X509 certification object
|
||||
*
|
||||
* @param cert - a point pointed to X509 certification
|
||||
* @param buffer - a point pointed to the certification context memory point
|
||||
* @param length - certification bytes
|
||||
*
|
||||
* @return X509 certification object point or NULL if failed
|
||||
*/
|
||||
X509* d2i_X509(X509 **cert, const unsigned char *buffer, long len)
|
||||
{
|
||||
@ -103,15 +89,8 @@ failed1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_add_client_CA - set SSL context client CA certification
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param x - client CA certification point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief set SSL context client CA certification
|
||||
*/
|
||||
int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
|
||||
{
|
||||
@ -126,15 +105,8 @@ 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
|
||||
/**
|
||||
* @brief add CA client certification into the SSL
|
||||
*/
|
||||
int SSL_add_client_CA(SSL *ssl, X509 *x)
|
||||
{
|
||||
@ -151,15 +123,8 @@ int SSL_add_client_CA(SSL *ssl, X509 *x)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate - set the SSL context certification
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param x - X509 certification point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief set the SSL context certification
|
||||
*/
|
||||
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
|
||||
{
|
||||
@ -171,15 +136,8 @@ int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate - set the SSL certification
|
||||
*
|
||||
* @param ctx - SSL point
|
||||
* @param x - X509 certification point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief set the SSL certification
|
||||
*/
|
||||
int SSL_use_certificate(SSL *ssl, X509 *x)
|
||||
{
|
||||
@ -191,12 +149,8 @@ int SSL_use_certificate(SSL *ssl, X509 *x)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_get_certificate - get the SSL certification point
|
||||
*
|
||||
* @param ssl - SSL point
|
||||
*
|
||||
* @return SSL certification point
|
||||
/**
|
||||
* @brief get the SSL certification point
|
||||
*/
|
||||
X509 *SSL_get_certificate(const SSL *ssl)
|
||||
{
|
||||
@ -205,16 +159,8 @@ X509 *SSL_get_certificate(const SSL *ssl)
|
||||
return ssl->cert->x509;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate_ASN1 - load certification into the SSL context
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param len - certification context bytes
|
||||
* @param d - certification context point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load certification into the SSL context
|
||||
*/
|
||||
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len,
|
||||
const unsigned char *d)
|
||||
@ -238,16 +184,8 @@ failed1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_use_certificate_ASN1 - load certification into the SSL
|
||||
*
|
||||
* @param ctx - SSL point
|
||||
* @param len - certification context bytes
|
||||
* @param d - certification context point
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load certification into the SSL
|
||||
*/
|
||||
int SSL_use_certificate_ASN1(SSL *ssl, int len,
|
||||
const unsigned char *d)
|
||||
@ -295,44 +233,24 @@ failed1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_CTX_use_certificate_file - load the certification file into SSL context
|
||||
*
|
||||
* @param ctx - SSL context point
|
||||
* @param file - certification file name
|
||||
* @param type - certification encoding type
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load the certification file into SSL context
|
||||
*/
|
||||
int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_use_certificate_file - load the certification file into SSL
|
||||
*
|
||||
* @param ctx - SSL point
|
||||
* @param file - certification file name
|
||||
* @param type - certification encoding type
|
||||
*
|
||||
* @return
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
/**
|
||||
* @brief load the certification file into SSL
|
||||
*/
|
||||
int SSL_use_certificate_file(SSL *ssl, const char *file, int type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SSL_get_peer_certificate - get peer certification
|
||||
*
|
||||
* @param ssl - SSL point
|
||||
*
|
||||
* @return certification
|
||||
/**
|
||||
* @brief get peer certification
|
||||
*/
|
||||
X509 *SSL_get_peer_certificate(const SSL *ssl)
|
||||
{
|
||||
|
@ -62,6 +62,9 @@ unsigned int max_content_len;
|
||||
/*********************************************************************************************/
|
||||
/************************************ SSL arch interface *************************************/
|
||||
|
||||
/**
|
||||
* @brief create SSL low-level object
|
||||
*/
|
||||
int ssl_pm_new(SSL *ssl)
|
||||
{
|
||||
struct ssl_pm *ssl_pm;
|
||||
@ -140,6 +143,9 @@ failed1:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief free SSL low-level object
|
||||
*/
|
||||
void ssl_pm_free(SSL *ssl)
|
||||
{
|
||||
struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
|
||||
@ -156,6 +162,9 @@ void ssl_pm_free(SSL *ssl)
|
||||
ssl->ssl_pm = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief reload SSL low-level certification object
|
||||
*/
|
||||
static int ssl_pm_reload_crt(SSL *ssl)
|
||||
{
|
||||
int ret;
|
||||
|
Loading…
Reference in New Issue
Block a user