aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 9c8776d0ada8..fb5ef16d6a12 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -1147,7 +1147,7 @@ static inline void ablkcipher_request_free(struct ablkcipher_request *req)
1147 * cipher operation completes. 1147 * cipher operation completes.
1148 * 1148 *
1149 * The callback function is registered with the ablkcipher_request handle and 1149 * The callback function is registered with the ablkcipher_request handle and
1150 * must comply with the following template: 1150 * must comply with the following template
1151 * 1151 *
1152 * void callback_function(struct crypto_async_request *req, int error) 1152 * void callback_function(struct crypto_async_request *req, int error)
1153 */ 1153 */
@@ -1174,7 +1174,7 @@ static inline void ablkcipher_request_set_callback(
1174 * 1174 *
1175 * For encryption, the source is treated as the plaintext and the 1175 * For encryption, the source is treated as the plaintext and the
1176 * destination is the ciphertext. For a decryption operation, the use is 1176 * destination is the ciphertext. For a decryption operation, the use is
1177 * reversed: the source is the ciphertext and the destination is the plaintext. 1177 * reversed - the source is the ciphertext and the destination is the plaintext.
1178 */ 1178 */
1179static inline void ablkcipher_request_set_crypt( 1179static inline void ablkcipher_request_set_crypt(
1180 struct ablkcipher_request *req, 1180 struct ablkcipher_request *req,
@@ -1412,6 +1412,9 @@ static inline int crypto_aead_encrypt(struct aead_request *req)
1412 */ 1412 */
1413static inline int crypto_aead_decrypt(struct aead_request *req) 1413static inline int crypto_aead_decrypt(struct aead_request *req)
1414{ 1414{
1415 if (req->cryptlen < crypto_aead_authsize(crypto_aead_reqtfm(req)))
1416 return -EINVAL;
1417
1415 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req); 1418 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
1416} 1419}
1417 1420
@@ -1506,7 +1509,7 @@ static inline void aead_request_free(struct aead_request *req)
1506 * completes 1509 * completes
1507 * 1510 *
1508 * The callback function is registered with the aead_request handle and 1511 * The callback function is registered with the aead_request handle and
1509 * must comply with the following template: 1512 * must comply with the following template
1510 * 1513 *
1511 * void callback_function(struct crypto_async_request *req, int error) 1514 * void callback_function(struct crypto_async_request *req, int error)
1512 */ 1515 */
@@ -1533,7 +1536,7 @@ static inline void aead_request_set_callback(struct aead_request *req,
1533 * 1536 *
1534 * For encryption, the source is treated as the plaintext and the 1537 * For encryption, the source is treated as the plaintext and the
1535 * destination is the ciphertext. For a decryption operation, the use is 1538 * destination is the ciphertext. For a decryption operation, the use is
1536 * reversed: the source is the ciphertext and the destination is the plaintext. 1539 * reversed - the source is the ciphertext and the destination is the plaintext.
1537 * 1540 *
1538 * IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption, 1541 * IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption,
1539 * the caller must concatenate the ciphertext followed by the 1542 * the caller must concatenate the ciphertext followed by the