KEYS: Fix signature input size for KEYCTL_PKEY_VERIFY
Subsystems (2)
PATCH 1/1 KEYS: Fix signature input size for KEYCTL_PKEY_VERIFY
Revert the changes made for signature verification in cb481e59ea6c back to the old behavior where effectively the params->in2_len was set to the length of the user provided buffer uparams.in2_len (out_len is an alias for in2_len due to the union). We cannot use the max_sig_size in the case of signature verification since this is neither the true size of the input buffer nor would it pass tests of size indicators found in the ASN.1 in the buffer comparing against the input buffer size.
--- security/keys/keyctl_pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/keyctl_pkey.c +1 -1
@@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par uparams.in2_len > info.max_sig_size)return -EINVAL ; - params->out_len = info.max_sig_size; + params->in2_len = uparams.in2_len;break ;default :return -EOPNOTSUPP ;
Signature · 1 line
2.56.0
Quoted 32 lines · Stefan Berger
Revert the changes made for signature verification in
cb481e59ea6cback to the old behavior where effectively theparams->in2_lenwas set to the length of the user provided buffer uparams.in2_len (out_lenis an alias forin2_lendue to the union). We cannot use themax_sig_sizein the case of signature verification since this is neither the true size of the input buffer nor would it pass tests of size indicators found in the ASN.1 in the buffer comparing against the input buffer size.Fixes cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")Cc Jarkko Sakkinen <[email protected]>Cc Florian Bauckholt <[email protected]>Signed-off-by Stefan Berger <[email protected]>--- security/keys/keyctl_pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/keys/keyctl_pkey.c +1
-1@@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par uparams.in2_len > info.max_sig_size)return -EINVAL ; - params->out_len = info.max_sig_size; + params->in2_len = uparams.in2_len;break ;default :return -EOPNOTSUPP ;Signature · 1 line
2.56.0
Thanks.
Br, Jarkko
Jarkko Sakkinen
maintainerQuoted 25 lines · Jarkko Sakkinen
Quoted 24 lines · Stefan Berger
Revert the changes made for signature verification in
cb481e59ea6cback to the old behavior where effectively theparams->in2_lenwas set to the length of the user provided buffer uparams.in2_len (out_lenis an alias forin2_lendue to the union). We cannot use themax_sig_sizein the case of signature verification since this is neither the true size of the input buffer nor would it pass tests of size indicators found in the ASN.1 in the buffer comparing against the input buffer size.Fixes cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")Cc Jarkko Sakkinen <[email protected]>Cc Florian Bauckholt <[email protected]>Signed-off-by Stefan Berger <[email protected]>--- security/keys/keyctl_pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/keys/keyctl_pkey.c +0
-0@@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par uparams.in2_len > info.max_sig_size)return -EINVAL ;
Quoted 11 lines
Quoted 8 lines
security/keys/keyctl_pkey.c +1
-1- params->out_len = info.max_sig_size; + params->in2_len = uparams.in2_len;break ;default :return -EOPNOTSUPP ;Signature · 1 line
2.56.0Reviewed-by Jarkko Sakkinen <[email protected]>
Did we have reported-by and closes tags for this?
Br, Jarkko
Quoted 38 lines · Jarkko Sakkinen
Quoted 25 lines · Jarkko Sakkinen
Quoted 24 lines · Stefan Berger
Revert the changes made for signature verification in
cb481e59ea6cback to the old behavior where effectively theparams->in2_lenwas set to the length of the user provided buffer uparams.in2_len (out_lenis an alias forin2_lendue to the union). We cannot use themax_sig_sizein the case of signature verification since this is neither the true size of the input buffer nor would it pass tests of size indicators found in the ASN.1 in the buffer comparing against the input buffer size.Fixes cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")Cc Jarkko Sakkinen <[email protected]>Cc Florian Bauckholt <[email protected]>Signed-off-by Stefan Berger <[email protected]>--- security/keys/keyctl_pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/keys/keyctl_pkey.c +0
-0@@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par uparams.in2_len > info.max_sig_size)return -EINVAL ;Quoted 11 lines
Quoted 8 lines
security/keys/keyctl_pkey.c +1
-1- params->out_len = info.max_sig_size; + params->in2_len = uparams.in2_len;break ;default :return -EOPNOTSUPP ;Signature · 1 line
2.56.0Reviewed-by Jarkko Sakkinen <[email protected]>
Quoted 1 line
Did we have reported-by and closes tags for this?
Let me add this here for v2:
Once Florian added his Tested-by: to v1 should I then add this?
Quoted 2 lines
Br, Jarkko
Jarkko Sakkinen
maintainerQuoted 42 lines · Stefan Berger
Quoted 37 lines · Jarkko Sakkinen
Quoted 27 lines · Jarkko Sakkinen
Quoted 26 lines · Stefan Berger
Revert the changes made for signature verification in
cb481e59ea6cback to the old behavior where effectively theparams->in2_lenwas set to the length of the user provided buffer uparams.in2_len (out_lenis an alias forin2_lendue to the union). We cannot use themax_sig_sizein the case of signature verification since this is neither the true size of the input buffer nor would it pass tests of size indicators found in the ASN.1 in the buffer comparing against the input buffer size.Fixes cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")Cc Jarkko Sakkinen <[email protected]>Cc Florian Bauckholt <[email protected]>Signed-off-by Stefan Berger <[email protected]>--- security/keys/keyctl_pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/keys/keyctl_pkey.c +1
-1@@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par uparams.in2_len > info.max_sig_size)return -EINVAL ; - params->out_len = info.max_sig_size; + params->in2_len = uparams.in2_len;break ;Quoted 8 lines
Quoted 5 lines
security/keys/keyctl_pkey.c +0
-0default :return -EOPNOTSUPP ;Signature · 1 line
2.56.0Reviewed-by Jarkko Sakkinen <[email protected]>Quoted 1 line
Did we have reported-by and closes tags for this?
Quoted 8 lines
Let me add this here for v2:
Reported-by Sashiko <[email protected]>Once Florian added his Tested-by: to v1 should I then add this?
Nah, I don't care about Sashiko tags, no need to add em.
Go ahead and add Florian's tested-by.
Br, Jarkko