mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-04 03:52:01 +02:00
components/openssl: optimize the SSL certification and private key function
1. add inheritance function 2. remove low-level platform unload cert & pkey function 3. optimize the cert load and free function
This commit is contained in:
@@ -21,6 +21,15 @@
|
||||
|
||||
#include "ssl_types.h"
|
||||
|
||||
/**
|
||||
* @brief create a certification object include private key object according to input certification
|
||||
*
|
||||
* @param ic - input certification point
|
||||
*
|
||||
* @return certification object point
|
||||
*/
|
||||
CERT *__ssl_cert_new(CERT *ic);
|
||||
|
||||
/**
|
||||
* @brief create a certification object include private key object
|
||||
*
|
||||
|
||||
@@ -69,14 +69,12 @@
|
||||
#define IMPLEMENT_X509_METHOD(func_name, \
|
||||
new, \
|
||||
free, \
|
||||
load, \
|
||||
unload) \
|
||||
load) \
|
||||
const X509_METHOD* func_name(void) { \
|
||||
static const X509_METHOD func_name##_data LOCAL_ATRR = { \
|
||||
new, \
|
||||
free, \
|
||||
load, \
|
||||
unload, \
|
||||
load \
|
||||
}; \
|
||||
return &func_name##_data; \
|
||||
}
|
||||
@@ -84,14 +82,12 @@
|
||||
#define IMPLEMENT_PKEY_METHOD(func_name, \
|
||||
new, \
|
||||
free, \
|
||||
load, \
|
||||
unload) \
|
||||
load) \
|
||||
const PKEY_METHOD* func_name(void) { \
|
||||
static const PKEY_METHOD func_name##_data LOCAL_ATRR = { \
|
||||
new, \
|
||||
free, \
|
||||
load, \
|
||||
unload, \
|
||||
load \
|
||||
}; \
|
||||
return &func_name##_data; \
|
||||
}
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
|
||||
#include "ssl_types.h"
|
||||
|
||||
/**
|
||||
* @brief create a private key object according to input private key
|
||||
*
|
||||
* @param ipk - input private key point
|
||||
*
|
||||
* @return new private key object point
|
||||
*/
|
||||
EVP_PKEY* __EVP_PKEY_new(EVP_PKEY *ipk);
|
||||
|
||||
/**
|
||||
* @brief create a private key object
|
||||
*
|
||||
|
||||
@@ -196,12 +196,8 @@ struct ssl_st
|
||||
/* shut things down(0x01 : sent, 0x02 : received) */
|
||||
int shutdown;
|
||||
|
||||
int crt_reload;
|
||||
|
||||
CERT *cert;
|
||||
|
||||
int ca_reload;
|
||||
|
||||
X509 *client_CA;
|
||||
|
||||
SSL_CTX *ctx;
|
||||
@@ -274,24 +270,20 @@ struct ssl_method_func_st {
|
||||
|
||||
struct x509_method_st {
|
||||
|
||||
int (*x509_new)(X509 *x);
|
||||
int (*x509_new)(X509 *x, X509 *m_x);
|
||||
|
||||
void (*x509_free)(X509 *x);
|
||||
|
||||
int (*x509_load)(X509 *x, const unsigned char *buf, int len);
|
||||
|
||||
void (*x509_unload)(X509 *x);
|
||||
};
|
||||
|
||||
struct pkey_method_st {
|
||||
|
||||
int (*pkey_new)(EVP_PKEY *pkey);
|
||||
int (*pkey_new)(EVP_PKEY *pkey, EVP_PKEY *m_pkey);
|
||||
|
||||
void (*pkey_free)(EVP_PKEY *pkey);
|
||||
|
||||
int (*pkey_load)(EVP_PKEY *pkey, const unsigned char *buf, int len);
|
||||
|
||||
void (*pkey_unload)(EVP_PKEY *pkey);
|
||||
};
|
||||
|
||||
typedef int (*next_proto_cb)(SSL *ssl, unsigned char **out,
|
||||
|
||||
@@ -24,6 +24,15 @@
|
||||
|
||||
DEFINE_STACK_OF(X509_NAME)
|
||||
|
||||
/**
|
||||
* @brief create a X509 certification object according to input X509 certification
|
||||
*
|
||||
* @param ix - input X509 certification point
|
||||
*
|
||||
* @return new X509 certification object point
|
||||
*/
|
||||
X509* __X509_new(X509 *ix);
|
||||
|
||||
/**
|
||||
* @brief create a X509 certification object
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user