Fixes from review

This commit is contained in:
Eric Blankenhorn
2018-12-11 11:30:13 -06:00
parent 1c0fa6fb58
commit 59bfead3c8
2 changed files with 23 additions and 11 deletions

View File

@@ -16662,10 +16662,8 @@ static void test_wc_PemPubKeyToDer(void)
printf(testingFmt, "wc_PemPubKeyToDer()");
#if 0 /* NULL filename causes valgrind failure */
ret = wc_PemPubKeyToDer(NULL, cert_der, (int)cert_dersz);
AssertIntGE(ret, BUFFER_E);
#endif
AssertIntGE(ret, BAD_FUNC_ARG);
if (cert_der) {
ret = wc_PemPubKeyToDer(key, cert_der, (int)cert_dersz);
@@ -19851,7 +19849,7 @@ static void test_wolfSSL_SESSION(void)
#ifdef HAVE_SESSION_TICKET
/* Test set/get session ticket */
{
char ticket[] = "This is a session ticket";
const char* ticket = "This is a session ticket";
char buf[64] = {0};
word32 bufSz = (word32)sizeof(buf);
@@ -21288,7 +21286,7 @@ static void test_wc_SetIssueBuffer(void)
{
#if !defined(NO_ASN) && !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA) && \
defined(WOLFSSL_CERT_GEN) && defined(WOLFSSL_CERT_EXT)
char joiCertFile[] = "./certs/test/cert-ext-joi.pem";
const char* joiCertFile = "./certs/test/cert-ext-joi.pem";
WOLFSSL_X509* x509;
int peerCertSz;
const byte* peerCertBuf;

View File

@@ -9252,15 +9252,22 @@ int wc_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz)
int dynamic = 0;
int ret = 0;
long sz = 0;
XFILE file = XFOPEN(fileName, "rb");
XFILE file;
DerBuffer* converted = NULL;
WOLFSSL_ENTER("wc_PemCertToDer");
if (file == XBADFILE) {
ret = BUFFER_E;
if (fileName == NULL) {
ret = BAD_FUNC_ARG;
}
else {
file = XFOPEN(fileName, "rb");
if (file == XBADFILE) {
ret = BUFFER_E;
}
}
if (ret == 0) {
if(XFSEEK(file, 0, XSEEK_END) != 0)
ret = BUFFER_E;
sz = XFTELL(file);
@@ -9326,15 +9333,22 @@ int wc_PemPubKeyToDer(const char* fileName,
int dynamic = 0;
int ret = 0;
long sz = 0;
XFILE file = XFOPEN(fileName, "rb");
XFILE file;
DerBuffer* converted = NULL;
WOLFSSL_ENTER("wc_PemPubKeyToDer");
if (file == XBADFILE) {
ret = BUFFER_E;
if (fileName == NULL) {
ret = BAD_FUNC_ARG;
}
else {
file = XFOPEN(fileName, "rb");
if (file == XBADFILE) {
ret = BUFFER_E;
}
}
if (ret == 0) {
if(XFSEEK(file, 0, XSEEK_END) != 0)
ret = BUFFER_E;
sz = XFTELL(file);