Merge pull request #460 from dgarske/DerBufMemcpyCleanup

Cleanup of DerBuffer duplication
This commit is contained in:
toddouska
2016-06-24 14:51:30 -07:00
committed by GitHub

View File

@@ -3917,7 +3917,7 @@ static int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
}
#endif
}
XMEMCPY(&ssl->buffers.certificate, &der, sizeof(der));
ssl->buffers.certificate = der;
#ifdef KEEP_OUR_CERT
ssl->keepCert = 1; /* hold cert for ssl lifetime */
#endif
@@ -3932,7 +3932,7 @@ static int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
ctx->ourCert = NULL;
}
#endif
XMEMCPY(&ctx->certificate, &der, sizeof(der));
ctx->certificate = der;
}
}
else if (type == PRIVATEKEY_TYPE) {
@@ -3941,12 +3941,12 @@ static int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
if (ssl->buffers.weOwnKey) {
FreeDer(&ssl->buffers.key);
}
XMEMCPY(&ssl->buffers.key, &der, sizeof(der));
ssl->buffers.key = der;
ssl->buffers.weOwnKey = 1;
}
else if (ctx) {
FreeDer(&ctx->privateKey);
XMEMCPY(&ctx->privateKey, &der, sizeof(der));
ctx->privateKey = der;
}
}
else {