[PATCH] crypto: authencesn - Fix incorrect setauthsize function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes a mismatch between 'setauthsize' documentation and
actual behavior of 'crypto_authenc_esn_setauthsize()' function

As per the documentation in  'aead.h' for the '@setauthsize' attribute:

@setauthsize: Set authentication size for the AEAD transformation. This
function is used to specify the consumer requested size of the
authentication tag to be either generated by the transformation
during encryption or the size of the authentication tag to be
supplied during the decryption operation. This function is also
responsible for checking the authentication tag size for
validity.

However, the implementation does not align with this description.
The function only checked the validity of the input authsize without setting it.
Consequently, 'authsize' is used without being initialized,
resulting in an uninitialized memory read issue.

Signed-off-by: Ingyu Jang <ingyujang25@xxxxxxxxxxx>
---
 crypto/authencesn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index 91424e791d5c..c1346d5b7950 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -52,6 +52,8 @@ static int crypto_authenc_esn_setauthsize(struct crypto_aead *authenc_esn,
 	if (authsize > 0 && authsize < 4)
 		return -EINVAL;
 
+	authenc_esn->authsize = authsize;
+
 	return 0;
 }
 
-- 
2.34.1




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux