Re: [PATCH V5 3/3] crypto: drbg: Export CTR DRBG DF functions

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

 



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@xxxxxxxxxx>
> + */
> +
> +#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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




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