mirror of https://github.com/wolfSSL/wolfssl
ocsp with static memory, remove unused function
This commit is contained in:
parent
db90594909
commit
e1edadafe1
|
@ -88,7 +88,7 @@ static void FreeOcspEntry(OcspEntry* entry)
|
|||
}
|
||||
|
||||
|
||||
void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
|
||||
void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic, void* heap)
|
||||
{
|
||||
OcspEntry *entry, *next;
|
||||
|
||||
|
@ -97,13 +97,15 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
|
|||
for (entry = ocsp->ocspList; entry; entry = next) {
|
||||
next = entry->next;
|
||||
FreeOcspEntry(entry);
|
||||
XFREE(entry, NULL, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
XFREE(entry, heap, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
}
|
||||
|
||||
FreeMutex(&ocsp->ocspLock);
|
||||
|
||||
if (dynamic)
|
||||
XFREE(ocsp, NULL, DYNAMIC_TYPE_OCSP);
|
||||
XFREE(ocsp, heap, DYNAMIC_TYPE_OCSP);
|
||||
|
||||
(void)heap;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2133,11 +2133,11 @@ void wolfSSL_CertManagerFree(WOLFSSL_CERT_MANAGER* cm)
|
|||
#endif
|
||||
#ifdef HAVE_OCSP
|
||||
if (cm->ocsp)
|
||||
FreeOCSP(cm->ocsp, 1);
|
||||
FreeOCSP(cm->ocsp, 1, cm->heap);
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||
if (cm->ocsp_stapling)
|
||||
FreeOCSP(cm->ocsp_stapling, 1);
|
||||
FreeOCSP(cm->ocsp_stapling, 1, cm->heap);
|
||||
#endif
|
||||
#endif
|
||||
FreeSignerTable(cm->caTable, CA_TABLE_SIZE, cm->heap);
|
||||
|
@ -4308,7 +4308,7 @@ int wolfSSL_CertManagerEnableOCSP(WOLFSSL_CERT_MANAGER* cm, int options)
|
|||
|
||||
if (InitOCSP(cm->ocsp, cm) != 0) {
|
||||
WOLFSSL_MSG("Init OCSP failed");
|
||||
FreeOCSP(cm->ocsp, 1);
|
||||
FreeOCSP(cm->ocsp, 1, cm->heap);
|
||||
cm->ocsp = NULL;
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
@ -4364,7 +4364,7 @@ int wolfSSL_CertManagerEnableOCSPStapling(WOLFSSL_CERT_MANAGER* cm)
|
|||
|
||||
if (InitOCSP(cm->ocsp_stapling, cm) != 0) {
|
||||
WOLFSSL_MSG("Init OCSP failed");
|
||||
FreeOCSP(cm->ocsp_stapling, 1);
|
||||
FreeOCSP(cm->ocsp_stapling, 1, cm->heap);
|
||||
cm->ocsp_stapling = NULL;
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
|
|
@ -4813,7 +4813,7 @@ int wc_ecc_ctx_reset(ecEncCtx* ctx, WC_RNG* rng)
|
|||
}
|
||||
|
||||
|
||||
ecEncCtx* wc_ecc_ctx_new_h(int flags, WC_RNG* rng, void* heap)
|
||||
ecEncCtx* wc_ecc_ctx_new_ex(int flags, WC_RNG* rng, void* heap)
|
||||
{
|
||||
int ret = 0;
|
||||
ecEncCtx* ctx = (ecEncCtx*)XMALLOC(sizeof(ecEncCtx), heap,
|
||||
|
@ -4837,7 +4837,7 @@ ecEncCtx* wc_ecc_ctx_new_h(int flags, WC_RNG* rng, void* heap)
|
|||
/* alloc/init and set defaults, return new Context */
|
||||
ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng)
|
||||
{
|
||||
return wc_ecc_ctx_new_h(flags, rng, NULL);
|
||||
return wc_ecc_ctx_new_ex(flags, rng, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4846,7 +4846,7 @@ void wc_ecc_ctx_free(ecEncCtx* ctx)
|
|||
{
|
||||
if (ctx) {
|
||||
ForceZero(ctx, sizeof(ecEncCtx));
|
||||
XFREE(ctx, 0, DYNAMIC_TYPE_ECC);
|
||||
XFREE(ctx, ctx->heap, DYNAMIC_TYPE_ECC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -246,9 +246,6 @@ int certext_test(void);
|
|||
#ifdef HAVE_IDEA
|
||||
int idea_test(void);
|
||||
#endif
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
int memory_test(void);
|
||||
#endif
|
||||
|
||||
/* General big buffer size for many tests. */
|
||||
#define FOURK_BUF 4096
|
||||
|
@ -314,13 +311,6 @@ int wolfcrypt_test(void* args)
|
|||
#endif /* USE_FAST_MATH */
|
||||
#endif /* !NO_BIG_INT */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if ( (ret = memory_test()) != 0)
|
||||
return err_sys("MEMORY test failed!\n", ret);
|
||||
else
|
||||
printf( "MEMORY test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_MD5
|
||||
if ( (ret = md5_test()) != 0)
|
||||
return err_sys("MD5 test failed!\n", ret);
|
||||
|
@ -712,14 +702,6 @@ static int OpenNitroxDevice(int dma_mode,int dev_id)
|
|||
#endif /* NO_MAIN_DRIVER */
|
||||
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
int memory_test()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
|
||||
|
||||
#ifdef WOLFSSL_MD2
|
||||
int md2_test()
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ struct buffer;
|
|||
typedef struct WOLFSSL_OCSP WOLFSSL_OCSP;
|
||||
|
||||
WOLFSSL_LOCAL int InitOCSP(WOLFSSL_OCSP*, WOLFSSL_CERT_MANAGER*);
|
||||
WOLFSSL_LOCAL void FreeOCSP(WOLFSSL_OCSP*, int dynamic);
|
||||
WOLFSSL_LOCAL void FreeOCSP(WOLFSSL_OCSP*, int dynamic, void* heap);
|
||||
|
||||
WOLFSSL_LOCAL int CheckCertOCSP(WOLFSSL_OCSP*, DecodedCert*,
|
||||
struct buffer* responseBuffer);
|
||||
|
|
|
@ -262,7 +262,7 @@ WOLFSSL_API int wolfSSL_dtls_export(WOLFSSL* ssl, unsigned char* buf,
|
|||
typedef struct WOLFSSL_MEM_STATS WOLFSSL_MEM_STATS;
|
||||
typedef struct WOLFSSL_MEM_CONN_STATS WOLFSSL_MEM_CONN_STATS;
|
||||
WOLFSSL_API int wolfSSL_CTX_load_static_memory(WOLFSSL_CTX** ctx,
|
||||
wolfSSLStaticMethod method,
|
||||
wolfSSLStaticMethod method,
|
||||
unsigned char* buf, unsigned int sz,
|
||||
int flag, int max);
|
||||
WOLFSSL_API int wolfSSL_CTX_is_static_memory(WOLFSSL_CTX* ctx,
|
||||
|
|
|
@ -320,6 +320,8 @@ typedef struct ecEncCtx ecEncCtx;
|
|||
WOLFSSL_API
|
||||
ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng);
|
||||
WOLFSSL_API
|
||||
ecEncCtx* wc_ecc_ctx_new_ex(int flags, WC_RNG* rng, void* heap);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_ctx_free(ecEncCtx*);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_ctx_reset(ecEncCtx*, WC_RNG*); /* reset for use again w/o alloc/free */
|
||||
|
|
Loading…
Reference in New Issue