X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Ftcrypt%2Ftcrypt.c;h=920be02dd2decf313274b72cb5ac0a2056117c24;hb=0461d9e822a4470aa4eb1c9cfb3bf3d6e0f4b123;hp=594408a826ff93e4989489edf32b90591ec629f7;hpb=4f7262aa9680e57df60303146b12c4120783b98c;p=platform%2Fupstream%2Fcryptsetup.git diff --git a/lib/tcrypt/tcrypt.c b/lib/tcrypt/tcrypt.c index 594408a..920be02 100644 --- a/lib/tcrypt/tcrypt.c +++ b/lib/tcrypt/tcrypt.c @@ -344,6 +344,8 @@ static int decrypt_hdr_cbci(struct tcrypt_algs *ciphers, memcpy(iv, &key[ciphers->cipher[0].iv_offset], bs); /* Initialize all ciphers in chain in ECB mode */ + for (j = 0; j < ciphers->chain_count; j++) + cipher[j] = NULL; for (j = 0; j < ciphers->chain_count; j++) { r = crypt_cipher_init(&cipher[j], ciphers->cipher[j].name, "ecb", &key[ciphers->cipher[j].key_offset], @@ -377,7 +379,7 @@ static int decrypt_hdr(struct crypt_device *cd, struct tcrypt_phdr *hdr, const char *key, int legacy_modes) { struct tcrypt_phdr hdr2; - int i, j, r; + int i, j, r = -EINVAL; for (i = 0; tcrypt_cipher[i].chain_count; i++) { if (!legacy_modes && tcrypt_cipher[i].legacy)