Devicetree
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Harsh Jain <h.jain@amd.com>
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
	devicetree@vger.kernel.org, mounika.botcha@amd.com,
	sarat.chand.savitala@amd.com, mohan.dhanawade@amd.com,
	michal.simek@amd.com, smueller@chronox.de, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH V5 3/3] crypto: drbg: Export CTR DRBG DF functions
Date: Sun, 17 Aug 2025 19:40:24 +0800	[thread overview]
Message-ID: <aKG_qHTkmvQynXQ8@gondor.apana.org.au> (raw)
In-Reply-To: <20250817105349.1113807-4-h.jain@amd.com>

On Sun, Aug 17, 2025 at 04:23:49PM +0530, Harsh Jain wrote:
>
> diff --git a/crypto/df_sp80090a.c b/crypto/df_sp80090a.c
> new file mode 100644
> index 000000000000..bde5139ba163
> --- /dev/null
> +++ b/crypto/df_sp80090a.c
> @@ -0,0 +1,243 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/*
> + * NIST SP800-90A DRBG derivation function
> + *
> + * Copyright (C) 2014, Stephan Mueller <smueller@chronox.de>
> + */
> +
> +#include <crypto/df_sp80090a.h>
> +#include <crypto/drbg.h>

The header files are still missing.

> diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
> index af5ad51d3eef..4234f15d74be 100644
> --- a/include/crypto/drbg.h
> +++ b/include/crypto/drbg.h
> @@ -144,6 +144,24 @@ struct drbg_state {
>  	struct drbg_string test_data;
>  };
>  
> +/*
> + * Convert an integer into a byte representation of this integer.
> + * The byte representation is big-endian
> + *
> + * @val value to be converted
> + * @buf buffer holding the converted integer -- caller must ensure that
> + *      buffer size is at least 32 bit
> + */
> +static inline void drbg_cpu_to_be32(__u32 val, unsigned char *buf)
> +{
> +        struct s {
> +                __be32 conv;
> +        };
> +        struct s *conversion = (struct s *) buf;
> +
> +        conversion->conv = cpu_to_be32(val);
> +}
> +

Part of the problem is that this header file includes an insane
amount of stuff that it doesn't even need.  How about moving this
function into a new header file crypto/internal/drbg.h that includes
just the bare minimum?

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

  reply	other threads:[~2025-08-17 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-17 10:53 [PATCH V5 0/3] crypto: Add Versal TRNG driver Harsh Jain
2025-08-17 10:53 ` [PATCH V5 1/3] dt-bindings: crypto: Add node for True Random Number Generator Harsh Jain
2025-08-17 10:53 ` [PATCH V5 2/3] crypto: xilinx: Add TRNG driver for Versal Harsh Jain
2025-08-17 10:53 ` [PATCH V5 3/3] crypto: drbg: Export CTR DRBG DF functions Harsh Jain
2025-08-17 11:40   ` Herbert Xu [this message]
2025-08-17 11:55     ` Jain, Harsh (AECG-SSW)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKG_qHTkmvQynXQ8@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=h.jain@amd.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=mohan.dhanawade@amd.com \
    --cc=mounika.botcha@amd.com \
    --cc=robh@kernel.org \
    --cc=sarat.chand.savitala@amd.com \
    --cc=smueller@chronox.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox