/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
*
* negative on error
* @retval #YACA_ERROR_NONE Successful
* @retval #YACA_ERROR_INVALID_PARAMETER Required parameters have incorrect values (NULL,
- * invalid @a algo, @a bcm or @a key_bit_len)
+ * invalid @a algo, @a bcm or @a key_bit_len not
+ * divisible by 8)
* @retval #YACA_ERROR_INTERNAL Internal error
*/
int yaca_encrypt_get_iv_bit_length(yaca_encrypt_algorithm_e algo, yaca_block_cipher_mode_e bcm, size_t key_bit_len, size_t *iv_bit_len);
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
*
* negative on error
* @retval #YACA_ERROR_NONE Successful
* @retval #YACA_ERROR_INVALID_PARAMETER @a key is NULL, incorrect @a key_type or
- * @a key_bit_len is not dividable by 8
+ * @a key_bit_len is not divisible by 8
* @retval #YACA_ERROR_OUT_OF_MEMORY Out of memory error
* @retval #YACA_ERROR_INTERNAL Internal error
* @see #yaca_key_type_e
* negative on error
* @retval #YACA_ERROR_NONE Successful
* @retval #YACA_ERROR_INVALID_PARAMETER Required parameters have incorrect values (NULL, 0,
- * invalid @a algo or @a key_bit_len not dividable by 8)
+ * invalid @a algo or @a key_bit_len not divisible by 8)
* @retval #YACA_ERROR_OUT_OF_MEMORY Out of memory error
* @retval #YACA_ERROR_INTERNAL Internal error
* @see #yaca_digest_algorithm_e
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
*
const EVP_CIPHER *cipher;
int ret;
- if (iv_bit_len == NULL)
+ if (iv_bit_len == NULL || key_bit_len % 8 != 0)
return YACA_ERROR_INVALID_PARAMETER;
ret = encrypt_get_algorithm(algo, bcm, key_bit_len, &cipher);