xts.h (c13aca79ff3c4af5fd31a5b2743a90eba6e36a26) | xts.h (231baecdef7a906579925ccf1bd45aa734f32320) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _CRYPTO_XTS_H 3#define _CRYPTO_XTS_H 4 5#include <crypto/b128ops.h> 6#include <crypto/internal/skcipher.h> 7#include <linux/fips.h> 8 --- 33 unchanged lines hidden (view full) --- 42 * the length must be even. 43 */ 44 if (keylen % 2) { 45 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); 46 return -EINVAL; 47 } 48 49 /* ensure that the AES and tweak key are not identical */ | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _CRYPTO_XTS_H 3#define _CRYPTO_XTS_H 4 5#include <crypto/b128ops.h> 6#include <crypto/internal/skcipher.h> 7#include <linux/fips.h> 8 --- 33 unchanged lines hidden (view full) --- 42 * the length must be even. 43 */ 44 if (keylen % 2) { 45 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); 46 return -EINVAL; 47 } 48 49 /* ensure that the AES and tweak key are not identical */ |
50 if ((fips_enabled || crypto_skcipher_get_flags(tfm) & 51 CRYPTO_TFM_REQ_WEAK_KEY) && | 50 if ((fips_enabled || (crypto_skcipher_get_flags(tfm) & 51 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) && |
52 !crypto_memneq(key, key + (keylen / 2), keylen / 2)) { 53 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY); 54 return -EINVAL; 55 } 56 57 return 0; 58} 59 60#endif /* _CRYPTO_XTS_H */ | 52 !crypto_memneq(key, key + (keylen / 2), keylen / 2)) { 53 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY); 54 return -EINVAL; 55 } 56 57 return 0; 58} 59 60#endif /* _CRYPTO_XTS_H */ |