Re: [PATCH v4 1/6] SP800-90A Deterministic Random Bit Generator

From: Joe Perches
Date: Fri Apr 11 2014 - 14:20:38 EST


On Fri, 2014-04-11 at 20:07 +0200, Stephan Mueller wrote:
> Changes v4:
> * change return codes of generate functions to signed int to convey error
> codes and to match the kernel crypto API expecations on the generate
> function.
> * add BUG_ON throughout drbg_healthcheck_sanity() since any failure should
> should be caugth to prevent the DRBG from operating
> * change layout of debugging printk

It looks like const could be used a bit more often.

For instance:
perhaps uses of key could be changed to const unsigned char *key

> diff --git a/crypto/drbg.c b/crypto/drbg.c
[]
> +#ifdef CONFIG_CRYPTO_DRBG_CTR
> +static int drbg_kcapi_sym(struct drbg_state *drbg, unsigned char *key,
> + unsigned char *outval, struct drbg_string *in);
[]
> +/* BCC function for CTR DRBG as defined in 10.4.3 */
> +static int drbg_ctr_bcc(struct drbg_state *drbg,
> + unsigned char *out, unsigned char *key,
> + struct drbg_string *in)
[]
> +/* Derivation Function for CTR DRBG as defined in 10.4.2 */
> +static int drbg_ctr_df(struct drbg_state *drbg,
> + unsigned char *df_data, size_t bytes_to_return,
> + struct drbg_string *addtl)
> +{
[]
> + unsigned char *K = (unsigned char *)
> + "\x00\x01\x02\x03\x04\x05\x06\x07"
> + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
> + "\x10\x11\x12\x13\x14\x15\x16\x17"
> + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f";


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/