aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/cipher.c8
-rw-r--r--crypto/ivgen-essiv.c1
2 files changed, 3 insertions, 6 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 9ecaff702b..5a9648942f 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -63,18 +63,14 @@ static bool mode_need_iv[QCRYPTO_CIPHER_MODE__MAX] = {
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg)
{
- if (alg >= G_N_ELEMENTS(alg_key_len)) {
- return 0;
- }
+ assert(alg < G_N_ELEMENTS(alg_key_len));
return alg_block_len[alg];
}
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg)
{
- if (alg >= G_N_ELEMENTS(alg_key_len)) {
- return 0;
- }
+ assert(alg < G_N_ELEMENTS(alg_key_len));
return alg_key_len[alg];
}
diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c
index 634de63338..cba20bde6c 100644
--- a/crypto/ivgen-essiv.c
+++ b/crypto/ivgen-essiv.c
@@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
&salt, &nhash,
errp) < 0) {
g_free(essiv);
+ g_free(salt);
return -1;
}