Merge branch 'master' of github.com:cyassl/cyassl

This commit is contained in:
toddouska 2014-03-26 12:15:04 -07:00
commit 23300a201f
2 changed files with 14 additions and 10 deletions

View File

@ -273,7 +273,8 @@ enum {
DYNAMIC_TYPE_CAVIUM_RSA = 41,
DYNAMIC_TYPE_X509 = 42,
DYNAMIC_TYPE_TLSX = 43,
DYNAMIC_TYPE_OCSP = 44
DYNAMIC_TYPE_OCSP = 44,
DYNAMIC_TYPE_SIGNATURE = 45
};
/* max error buffer string size */

View File

@ -1324,7 +1324,7 @@ void FreeX509(CYASSL_X509* x509)
if (x509->pubKey.buffer)
XFREE(x509->pubKey.buffer, NULL, DYNAMIC_TYPE_PUBLIC_KEY);
XFREE(x509->derCert.buffer, NULL, DYNAMIC_TYPE_SUBJECT_CN);
XFREE(x509->sig.buffer, NULL, 0);
XFREE(x509->sig.buffer, NULL, DYNAMIC_TYPE_SIGNATURE);
#ifdef OPENSSL_EXTRA
XFREE(x509->authKeyId, NULL, 0);
XFREE(x509->subjKeyId, NULL, 0);
@ -3172,14 +3172,17 @@ int CopyDecodedToX509(CYASSL_X509* x509, DecodedCert* dCert)
ret = MEMORY_E;
}
x509->sig.buffer = (byte*)XMALLOC(dCert->sigLength, NULL, 0);
if (x509->sig.buffer == NULL) {
ret = MEMORY_E;
}
else {
XMEMCPY(x509->sig.buffer, dCert->signature, dCert->sigLength);
x509->sig.length = dCert->sigLength;
x509->sigOID = dCert->signatureOID;
if (dCert->signature != NULL && dCert->sigLength != 0) {
x509->sig.buffer = (byte*)XMALLOC(
dCert->sigLength, NULL, DYNAMIC_TYPE_SIGNATURE);
if (x509->sig.buffer == NULL) {
ret = MEMORY_E;
}
else {
XMEMCPY(x509->sig.buffer, dCert->signature, dCert->sigLength);
x509->sig.length = dCert->sigLength;
x509->sigOID = dCert->signatureOID;
}
}
/* store cert for potential retrieval */