Updated the naming for the new encoding DER signature enum and function.

pull/289/head
David Garske 2016-02-08 12:04:38 -08:00
parent d5f410523a
commit 09615c01cc
3 changed files with 7 additions and 7 deletions

View File

@ -7023,7 +7023,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
#ifdef WOLFSSL_SMALL_STACK
byte* encSig;
#else
byte encSig[MAX_ENCODED_HEADER_SZ];
byte encSig[MAX_DER_DIGEST_SZ];
#endif
(void)digest;
@ -7085,7 +7085,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
return ret;
#ifdef WOLFSSL_SMALL_STACK
encSig = (byte*)XMALLOC(MAX_ENCODED_HEADER_SZ,
encSig = (byte*)XMALLOC(MAX_DER_DIGEST_SZ,
NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (encSig == NULL)
return MEMORY_E;

View File

@ -47,7 +47,7 @@
#ifndef NO_SIG_WRAPPER
#if !defined(NO_RSA) && !defined(NO_ASN)
static int wc_SignatureAsnEncode(enum wc_HashType hash_type, byte** hash_data,
static int wc_SignatureDerEncode(enum wc_HashType hash_type, byte** hash_data,
word32* hash_len)
{
int ret = wc_HashGetOID(hash_type);
@ -55,7 +55,7 @@ static int wc_SignatureAsnEncode(enum wc_HashType hash_type, byte** hash_data,
int oid = ret;
/* Allocate buffer for hash and encoded ASN header */
word32 digest_len = *hash_len + MAX_ENCODED_HEADER_SZ;
word32 digest_len = *hash_len + MAX_DER_DIGEST_SZ;
byte *digest_buf = (byte*)XMALLOC(digest_len, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (digest_buf) {
ret = wc_EncodeSignature(digest_buf, *hash_data, *hash_len, oid);
@ -188,7 +188,7 @@ int wc_SignatureVerify(
ret = SIG_TYPE_E;
break;
#else
ret = wc_SignatureAsnEncode(hash_type, &hash_data, &hash_len);
ret = wc_SignatureDerEncode(hash_type, &hash_data, &hash_len);
/* Check for error */
if (ret < 0) {
break;
@ -305,7 +305,7 @@ int wc_SignatureGenerate(
ret = SIG_TYPE_E;
break;
#else
ret = wc_SignatureAsnEncode(hash_type, &hash_data, &hash_len);
ret = wc_SignatureDerEncode(hash_type, &hash_data, &hash_len);
/* Check for error */
if (ret < 0) {
break;

View File

@ -166,7 +166,7 @@ enum Misc_ASN {
MAX_RSA_E_SZ = 16, /* Max RSA public e size */
MAX_CA_SZ = 32, /* Max encoded CA basic constraint length */
MAX_SN_SZ = 35, /* Max encoded serial number (INT) length */
MAX_ENCODED_HEADER_SZ = MAX_ENCODED_DIG_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ, /* Maximum encoded signature header size */
MAX_DER_DIGEST_SZ = MAX_ENCODED_DIG_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ, /* Maximum DER digest size */
#ifdef WOLFSSL_CERT_GEN
#ifdef WOLFSSL_CERT_REQ
/* Max encoded cert req attributes length */