crypto.c (37acd687269f8cb8366598e292f96eb5605d3e3a) | crypto.c (231baecdef7a906579925ccf1bd45aa734f32320) |
---|---|
1/** 2 * eCryptfs: Linux filesystem encryption layer 3 * 4 * Copyright (C) 1997-2004 Erez Zadok 5 * Copyright (C) 2001-2004 Stony Brook University 6 * Copyright (C) 2004-2007 International Business Machines Corp. 7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> 8 * Michael C. Thompson <mcthomps@us.ibm.com> --- 596 unchanged lines hidden (view full) --- 605 if (IS_ERR(crypt_stat->tfm)) { 606 rc = PTR_ERR(crypt_stat->tfm); 607 crypt_stat->tfm = NULL; 608 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " 609 "Error initializing cipher [%s]\n", 610 full_alg_name); 611 goto out_free; 612 } | 1/** 2 * eCryptfs: Linux filesystem encryption layer 3 * 4 * Copyright (C) 1997-2004 Erez Zadok 5 * Copyright (C) 2001-2004 Stony Brook University 6 * Copyright (C) 2004-2007 International Business Machines Corp. 7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> 8 * Michael C. Thompson <mcthomps@us.ibm.com> --- 596 unchanged lines hidden (view full) --- 605 if (IS_ERR(crypt_stat->tfm)) { 606 rc = PTR_ERR(crypt_stat->tfm); 607 crypt_stat->tfm = NULL; 608 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " 609 "Error initializing cipher [%s]\n", 610 full_alg_name); 611 goto out_free; 612 } |
613 crypto_skcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); | 613 crypto_skcipher_set_flags(crypt_stat->tfm, 614 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); |
614 rc = 0; 615out_free: 616 kfree(full_alg_name); 617out_unlock: 618 mutex_unlock(&crypt_stat->cs_tfm_mutex); 619 return rc; 620} 621 --- 963 unchanged lines hidden (view full) --- 1585 goto out; 1586 *key_tfm = crypto_alloc_skcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); 1587 if (IS_ERR(*key_tfm)) { 1588 rc = PTR_ERR(*key_tfm); 1589 printk(KERN_ERR "Unable to allocate crypto cipher with name " 1590 "[%s]; rc = [%d]\n", full_alg_name, rc); 1591 goto out; 1592 } | 615 rc = 0; 616out_free: 617 kfree(full_alg_name); 618out_unlock: 619 mutex_unlock(&crypt_stat->cs_tfm_mutex); 620 return rc; 621} 622 --- 963 unchanged lines hidden (view full) --- 1586 goto out; 1587 *key_tfm = crypto_alloc_skcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); 1588 if (IS_ERR(*key_tfm)) { 1589 rc = PTR_ERR(*key_tfm); 1590 printk(KERN_ERR "Unable to allocate crypto cipher with name " 1591 "[%s]; rc = [%d]\n", full_alg_name, rc); 1592 goto out; 1593 } |
1593 crypto_skcipher_set_flags(*key_tfm, CRYPTO_TFM_REQ_WEAK_KEY); | 1594 crypto_skcipher_set_flags(*key_tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); |
1594 if (*key_size == 0) 1595 *key_size = crypto_skcipher_default_keysize(*key_tfm); 1596 get_random_bytes(dummy_key, *key_size); 1597 rc = crypto_skcipher_setkey(*key_tfm, dummy_key, *key_size); 1598 if (rc) { 1599 printk(KERN_ERR "Error attempting to set key of size [%zd] for " 1600 "cipher [%s]; rc = [%d]\n", *key_size, full_alg_name, 1601 rc); --- 531 unchanged lines hidden --- | 1595 if (*key_size == 0) 1596 *key_size = crypto_skcipher_default_keysize(*key_tfm); 1597 get_random_bytes(dummy_key, *key_size); 1598 rc = crypto_skcipher_setkey(*key_tfm, dummy_key, *key_size); 1599 if (rc) { 1600 printk(KERN_ERR "Error attempting to set key of size [%zd] for " 1601 "cipher [%s]; rc = [%d]\n", *key_size, full_alg_name, 1602 rc); --- 531 unchanged lines hidden --- |