add missing pointer checks
This commit is contained in:
parent
53917750d8
commit
4efa27ead1
@ -25,6 +25,9 @@ int ccm_add_aad(ccm_state *ccm,
|
||||
unsigned long y;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(ccm != NULL);
|
||||
LTC_ARGCHK(adata != NULL);
|
||||
|
||||
if (ccm->aadlen < ccm->current_aadlen + adatalen) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ int ccm_add_nonce(ccm_state *ccm,
|
||||
unsigned long x, y, len;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(ccm != NULL);
|
||||
LTC_ARGCHK(nonce != NULL);
|
||||
|
||||
/* increase L to match the nonce len */
|
||||
ccm->noncelen = (noncelen > 13) ? 13 : noncelen;
|
||||
if ((15 - ccm->noncelen) > ccm->L) {
|
||||
|
@ -25,6 +25,8 @@ int ccm_done(ccm_state *ccm,
|
||||
unsigned long x, y;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(ccm != NULL);
|
||||
|
||||
/* Check all data have been processed */
|
||||
if (ccm->ptlen != ccm->current_ptlen) {
|
||||
return CRYPT_ERROR;
|
||||
|
@ -29,6 +29,7 @@ int ccm_init(ccm_state *ccm, int cipher,
|
||||
{
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(ccm != NULL);
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(taglen != 0);
|
||||
|
||||
|
@ -29,6 +29,8 @@ int ccm_process(ccm_state *ccm,
|
||||
unsigned char y, z, b;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(ccm != NULL);
|
||||
|
||||
/* Check aad has been correctly added */
|
||||
if (ccm->aadlen != ccm->current_aadlen) {
|
||||
return CRYPT_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user