expose EncodeSignature() for DER-encoded comparisons

This commit is contained in:
Chris Conlon 2014-11-07 16:33:38 -07:00
parent a45a8f2cd8
commit 71da84122f
3 changed files with 37 additions and 3 deletions

View File

@ -2894,6 +2894,39 @@ word32 EncodeSignature(byte* out, const byte* digest, word32 digSz, int hashOID)
}
int GetCTC_HashOID(int hashType)
{
switch (hashType) {
#ifdef CYASSL_MD2
case MD2:
return MD2h;
#endif
#ifndef NO_MD5
case MD5:
return MD5h;
#endif
#ifndef NO_SHA
case SHA:
return SHAh;
#endif
#ifndef NO_SHA256
case SHA256:
return SHA256h;
#endif
#ifdef CYASSL_SHA384
case SHA384:
return SHA384h;
#endif
#ifdef CYASSL_SHA512
case SHA512:
return SHA512h;
#endif
default:
return 0;
};
}
/* return true (1) or false (0) for Confirmation */
static int ConfirmSignature(const byte* buf, word32 bufSz,
const byte* key, word32 keySz, word32 keyOID,

View File

@ -499,9 +499,6 @@ CYASSL_TEST_API int ParseCert(DecodedCert*, int type, int verify, void* cm);
CYASSL_LOCAL int ParseCertRelative(DecodedCert*, int type, int verify,void* cm);
CYASSL_LOCAL int DecodeToKey(DecodedCert*, int verify);
CYASSL_LOCAL word32 EncodeSignature(byte* out, const byte* digest, word32 digSz,
int hashOID);
CYASSL_LOCAL Signer* MakeSigner(void*);
CYASSL_LOCAL void FreeSigner(Signer*, void*);
CYASSL_LOCAL void FreeSignerTable(Signer**, int, void*);

View File

@ -181,6 +181,10 @@ CYASSL_API int SetDatesBuffer(Cert*, const byte*, int);
CYASSL_API int EccKeyToDer(ecc_key*, byte* output, word32 inLen);
#endif
/* DER encode signature */
CYASSL_API word32 EncodeSignature(byte* out, const byte* digest, word32 digSz,
int hashOID);
CYASSL_API int GetCTC_HashOID(int hashType);
#ifdef __cplusplus
} /* extern "C" */