Re: [PATCH v2] DRBG: fix maximum value checks on 32 bit systems

From: Herbert Xu
Date: Tue Aug 26 2014 - 04:44:00 EST

On Tue, Aug 26, 2014 at 10:29:45AM +0200, Stephan Mueller wrote:
> The maximum values for additional input string or generated blocks is
> larger than 1<<32. To ensure a sensible value on 32 bit systems, return
> SIZE_MAX on 32 bit systems. This value is lower than the maximum
> allowed values defined in SP800-90A. The standard allow lower maximum
> values, but not larger values.
> SIZE_MAX - 1 is used for drbg_max_addtl to allow
> drbg_healthcheck_sanity to check the enforcement of the variable
> without wrapping.

This is really ugly but OK. However, I'm not sure how the sanity
check ever worked. It would appear that the drbg_generate call in
drbg_healthcheck_sanity should always fail because you explicitly
set addtl->len to drbg_max_addtl + 1, which should trigger the
"DRBG: additional information string too long" error, no?

Obviously it's working for you but I'd like to understand why
it's working and whether it'll continue to work.

Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page:
PGP Key:
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at