mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
add crl missing url callback
This commit is contained in:
@@ -382,11 +382,11 @@ CYASSL_LOCAL int EncodeOcspRequest(DecodedCert*, byte*, word32);
|
|||||||
#endif /* HAVE_OCSP */
|
#endif /* HAVE_OCSP */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CRL
|
/* for pointer use */
|
||||||
|
|
||||||
|
|
||||||
typedef struct RevokedCert RevokedCert;
|
typedef struct RevokedCert RevokedCert;
|
||||||
|
|
||||||
|
#ifdef HAVE_CRL
|
||||||
|
|
||||||
struct RevokedCert {
|
struct RevokedCert {
|
||||||
byte serialNumber[EXTERNAL_SERIAL_SIZE];
|
byte serialNumber[EXTERNAL_SERIAL_SIZE];
|
||||||
int serialSz;
|
int serialSz;
|
||||||
|
@@ -798,10 +798,12 @@ CYASSL_API int CyaSSL_CertManagerSetCRL_Cb(CYASSL_CERT_MANAGER*, CbMissingCRL);
|
|||||||
CYASSL_API int CyaSSL_EnableCRL(CYASSL* ssl, int options);
|
CYASSL_API int CyaSSL_EnableCRL(CYASSL* ssl, int options);
|
||||||
CYASSL_API int CyaSSL_DisableCRL(CYASSL* ssl);
|
CYASSL_API int CyaSSL_DisableCRL(CYASSL* ssl);
|
||||||
CYASSL_API int CyaSSL_LoadCRL(CYASSL*, const char*, int);
|
CYASSL_API int CyaSSL_LoadCRL(CYASSL*, const char*, int);
|
||||||
|
CYASSL_API int CyaSSL_SetCRL_Cb(CYASSL*, CbMissingCRL);
|
||||||
|
|
||||||
CYASSL_API int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options);
|
CYASSL_API int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options);
|
||||||
CYASSL_API int CyaSSL_CTX_DisableCRL(CYASSL_CTX* ctx);
|
CYASSL_API int CyaSSL_CTX_DisableCRL(CYASSL_CTX* ctx);
|
||||||
CYASSL_API int CyaSSL_CTX_LoadCRL(CYASSL_CTX*, const char*, int);
|
CYASSL_API int CyaSSL_CTX_LoadCRL(CYASSL_CTX*, const char*, int);
|
||||||
|
CYASSL_API int CyaSSL_CTX_SetCRL_Cb(CYASSL_CTX*, CbMissingCRL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -575,6 +575,16 @@ static int myVerify(int preverify, CYASSL_X509_STORE_CTX* store)
|
|||||||
#endif /* VERIFY_CALLBACK */
|
#endif /* VERIFY_CALLBACK */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CRL
|
||||||
|
|
||||||
|
static void CRL_CallBack(char* url)
|
||||||
|
{
|
||||||
|
printf("CRL callback url = %s\n", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static INLINE void CaCb(unsigned char* der, int sz, int type)
|
static INLINE void CaCb(unsigned char* der, int sz, int type)
|
||||||
{
|
{
|
||||||
printf("Got CA cache add callback, derSz = %d, type = %d\n", sz, type);
|
printf("Got CA cache add callback, derSz = %d, type = %d\n", sz, type);
|
||||||
|
@@ -210,6 +210,7 @@ void client_test(void* args)
|
|||||||
#ifdef HAVE_CRL
|
#ifdef HAVE_CRL
|
||||||
CyaSSL_EnableCRL(ssl, 0);
|
CyaSSL_EnableCRL(ssl, 0);
|
||||||
CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM);
|
CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM);
|
||||||
|
CyaSSL_SetCRL_Cb(ssl, CRL_CallBack);
|
||||||
#endif
|
#endif
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
CyaSSL_check_domain_name(ssl, "www.yassl.com");
|
CyaSSL_check_domain_name(ssl, "www.yassl.com");
|
||||||
|
15
src/crl.c
15
src/crl.c
@@ -144,8 +144,19 @@ int CheckCertCRL(CYASSL_CRL* crl, DecodedCert* cert)
|
|||||||
if (foundEntry == 0) {
|
if (foundEntry == 0) {
|
||||||
CYASSL_MSG("Couldn't find CRL for status check");
|
CYASSL_MSG("Couldn't find CRL for status check");
|
||||||
ret = CRL_MISSING;
|
ret = CRL_MISSING;
|
||||||
if (crl->cm->cbMissingCRL)
|
if (crl->cm->cbMissingCRL) {
|
||||||
crl->cm->cbMissingCRL(NULL);
|
char url[256];
|
||||||
|
|
||||||
|
CYASSL_MSG("Issuing missing CRL callback");
|
||||||
|
url[0] = '\0';
|
||||||
|
if (cert->extCrlInfoSz < sizeof(url) -1 ) {
|
||||||
|
XMEMCPY(url, cert->extCrlInfo, cert->extCrlInfoSz);
|
||||||
|
url[cert->extCrlInfoSz] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CYASSL_MSG("CRL url too long");
|
||||||
|
crl->cm->cbMissingCRL(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
22
src/ssl.c
22
src/ssl.c
@@ -1186,8 +1186,10 @@ int ProcessFile(CYASSL_CTX* ctx, const char* fname, int format, int type,
|
|||||||
else {
|
else {
|
||||||
if (type == CA_TYPE && format == SSL_FILETYPE_PEM)
|
if (type == CA_TYPE && format == SSL_FILETYPE_PEM)
|
||||||
ret = ProcessChainBuffer(ctx, myBuffer, sz, format, type, ssl);
|
ret = ProcessChainBuffer(ctx, myBuffer, sz, format, type, ssl);
|
||||||
|
#ifdef HAVE_CRL
|
||||||
else if (type == CRL_TYPE)
|
else if (type == CRL_TYPE)
|
||||||
ret = BufferLoadCRL(crl, myBuffer, sz, format);
|
ret = BufferLoadCRL(crl, myBuffer, sz, format);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
ret = ProcessBuffer(ctx, myBuffer, sz, format, type, ssl, NULL,
|
ret = ProcessBuffer(ctx, myBuffer, sz, format, type, ssl, NULL,
|
||||||
userChain);
|
userChain);
|
||||||
@@ -1479,6 +1481,16 @@ int CyaSSL_LoadCRL(CYASSL* ssl, const char* path, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CyaSSL_SetCRL_Cb(CYASSL* ssl, CbMissingCRL cb)
|
||||||
|
{
|
||||||
|
CYASSL_ENTER("CyaSSL_SetCRL_Cb");
|
||||||
|
if (ssl)
|
||||||
|
return CyaSSL_CertManagerSetCRL_Cb(ssl->ctx->cm, cb);
|
||||||
|
else
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options)
|
int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options)
|
||||||
{
|
{
|
||||||
CYASSL_ENTER("CyaSSL_CTX_EnableCRL");
|
CYASSL_ENTER("CyaSSL_CTX_EnableCRL");
|
||||||
@@ -1509,6 +1521,16 @@ int CyaSSL_CTX_LoadCRL(CYASSL_CTX* ctx, const char* path, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CyaSSL_CTX_SetCRL_Cb(CYASSL_CTX* ctx, CbMissingCRL cb)
|
||||||
|
{
|
||||||
|
CYASSL_ENTER("CyaSSL_CTX_SetCRL_Cb");
|
||||||
|
if (ctx)
|
||||||
|
return CyaSSL_CertManagerSetCRL_Cb(ctx->cm, cb);
|
||||||
|
else
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* HAVE_CRL */
|
#endif /* HAVE_CRL */
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user