aes: handle buffers with Zero length (fixes SRTCP-bug with short packets)

This commit is contained in:
Alfred E. Heggestad 2016-01-13 09:23:54 +00:00
parent 76f9a43034
commit 338b84eb8f
2 changed files with 3 additions and 3 deletions

View file

@ -105,7 +105,7 @@ int aes_encr(struct aes *st, uint8_t *out, const uint8_t *in, size_t len)
CCCryptorStatus status;
size_t moved;
if (!st || !out || !in || !len)
if (!st || !out || !in)
return EINVAL;
status = CCCryptorUpdate(st->cryptor, in, len, out, len, &moved);

View file

@ -93,7 +93,7 @@ int aes_encr(struct aes *aes, uint8_t *out, const uint8_t *in, size_t len)
{
int c_len = (int)len;
if (!aes || !out || !in || !len)
if (!aes || !out || !in)
return EINVAL;
if (!EVP_EncryptUpdate(&aes->ctx, out, &c_len, in, (int)len)) {
@ -172,7 +172,7 @@ int aes_encr(struct aes *aes, uint8_t *out, const uint8_t *in, size_t len)
unsigned char ec[AES_BLOCK_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned int num = 0;
if (!aes || !out || !in || !len)
if (!aes || !out || !in)
return EINVAL;
AES_ctr128_encrypt(in, out, len, &aes->key, aes->iv, ec, &num);