add worst case estimate to ecc_sign_size()

This commit is contained in:
toddouska
2013-10-30 13:33:23 -07:00
parent 3d19604bfb
commit 12b074fbe9
2 changed files with 4 additions and 3 deletions

View File

@@ -2099,14 +2099,15 @@ int ecc_size(ecc_key* key)
}
/* signature size in octets */
/* worst case estimate, check actual return from ecc_sign_hash for actual value
of signature size in octets */
int ecc_sig_size(ecc_key* key)
{
int sz = ecc_size(key);
if (sz < 0)
return sz;
return sz * 2 + SIG_HEADER_SZ;
return sz * 2 + SIG_HEADER_SZ + 4; /* (4) worst case estimate */
}

View File

@@ -8492,7 +8492,7 @@ static void PickHashSigAlgo(CYASSL* ssl,
ret = EccPrivateKeyDecode(ssl->buffers.key.buffer, &i,
&dsaKey, ssl->buffers.key.length);
if (ret != 0) return ret;
sigSz = ecc_sig_size(&dsaKey) + 4; /* worst case estimate */
sigSz = ecc_sig_size(&dsaKey); /* worst case estimate */
}
else {
#ifndef NO_RSA