All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-02-24 16:03 ` Maciej S. Szmigiero
  0 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-02-24 16:03 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: David Howells, Tom Lendacky, Gary Hook, keyrings, linux-crypto,
	linux-kernel

rsa-pkcs1pad uses a value returned from a RSA implementation max_size
callback as a size of an input buffer passed to the RSA implementation for
encrypt and sign operations.

CCP RSA implementation uses a hardware input buffer which size depends only
on the current RSA key length, so it should return this key length in
the max_size callback, too.
This also matches what the kernel software RSA implementation does.

Previously, the value returned from this callback was always the maximum
RSA key size the CCP hardware supports.
This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
tried to copy this large input buffer into a RSA key length-sized hardware
input buffer.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
Cc: stable@vger.kernel.org
---
 drivers/crypto/ccp/ccp-crypto-rsa.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c
index e6db8672d89c..05850dfd7940 100644
--- a/drivers/crypto/ccp/ccp-crypto-rsa.c
+++ b/drivers/crypto/ccp/ccp-crypto-rsa.c
@@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret)
 
 static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm)
 {
-	if (ccp_version() > CCP_VERSION(3, 0))
-		return CCP5_RSA_MAXMOD;
-	else
-		return CCP_RSA_MAXMOD;
+	struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm);
+
+	return ctx->u.rsa.n_len;
 }
 
 static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-02-24 16:03 ` Maciej S. Szmigiero
  0 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-02-24 16:03 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: David Howells, Tom Lendacky, Gary Hook, keyrings, linux-crypto,
	linux-kernel

rsa-pkcs1pad uses a value returned from a RSA implementation max_size
callback as a size of an input buffer passed to the RSA implementation for
encrypt and sign operations.

CCP RSA implementation uses a hardware input buffer which size depends only
on the current RSA key length, so it should return this key length in
the max_size callback, too.
This also matches what the kernel software RSA implementation does.

Previously, the value returned from this callback was always the maximum
RSA key size the CCP hardware supports.
This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
tried to copy this large input buffer into a RSA key length-sized hardware
input buffer.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
Cc: stable@vger.kernel.org
---
 drivers/crypto/ccp/ccp-crypto-rsa.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c
index e6db8672d89c..05850dfd7940 100644
--- a/drivers/crypto/ccp/ccp-crypto-rsa.c
+++ b/drivers/crypto/ccp/ccp-crypto-rsa.c
@@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret)
 
 static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm)
 {
-	if (ccp_version() > CCP_VERSION(3, 0))
-		return CCP5_RSA_MAXMOD;
-	else
-		return CCP_RSA_MAXMOD;
+	struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm);
+
+	return ctx->u.rsa.n_len;
 }
 
 static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-02-24 16:03 ` Maciej S. Szmigiero
@ 2018-03-01  0:34   ` Gary R Hook
  -1 siblings, 0 replies; 16+ messages in thread
From: Gary R Hook @ 2018-03-01  0:34 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Herbert Xu, David S. Miller
  Cc: David Howells, Tom Lendacky, keyrings, linux-crypto, linux-kernel

On 02/24/2018 10:03 AM, Maciej S. Szmigiero wrote:
> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
> callback as a size of an input buffer passed to the RSA implementation for
> encrypt and sign operations.
> 
> CCP RSA implementation uses a hardware input buffer which size depends only
> on the current RSA key length, so it should return this key length in
> the max_size callback, too.
> This also matches what the kernel software RSA implementation does.
> 
> Previously, the value returned from this callback was always the maximum
> RSA key size the CCP hardware supports.
> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
> tried to copy this large input buffer into a RSA key length-sized hardware
> input buffer.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>

Acked-by: Gary R Hook <gary.hook@amd.com>

> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
> Cc: stable@vger.kernel.org
> ---
>   drivers/crypto/ccp/ccp-crypto-rsa.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c
> index e6db8672d89c..05850dfd7940 100644
> --- a/drivers/crypto/ccp/ccp-crypto-rsa.c
> +++ b/drivers/crypto/ccp/ccp-crypto-rsa.c
> @@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret)
>   
>   static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm)
>   {
> -	if (ccp_version() > CCP_VERSION(3, 0))
> -		return CCP5_RSA_MAXMOD;
> -	else
> -		return CCP_RSA_MAXMOD;
> +	struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm);
> +
> +	return ctx->u.rsa.n_len;
>   }
>   
>   static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt)
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-01  0:34   ` Gary R Hook
  0 siblings, 0 replies; 16+ messages in thread
From: Gary R Hook @ 2018-03-01  0:34 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Herbert Xu, David S. Miller
  Cc: David Howells, Tom Lendacky, keyrings, linux-crypto, linux-kernel

On 02/24/2018 10:03 AM, Maciej S. Szmigiero wrote:
> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
> callback as a size of an input buffer passed to the RSA implementation for
> encrypt and sign operations.
> 
> CCP RSA implementation uses a hardware input buffer which size depends only
> on the current RSA key length, so it should return this key length in
> the max_size callback, too.
> This also matches what the kernel software RSA implementation does.
> 
> Previously, the value returned from this callback was always the maximum
> RSA key size the CCP hardware supports.
> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
> tried to copy this large input buffer into a RSA key length-sized hardware
> input buffer.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>

Acked-by: Gary R Hook <gary.hook@amd.com>

> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
> Cc: stable@vger.kernel.org
> ---
>   drivers/crypto/ccp/ccp-crypto-rsa.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c
> index e6db8672d89c..05850dfd7940 100644
> --- a/drivers/crypto/ccp/ccp-crypto-rsa.c
> +++ b/drivers/crypto/ccp/ccp-crypto-rsa.c
> @@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret)
>   
>   static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm)
>   {
> -	if (ccp_version() > CCP_VERSION(3, 0))
> -		return CCP5_RSA_MAXMOD;
> -	else
> -		return CCP_RSA_MAXMOD;
> +	struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm);
> +
> +	return ctx->u.rsa.n_len;
>   }
>   
>   static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt)
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-02-24 16:03 ` Maciej S. Szmigiero
@ 2018-03-02 16:44   ` Herbert Xu
  -1 siblings, 0 replies; 16+ messages in thread
From: Herbert Xu @ 2018-03-02 16:44 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
> callback as a size of an input buffer passed to the RSA implementation for
> encrypt and sign operations.
> 
> CCP RSA implementation uses a hardware input buffer which size depends only
> on the current RSA key length, so it should return this key length in
> the max_size callback, too.
> This also matches what the kernel software RSA implementation does.
> 
> Previously, the value returned from this callback was always the maximum
> RSA key size the CCP hardware supports.
> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
> tried to copy this large input buffer into a RSA key length-sized hardware
> input buffer.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
> Cc: stable@vger.kernel.org

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-02 16:44   ` Herbert Xu
  0 siblings, 0 replies; 16+ messages in thread
From: Herbert Xu @ 2018-03-02 16:44 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
> callback as a size of an input buffer passed to the RSA implementation for
> encrypt and sign operations.
> 
> CCP RSA implementation uses a hardware input buffer which size depends only
> on the current RSA key length, so it should return this key length in
> the max_size callback, too.
> This also matches what the kernel software RSA implementation does.
> 
> Previously, the value returned from this callback was always the maximum
> RSA key size the CCP hardware supports.
> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
> tried to copy this large input buffer into a RSA key length-sized hardware
> input buffer.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
> Cc: stable@vger.kernel.org

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-03-02 16:44   ` Herbert Xu
@ 2018-03-02 23:15     ` Maciej S. Szmigiero
  -1 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-03-02 23:15 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On 02.03.2018 17:44, Herbert Xu wrote:
> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>> callback as a size of an input buffer passed to the RSA implementation for
>> encrypt and sign operations.
>>
>> CCP RSA implementation uses a hardware input buffer which size depends only
>> on the current RSA key length, so it should return this key length in
>> the max_size callback, too.
>> This also matches what the kernel software RSA implementation does.
>>
>> Previously, the value returned from this callback was always the maximum
>> RSA key size the CCP hardware supports.
>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>> tried to copy this large input buffer into a RSA key length-sized hardware
>> input buffer.
>>
>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>> Cc: stable@vger.kernel.org
> 
> Patch applied.  Thanks.

Thanks.

However, what about the first patch from this series?
Without it, while it no longer should cause a buffer overflow, in-kernel
X.509 certificate verification will still fail with CCP driver loaded
(since CCP RSA implementation has a higher priority than the software
RSA implementation).

Maciej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-02 23:15     ` Maciej S. Szmigiero
  0 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-03-02 23:15 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On 02.03.2018 17:44, Herbert Xu wrote:
> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>> callback as a size of an input buffer passed to the RSA implementation for
>> encrypt and sign operations.
>>
>> CCP RSA implementation uses a hardware input buffer which size depends only
>> on the current RSA key length, so it should return this key length in
>> the max_size callback, too.
>> This also matches what the kernel software RSA implementation does.
>>
>> Previously, the value returned from this callback was always the maximum
>> RSA key size the CCP hardware supports.
>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>> tried to copy this large input buffer into a RSA key length-sized hardware
>> input buffer.
>>
>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>> Cc: stable@vger.kernel.org
> 
> Patch applied.  Thanks.

Thanks.

However, what about the first patch from this series?
Without it, while it no longer should cause a buffer overflow, in-kernel
X.509 certificate verification will still fail with CCP driver loaded
(since CCP RSA implementation has a higher priority than the software
RSA implementation).

Maciej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-03-02 23:15     ` Maciej S. Szmigiero
@ 2018-03-02 23:49       ` Hook, Gary
  -1 siblings, 0 replies; 16+ messages in thread
From: Hook, Gary @ 2018-03-02 23:49 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Herbert Xu
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
> On 02.03.2018 17:44, Herbert Xu wrote:
>> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>>> callback as a size of an input buffer passed to the RSA implementation for
>>> encrypt and sign operations.
>>>
>>> CCP RSA implementation uses a hardware input buffer which size depends only
>>> on the current RSA key length, so it should return this key length in
>>> the max_size callback, too.
>>> This also matches what the kernel software RSA implementation does.
>>>
>>> Previously, the value returned from this callback was always the maximum
>>> RSA key size the CCP hardware supports.
>>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>>> tried to copy this large input buffer into a RSA key length-sized hardware
>>> input buffer.
>>>
>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>>> Cc: stable@vger.kernel.org
>>
>> Patch applied.  Thanks.
> 
> Thanks.
> 
> However, what about the first patch from this series?
> Without it, while it no longer should cause a buffer overflow, in-kernel
> X.509 certificate verification will still fail with CCP driver loaded
> (since CCP RSA implementation has a higher priority than the software
> RSA implementation).
> 
> Maciej
> 


I commented on that one here:
https://marc.info/?l=linux-crypto-vger&m=151986452422791&w=2

Effectively a NACK. We are a reviewing a proposed patch right now.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-02 23:49       ` Hook, Gary
  0 siblings, 0 replies; 16+ messages in thread
From: Hook, Gary @ 2018-03-02 23:49 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Herbert Xu
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
> On 02.03.2018 17:44, Herbert Xu wrote:
>> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>>> callback as a size of an input buffer passed to the RSA implementation for
>>> encrypt and sign operations.
>>>
>>> CCP RSA implementation uses a hardware input buffer which size depends only
>>> on the current RSA key length, so it should return this key length in
>>> the max_size callback, too.
>>> This also matches what the kernel software RSA implementation does.
>>>
>>> Previously, the value returned from this callback was always the maximum
>>> RSA key size the CCP hardware supports.
>>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>>> tried to copy this large input buffer into a RSA key length-sized hardware
>>> input buffer.
>>>
>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>>> Cc: stable@vger.kernel.org
>>
>> Patch applied.  Thanks.
> 
> Thanks.
> 
> However, what about the first patch from this series?
> Without it, while it no longer should cause a buffer overflow, in-kernel
> X.509 certificate verification will still fail with CCP driver loaded
> (since CCP RSA implementation has a higher priority than the software
> RSA implementation).
> 
> Maciej
> 


I commented on that one here:
https://marc.info/?l=linux-crypto-vger&m\x151986452422791&w=2

Effectively a NACK. We are a reviewing a proposed patch right now.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-03-02 23:49       ` Hook, Gary
@ 2018-03-02 23:58         ` Maciej S. Szmigiero
  -1 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-03-02 23:58 UTC (permalink / raw)
  To: Hook, Gary
  Cc: Herbert Xu, David S. Miller, David Howells, Tom Lendacky,
	Gary Hook, keyrings, linux-crypto, linux-kernel

On 03.03.2018 00:49, Hook, Gary wrote:
> On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
>> On 02.03.2018 17:44, Herbert Xu wrote:
>>> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>>>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>>>> callback as a size of an input buffer passed to the RSA implementation for
>>>> encrypt and sign operations.
>>>>
>>>> CCP RSA implementation uses a hardware input buffer which size depends only
>>>> on the current RSA key length, so it should return this key length in
>>>> the max_size callback, too.
>>>> This also matches what the kernel software RSA implementation does.
>>>>
>>>> Previously, the value returned from this callback was always the maximum
>>>> RSA key size the CCP hardware supports.
>>>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>>>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>>>> tried to copy this large input buffer into a RSA key length-sized hardware
>>>> input buffer.
>>>>
>>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>>>> Cc: stable@vger.kernel.org
>>>
>>> Patch applied.  Thanks.
>>
>> Thanks.
>>
>> However, what about the first patch from this series?
>> Without it, while it no longer should cause a buffer overflow, in-kernel
>> X.509 certificate verification will still fail with CCP driver loaded
>> (since CCP RSA implementation has a higher priority than the software
>> RSA implementation).
>>
>> Maciej
>>
> 
> 
> I commented on that one here:
> https://marc.info/?l=linux-crypto-vger&m=151986452422791&w=2
> 
> Effectively a NACK. We are a reviewing a proposed patch right now.

Your earlier comment referred to the third patch from this series.
My message above was about the first one.

Maciej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-02 23:58         ` Maciej S. Szmigiero
  0 siblings, 0 replies; 16+ messages in thread
From: Maciej S. Szmigiero @ 2018-03-02 23:58 UTC (permalink / raw)
  To: Hook, Gary
  Cc: Herbert Xu, David S. Miller, David Howells, Tom Lendacky,
	Gary Hook, keyrings, linux-crypto, linux-kernel

On 03.03.2018 00:49, Hook, Gary wrote:
> On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
>> On 02.03.2018 17:44, Herbert Xu wrote:
>>> On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote:
>>>> rsa-pkcs1pad uses a value returned from a RSA implementation max_size
>>>> callback as a size of an input buffer passed to the RSA implementation for
>>>> encrypt and sign operations.
>>>>
>>>> CCP RSA implementation uses a hardware input buffer which size depends only
>>>> on the current RSA key length, so it should return this key length in
>>>> the max_size callback, too.
>>>> This also matches what the kernel software RSA implementation does.
>>>>
>>>> Previously, the value returned from this callback was always the maximum
>>>> RSA key size the CCP hardware supports.
>>>> This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
>>>> for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
>>>> tried to copy this large input buffer into a RSA key length-sized hardware
>>>> input buffer.
>>>>
>>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>>> Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
>>>> Cc: stable@vger.kernel.org
>>>
>>> Patch applied.  Thanks.
>>
>> Thanks.
>>
>> However, what about the first patch from this series?
>> Without it, while it no longer should cause a buffer overflow, in-kernel
>> X.509 certificate verification will still fail with CCP driver loaded
>> (since CCP RSA implementation has a higher priority than the software
>> RSA implementation).
>>
>> Maciej
>>
> 
> 
> I commented on that one here:
> https://marc.info/?l=linux-crypto-vger&m\x151986452422791&w=2
> 
> Effectively a NACK. We are a reviewing a proposed patch right now.

Your earlier comment referred to the third patch from this series.
My message above was about the first one.

Maciej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-03-02 23:58         ` Maciej S. Szmigiero
@ 2018-03-03  0:16           ` Gary R Hook
  -1 siblings, 0 replies; 16+ messages in thread
From: Gary R Hook @ 2018-03-03  0:16 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Hook, Gary
  Cc: Herbert Xu, David S. Miller, David Howells, Tom Lendacky,
	keyrings, linux-crypto, linux-kernel

On 03/02/2018 05:58 PM, Maciej S. Szmigiero wrote:
> On 03.03.2018 00:49, Hook, Gary wrote:
>> On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
>>>
>>> Thanks.
>>>
>>> However, what about the first patch from this series?
>>> Without it, while it no longer should cause a buffer overflow, in-kernel
>>> X.509 certificate verification will still fail with CCP driver loaded
>>> (since CCP RSA implementation has a higher priority than the software
>>> RSA implementation).
>>>
>>> Maciej
>>>
>>
>>
>> I commented on that one here:
>> https://marc.info/?l=linux-crypto-vger&m=151986452422791&w=2
>>
>> Effectively a NACK. We are a reviewing a proposed patch right now.
> 
> Your earlier comment referred to the third patch from this series.
> My message above was about the first one.

Apologies; my mistake.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-03  0:16           ` Gary R Hook
  0 siblings, 0 replies; 16+ messages in thread
From: Gary R Hook @ 2018-03-03  0:16 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Hook, Gary
  Cc: Herbert Xu, David S. Miller, David Howells, Tom Lendacky,
	keyrings, linux-crypto, linux-kernel

On 03/02/2018 05:58 PM, Maciej S. Szmigiero wrote:
> On 03.03.2018 00:49, Hook, Gary wrote:
>> On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote:
>>>
>>> Thanks.
>>>
>>> However, what about the first patch from this series?
>>> Without it, while it no longer should cause a buffer overflow, in-kernel
>>> X.509 certificate verification will still fail with CCP driver loaded
>>> (since CCP RSA implementation has a higher priority than the software
>>> RSA implementation).
>>>
>>> Maciej
>>>
>>
>>
>> I commented on that one here:
>> https://marc.info/?l=linux-crypto-vger&m\x151986452422791&w=2
>>
>> Effectively a NACK. We are a reviewing a proposed patch right now.
> 
> Your earlier comment referred to the third patch from this series.
> My message above was about the first one.

Apologies; my mistake.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
  2018-03-02 23:15     ` Maciej S. Szmigiero
@ 2018-03-04 12:56       ` Herbert Xu
  -1 siblings, 0 replies; 16+ messages in thread
From: Herbert Xu @ 2018-03-04 12:56 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On Sat, Mar 03, 2018 at 12:15:20AM +0100, Maciej S. Szmigiero wrote:
>
> However, what about the first patch from this series?
> Without it, while it no longer should cause a buffer overflow, in-kernel
> X.509 certificate verification will still fail with CCP driver loaded
> (since CCP RSA implementation has a higher priority than the software
> RSA implementation).

That normally goes through the security tree.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback
@ 2018-03-04 12:56       ` Herbert Xu
  0 siblings, 0 replies; 16+ messages in thread
From: Herbert Xu @ 2018-03-04 12:56 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: David S. Miller, David Howells, Tom Lendacky, Gary Hook,
	keyrings, linux-crypto, linux-kernel

On Sat, Mar 03, 2018 at 12:15:20AM +0100, Maciej S. Szmigiero wrote:
>
> However, what about the first patch from this series?
> Without it, while it no longer should cause a buffer overflow, in-kernel
> X.509 certificate verification will still fail with CCP driver loaded
> (since CCP RSA implementation has a higher priority than the software
> RSA implementation).

That normally goes through the security tree.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-03-04 12:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24 16:03 [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback Maciej S. Szmigiero
2018-02-24 16:03 ` Maciej S. Szmigiero
2018-03-01  0:34 ` Gary R Hook
2018-03-01  0:34   ` Gary R Hook
2018-03-02 16:44 ` Herbert Xu
2018-03-02 16:44   ` Herbert Xu
2018-03-02 23:15   ` Maciej S. Szmigiero
2018-03-02 23:15     ` Maciej S. Szmigiero
2018-03-02 23:49     ` Hook, Gary
2018-03-02 23:49       ` Hook, Gary
2018-03-02 23:58       ` Maciej S. Szmigiero
2018-03-02 23:58         ` Maciej S. Szmigiero
2018-03-03  0:16         ` Gary R Hook
2018-03-03  0:16           ` Gary R Hook
2018-03-04 12:56     ` Herbert Xu
2018-03-04 12:56       ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.