diff options
Diffstat (limited to 'include/crypto/aead.h')
-rw-r--r-- | include/crypto/aead.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/crypto/aead.h b/include/crypto/aead.h index 0edf949..2281408 100644 --- a/include/crypto/aead.h +++ b/include/crypto/aead.h @@ -1,11 +1,11 @@ /* * AEAD: Authenticated Encryption with Associated Data - * + * * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) + * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ @@ -39,12 +39,24 @@ static inline struct crypto_aead *aead_givcrypt_reqtfm( static inline int crypto_aead_givencrypt(struct aead_givcrypt_request *req) { struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); + +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return -EACCES; +#endif + return crt->givencrypt(req); }; static inline int crypto_aead_givdecrypt(struct aead_givcrypt_request *req) { struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); + +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return -EACCES; +#endif + return crt->givdecrypt(req); }; @@ -59,6 +71,11 @@ static inline struct aead_givcrypt_request *aead_givcrypt_alloc( { struct aead_givcrypt_request *req; +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return NULL; +#endif + req = kmalloc(sizeof(struct aead_givcrypt_request) + crypto_aead_reqsize(tfm), gfp); |