lkml.org 
[lkml]   [2014]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/6] SP800-90A Deterministic Random Bit Generator
From
Date
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";




\
 
 \ /
  Last update: 2014-04-11 20:41    [W:0.114 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site