add CyaSSL_X509_get_serial_number()

This commit is contained in:
Todd A Ouska
2011-03-11 15:22:16 -08:00
parent f874bf9b76
commit b9ff110b2e
7 changed files with 37 additions and 1 deletions

View File

@@ -668,6 +668,7 @@ void InitDecodedCert(DecodedCert* cert, byte* source, void* heap)
cert->source = source; /* don't own */
cert->srcIdx = 0;
cert->heap = heap;
XMEMSET(cert->serial, 0, SERIAL_SIZE);
#ifdef CYASSL_CERT_GEN
cert->subjectSN = 0;
cert->subjectSNLen = 0;
@@ -718,6 +719,12 @@ static int GetCertHeader(DecodedCert* cert, word32 inSz)
if (GetInt(&mpi, cert->source, &cert->srcIdx) < 0)
ret = ASN_PARSE_E;
len = mp_unsigned_bin_size(&mpi);
if (len > SERIAL_SIZE)
ret = MP_TO_E;
if (mp_to_unsigned_bin(&mpi, cert->serial + (SERIAL_SIZE - len)) != MP_OKAY)
ret = MP_TO_E;
mp_clear(&mpi);
return ret;
}