mbox series

[v2,0/3] crypto: fix regression in hash result buffer handling

Message ID 20241016102006.480218-1-berrange@redhat.com
Headers show
Series crypto: fix regression in hash result buffer handling | expand

Message

Daniel P. Berrangé Oct. 16, 2024, 10:20 a.m. UTC
Daniel P. Berrangé (3):
  crypto/hash: avoid overwriting user supplied result pointer
  tests: correctly validate result buffer in hash/hmac tests
  include/crypto: clarify @result/@result_len for hash/hmac APIs

 crypto/hash-gcrypt.c          | 15 ++++++++++++---
 crypto/hash-glib.c            | 11 +++++++++--
 crypto/hash-gnutls.c          | 16 +++++++++++++---
 crypto/hash-nettle.c          | 14 +++++++++++---
 include/crypto/hash.h         | 30 +++++++++++++++++++++++-------
 include/crypto/hmac.h         | 17 ++++++++++++-----
 tests/unit/test-crypto-hash.c |  7 ++++---
 tests/unit/test-crypto-hmac.c |  6 ++++--
 8 files changed, 88 insertions(+), 28 deletions(-)

Comments

Dorjoy Chowdhury Oct. 16, 2024, 1:33 p.m. UTC | #1
On Wed, Oct 16, 2024 at 4:20 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
>
>
> Daniel P. Berrangé (3):
>   crypto/hash: avoid overwriting user supplied result pointer
>   tests: correctly validate result buffer in hash/hmac tests
>   include/crypto: clarify @result/@result_len for hash/hmac APIs
>
>  crypto/hash-gcrypt.c          | 15 ++++++++++++---
>  crypto/hash-glib.c            | 11 +++++++++--
>  crypto/hash-gnutls.c          | 16 +++++++++++++---
>  crypto/hash-nettle.c          | 14 +++++++++++---
>  include/crypto/hash.h         | 30 +++++++++++++++++++++++-------
>  include/crypto/hmac.h         | 17 ++++++++++++-----
>  tests/unit/test-crypto-hash.c |  7 ++++---
>  tests/unit/test-crypto-hmac.c |  6 ++++--
>  8 files changed, 88 insertions(+), 28 deletions(-)
>

Reviewed-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>


@Daniel the api documentation for "qcrypto_hash_bytesv" also needs to
be updated.

Regards,
Dorjoy
Daniel P. Berrangé Oct. 21, 2024, 4:15 p.m. UTC | #2
On Wed, Oct 16, 2024 at 07:33:56PM +0600, Dorjoy Chowdhury wrote:
> On Wed, Oct 16, 2024 at 4:20 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> >
> >
> > Daniel P. Berrangé (3):
> >   crypto/hash: avoid overwriting user supplied result pointer
> >   tests: correctly validate result buffer in hash/hmac tests
> >   include/crypto: clarify @result/@result_len for hash/hmac APIs
> >
> >  crypto/hash-gcrypt.c          | 15 ++++++++++++---
> >  crypto/hash-glib.c            | 11 +++++++++--
> >  crypto/hash-gnutls.c          | 16 +++++++++++++---
> >  crypto/hash-nettle.c          | 14 +++++++++++---
> >  include/crypto/hash.h         | 30 +++++++++++++++++++++++-------
> >  include/crypto/hmac.h         | 17 ++++++++++++-----
> >  tests/unit/test-crypto-hash.c |  7 ++++---
> >  tests/unit/test-crypto-hmac.c |  6 ++++--
> >  8 files changed, 88 insertions(+), 28 deletions(-)
> >
> 
> Reviewed-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
> 
> 
> @Daniel the api documentation for "qcrypto_hash_bytesv" also needs to
> be updated.

Opps, yes, I'll make exactly the same docs change for that too, and
the equiv hmac  API.

With regards,
Daniel