Commit fc305304 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Fix CPRNG test for Hash DRBG.

parent a96b90b6
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -199,9 +199,8 @@ static int hash_gen(DRBG_CTX *dctx, unsigned char *out, size_t outlen)
			{
			FIPS_digestfinal(&hctx->mctx, dctx->lb, NULL);
			dctx->lb_valid = 1;
			continue;
			}
		if (outlen < dctx->blocklength)
		else if (outlen < dctx->blocklength)
			{
			FIPS_digestfinal(&hctx->mctx, hctx->vtmp, NULL);
			if (!fips_drbg_cprng_test(dctx, hctx->vtmp))
@@ -209,6 +208,8 @@ static int hash_gen(DRBG_CTX *dctx, unsigned char *out, size_t outlen)
			memcpy(out, hctx->vtmp, outlen);
			return 1;
			}
		else
			{
			FIPS_digestfinal(&hctx->mctx, out, NULL);
			if (!fips_drbg_cprng_test(dctx, out))
				return 0;
@@ -216,6 +217,7 @@ static int hash_gen(DRBG_CTX *dctx, unsigned char *out, size_t outlen)
			if (outlen == 0)
				return 1;
			out += dctx->blocklength;
			}
		ctx_add_buf(dctx, hctx->vtmp, NULL, 0);
		}
	}