coverity fix 279922 , div by zero

This commit is contained in:
iceman1001 2020-04-28 14:51:47 +02:00
commit 7303dd8c5d

View file

@ -281,6 +281,10 @@ void cmac_generate_subkeys(desfirekey_t key) {
void cmac(const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size_t len, uint8_t *cmac) { void cmac(const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size_t len, uint8_t *cmac) {
int kbs = key_block_size(key); int kbs = key_block_size(key);
if (kbs == 0) {
return;
}
uint8_t *buffer = malloc(padded_data_length(len, kbs)); uint8_t *buffer = malloc(padded_data_length(len, kbs));
memcpy(buffer, data, len); memcpy(buffer, data, len);