expose more ASN.1 helper functions with CYASSL_LOCAL
This commit is contained in:
parent
80c19aaf33
commit
d63c58864f
@ -439,8 +439,8 @@ CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int GetSequence(const byte* input, word32* inOutIdx, int* len,
|
CYASSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len,
|
||||||
word32 maxIdx)
|
word32 maxIdx)
|
||||||
{
|
{
|
||||||
int length = -1;
|
int length = -1;
|
||||||
word32 idx = *inOutIdx;
|
word32 idx = *inOutIdx;
|
||||||
@ -456,7 +456,8 @@ static int GetSequence(const byte* input, word32* inOutIdx, int* len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int GetSet(const byte* input, word32* inOutIdx, int* len, word32 maxIdx)
|
CYASSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
|
||||||
|
word32 maxIdx)
|
||||||
{
|
{
|
||||||
int length = -1;
|
int length = -1;
|
||||||
word32 idx = *inOutIdx;
|
word32 idx = *inOutIdx;
|
||||||
@ -473,7 +474,7 @@ static int GetSet(const byte* input, word32* inOutIdx, int* len, word32 maxIdx)
|
|||||||
|
|
||||||
|
|
||||||
/* winodws header clash for WinCE using GetVersion */
|
/* winodws header clash for WinCE using GetVersion */
|
||||||
static int GetMyVersion(const byte* input, word32* inOutIdx, int* version)
|
CYASSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx, int* version)
|
||||||
{
|
{
|
||||||
word32 idx = *inOutIdx;
|
word32 idx = *inOutIdx;
|
||||||
|
|
||||||
@ -537,7 +538,7 @@ static int GetExplicitVersion(const byte* input, word32* inOutIdx, int* version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
|
CYASSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
|
||||||
word32 maxIdx)
|
word32 maxIdx)
|
||||||
{
|
{
|
||||||
word32 i = *inOutIdx;
|
word32 i = *inOutIdx;
|
||||||
@ -593,7 +594,7 @@ static int GetObjectId(const byte* input, word32* inOutIdx, word32* oid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
CYASSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
||||||
word32 maxIdx)
|
word32 maxIdx)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
@ -6058,39 +6059,9 @@ int CompareOcspReqResp(OcspRequest* req, OcspResponse* resp)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CRL
|
|
||||||
|
|
||||||
/* initialize decoded CRL */
|
|
||||||
void InitDecodedCRL(DecodedCRL* dcrl)
|
|
||||||
{
|
|
||||||
CYASSL_MSG("InitDecodedCRL");
|
|
||||||
|
|
||||||
dcrl->certBegin = 0;
|
|
||||||
dcrl->sigIndex = 0;
|
|
||||||
dcrl->sigLength = 0;
|
|
||||||
dcrl->signatureOID = 0;
|
|
||||||
dcrl->certs = NULL;
|
|
||||||
dcrl->totalCerts = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* free decoded CRL resources */
|
|
||||||
void FreeDecodedCRL(DecodedCRL* dcrl)
|
|
||||||
{
|
|
||||||
RevokedCert* tmp = dcrl->certs;
|
|
||||||
|
|
||||||
CYASSL_MSG("FreeDecodedCRL");
|
|
||||||
|
|
||||||
while(tmp) {
|
|
||||||
RevokedCert* next = tmp->next;
|
|
||||||
XFREE(tmp, NULL, DYNAMIC_TYPE_REVOKED);
|
|
||||||
tmp = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* store SHA1 hash of NAME */
|
/* store SHA1 hash of NAME */
|
||||||
static int GetNameHash(const byte* source, word32* idx, byte* hash, int maxIdx)
|
CYASSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
||||||
|
int maxIdx)
|
||||||
{
|
{
|
||||||
Sha sha;
|
Sha sha;
|
||||||
int length; /* length of all distinguished names */
|
int length; /* length of all distinguished names */
|
||||||
@ -6125,6 +6096,37 @@ static int GetNameHash(const byte* source, word32* idx, byte* hash, int maxIdx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CRL
|
||||||
|
|
||||||
|
/* initialize decoded CRL */
|
||||||
|
void InitDecodedCRL(DecodedCRL* dcrl)
|
||||||
|
{
|
||||||
|
CYASSL_MSG("InitDecodedCRL");
|
||||||
|
|
||||||
|
dcrl->certBegin = 0;
|
||||||
|
dcrl->sigIndex = 0;
|
||||||
|
dcrl->sigLength = 0;
|
||||||
|
dcrl->signatureOID = 0;
|
||||||
|
dcrl->certs = NULL;
|
||||||
|
dcrl->totalCerts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* free decoded CRL resources */
|
||||||
|
void FreeDecodedCRL(DecodedCRL* dcrl)
|
||||||
|
{
|
||||||
|
RevokedCert* tmp = dcrl->certs;
|
||||||
|
|
||||||
|
CYASSL_MSG("FreeDecodedCRL");
|
||||||
|
|
||||||
|
while(tmp) {
|
||||||
|
RevokedCert* next = tmp->next;
|
||||||
|
XFREE(tmp, NULL, DYNAMIC_TYPE_REVOKED);
|
||||||
|
tmp = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get Revoked Cert list, 0 on success */
|
/* Get Revoked Cert list, 0 on success */
|
||||||
static int GetRevoked(const byte* buff, word32* idx, DecodedCRL* dcrl,
|
static int GetRevoked(const byte* buff, word32* idx, DecodedCRL* dcrl,
|
||||||
int maxIdx)
|
int maxIdx)
|
||||||
|
@ -445,6 +445,16 @@ CYASSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
|
|||||||
/* ASN.1 helper functions */
|
/* ASN.1 helper functions */
|
||||||
CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
|
CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
|
||||||
word32 maxIdx);
|
word32 maxIdx);
|
||||||
|
CYASSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len,
|
||||||
|
word32 maxIdx);
|
||||||
|
CYASSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
|
||||||
|
word32 maxIdx);
|
||||||
|
CYASSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx,
|
||||||
|
int* version);
|
||||||
|
CYASSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
|
||||||
|
word32 maxIdx);
|
||||||
|
CYASSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
||||||
|
word32 maxIdx);
|
||||||
CYASSL_LOCAL word32 SetLength(word32 length, byte* output);
|
CYASSL_LOCAL word32 SetLength(word32 length, byte* output);
|
||||||
CYASSL_LOCAL word32 SetSequence(word32 len, byte* output);
|
CYASSL_LOCAL word32 SetSequence(word32 len, byte* output);
|
||||||
CYASSL_LOCAL word32 SetOctetString(word32 len, byte* output);
|
CYASSL_LOCAL word32 SetOctetString(word32 len, byte* output);
|
||||||
@ -452,6 +462,8 @@ CYASSL_LOCAL word32 SetSet(word32 len, byte* output);
|
|||||||
CYASSL_LOCAL word32 SetAlgoID(int algoOID, byte* output, int type, int curveSz);
|
CYASSL_LOCAL word32 SetAlgoID(int algoOID, byte* output, int type, int curveSz);
|
||||||
CYASSL_LOCAL int SetMyVersion(word32 version, byte* output, int header);
|
CYASSL_LOCAL int SetMyVersion(word32 version, byte* output, int header);
|
||||||
CYASSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output);
|
CYASSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output);
|
||||||
|
CYASSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
||||||
|
int maxIdx);
|
||||||
|
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
/* ASN sig helpers */
|
/* ASN sig helpers */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user