mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
use const variable as the size for an array
This commit is contained in:
@@ -911,12 +911,16 @@ exit:
|
|||||||
|
|
||||||
static int atcatls_set_certificates(WOLFSSL_CTX *ctx)
|
static int atcatls_set_certificates(WOLFSSL_CTX *ctx)
|
||||||
{
|
{
|
||||||
|
#ifndef ATCATLS_MAX_CERT_SIZE
|
||||||
|
#define ATCATLS_MAX_CERT_SIZE 560
|
||||||
|
#endif
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
ATCA_STATUS status;
|
ATCA_STATUS status;
|
||||||
size_t signerCertSize = 1024;
|
size_t signerCertSize = ATCATLS_MAX_CERT_SIZE;
|
||||||
uint8_t signerCert[signerCertSize];
|
uint8_t signerCert[ATCATLS_MAX_CERT_SIZE];
|
||||||
size_t deviceCertSize = 1024;
|
size_t deviceCertSize = ATCATLS_MAX_CERT_SIZE;
|
||||||
uint8_t deviceCert[deviceCertSize];
|
uint8_t deviceCert[ATCATLS_MAX_CERT_SIZE];
|
||||||
int devPemSz, signerPemSz;
|
int devPemSz, signerPemSz;
|
||||||
char devCertChain[2048];
|
char devCertChain[2048];
|
||||||
|
|
||||||
@@ -934,12 +938,14 @@ static int atcatls_set_certificates(WOLFSSL_CTX *ctx)
|
|||||||
}
|
}
|
||||||
/*Generate a PEM chain of device certificate.*/
|
/*Generate a PEM chain of device certificate.*/
|
||||||
XMEMSET(devCertChain, 0, sizeof(devCertChain));
|
XMEMSET(devCertChain, 0, sizeof(devCertChain));
|
||||||
devPemSz = wc_DerToPem(deviceCert, deviceCertSize, (byte*)&devCertChain[0], sizeof(devCertChain), CERT_TYPE);
|
devPemSz = wc_DerToPem(deviceCert, deviceCertSize, (byte*)&devCertChain[0],
|
||||||
if((devPemSz <= 0)){
|
sizeof(devCertChain), CERT_TYPE);
|
||||||
|
if(devPemSz <= 0){
|
||||||
return devPemSz;
|
return devPemSz;
|
||||||
}
|
}
|
||||||
signerPemSz = wc_DerToPem(signerCert, signerCertSize, (byte*)&devCertChain[devPemSz], sizeof(devCertChain)-devPemSz, CERT_TYPE);
|
signerPemSz = wc_DerToPem(signerCert, signerCertSize, (byte*)&devCertChain[devPemSz],
|
||||||
if((signerPemSz <= 0)){
|
sizeof(devCertChain)-devPemSz, CERT_TYPE);
|
||||||
|
if(signerPemSz <= 0){
|
||||||
return signerPemSz;
|
return signerPemSz;
|
||||||
}
|
}
|
||||||
ret = wolfSSL_CTX_use_certificate_chain_buffer(ctx, (const unsigned char*)devCertChain, XSTRLEN(devCertChain));
|
ret = wolfSSL_CTX_use_certificate_chain_buffer(ctx, (const unsigned char*)devCertChain, XSTRLEN(devCertChain));
|
||||||
@@ -967,7 +973,7 @@ int atcatls_set_callbacks(WOLFSSL_CTX* ctx)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int atcatls_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
|
int atcatls_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
|
||||||
|
Reference in New Issue
Block a user