crypto: DRBG - switch to HMAC SHA512 DRBG as default DRBG
Subsystems (2)
PATCH 1/1 crypto: DRBG - switch to HMAC SHA512 DRBG as default DRBG
The default DRBG is the one that has the highest priority. The priority is defined based on the order of the list drbg_cores[] where the highest priority is given to the last entry by drbg_fill_array.
With this patch the default DRBG is switched from HMAC SHA256 to HMAC SHA512 to support compliance with SP800-90B and SP800-90C (current draft).
The user of the crypto API is completely unaffected by the change.
--- crypto/drbg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
crypto/drbg.c +6 -6
@@ -176,18 +176,18 @@ static const struct drbg_core drbg_cores[] = { .blocklen_bytes = 48, .cra_name = "hmac_sha384", .backend_cra_name = "hmac(sha384)", - }, { - .flags = DRBG_HMAC | DRBG_STRENGTH256, - .statelen = 64, /* block length of cipher */ - .blocklen_bytes = 64, - .cra_name = "hmac_sha512", - .backend_cra_name = "hmac(sha512)", }, { .flags = DRBG_HMAC | DRBG_STRENGTH256, .statelen = 32, /* block length of cipher */ .blocklen_bytes = 32, .cra_name = "hmac_sha256", .backend_cra_name = "hmac(sha256)", + }, { + .flags = DRBG_HMAC | DRBG_STRENGTH256, + .statelen = 64, /* block length of cipher */ + .blocklen_bytes = 64, + .cra_name = "hmac_sha512", + .backend_cra_name = "hmac(sha512)", }, #endif /* CONFIG_CRYPTO_DRBG_HMAC */ };
Signature · 1 line
2.31.1
Quoted 41 lines · Stephan Müller
The default DRBG is the one that has the highest priority. The priority is defined based on the order of the list drbg_cores[] where the highest priority is given to the last entry by
drbg_fill_array.With this patch the default DRBG is switched from HMAC SHA256 to HMAC SHA512 to support compliance with SP800-90B and SP800-90C (current draft).
The user of the crypto API is completely unaffected by the change.
Signed-off-by Stephan Mueller <[email protected]>---
crypto/drbg.c | 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)crypto/drbg.c +0
-6@@ -176,18 +176,18 @@ static const struct drbg_core drbg_cores[] = { .blocklen_bytes = 48, .cra_name = "hmac_sha384", .backend_cra_name = "hmac(sha384)", - }, { - .flags =DRBG_HMAC |DRBG_STRENGTH256 , - .statelen = 64, /* block length of cipher */ - .blocklen_bytes = 64, - .cra_name = "hmac_sha512", - .backend_cra_name = "hmac(sha512)", }, { .flags = DRBG_HMAC | DRBG_STRENGTH256,.statelen = 32, /* block length of cipher */ .blocklen_bytes = 32,
.cra_name = "hmac_sha256", .backend_cra_name = "hmac(sha256)",crypto/drbg.c +6
-0+ }, { + .flags = DRBG_HMAC | DRBG_STRENGTH256, + .statelen = 64, /* block length of cipher */ + .blocklen_bytes = 64, + .cra_name = "hmac_sha512", + .backend_cra_name = "hmac(sha512)",
Quoted 3 lines
},
#endif /*CONFIG_CRYPTO_DRBG_HMAC*/
};
We'd like this to ease certification pains.
Signature · 3 lines
Simo Sorce RHEL Crypto Team Red Hat, Inc
Herbert Xu
maintainerQuoted 8 lines · Stephan Müller
The default DRBG is the one that has the highest priority. The priority is defined based on the order of the list drbg_cores[] where the highest priority is given to the last entry by
drbg_fill_array.With this patch the default DRBG is switched from HMAC SHA256 to HMAC SHA512 to support compliance with SP800-90B and SP800-90C (current draft).
Quoted 6 lines
The user of the crypto API is completely unaffected by the change.
Signed-off-by Stephan Mueller <[email protected]>--- crypto/drbg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Herbert Xu
maintainerQuoted 18 lines · Stephan Müller
crypto/drbg.c +0
-6@@ -176,18 +176,18 @@ static const struct drbg_core drbg_cores[] = { .blocklen_bytes = 48, .cra_name = "hmac_sha384", .backend_cra_name = "hmac(sha384)", - }, { - .flags = DRBG_HMAC | DRBG_STRENGTH256, - .statelen = 64, /* block length of cipher */ - .blocklen_bytes = 64, - .cra_name = "hmac_sha512", - .backend_cra_name = "hmac(sha512)", }, { .flags = DRBG_HMAC | DRBG_STRENGTH256, .statelen = 32, /* block length of cipher */
crypto/drbg.c static const struct drbg_core drbg_cores[] = { · line 191
Quoted 10 lines
crypto/drbg.c +6
-0.blocklen_bytes = 32, .cra_name = "hmac_sha256", .backend_cra_name = "hmac(sha256)", + }, { + .flags = DRBG_HMAC | DRBG_STRENGTH256, + .statelen = 64, /* block length of cipher */ + .blocklen_bytes = 64, + .cra_name = "hmac_sha512", + .backend_cra_name = "hmac(sha512)", },
Hi Stephan:
I just noticed that unlike hmac(sha256) drbg with hmac(sha512) doesn't have a self-test. Could you add one for it please?
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Am Donnerstag, dem 24.06.2021 um 22:30 +0800 schrieb Herbert Xu:
Quoted 32 lines · Stephan Müller
Quoted 20 lines
crypto/drbg.c +0
-6@@ -176,18 +176,18 @@ static const struct drbg_core drbg_cores[] = { .blocklen_bytes = 48, .cra_name = "hmac_sha384", .backend_cra_name = "hmac(sha384)", - }, { - .flags = DRBG_HMAC | DRBG_STRENGTH256, - .statelen = 64, /* block length of cipher */ - .blocklen_bytes = 64, - .cra_name = "hmac_sha512", - .backend_cra_name = "hmac(sha512)", }, { .flags = DRBG_HMAC | DRBG_STRENGTH256,.statelen = 32, /* block length of cipher */ .blocklen_bytes = 32,
.cra_name = "hmac_sha256",Quoted 8 lines
.backend_cra_name = "hmac(sha256)", + }, {
+ .flags =DRBG_HMAC|DRBG_STRENGTH256, + .statelen = 64, /* block length of cipher */ + .blocklen_bytes = 64,
+ .cra_name = "hmac_sha512",
+ .backend_cra_name = "hmac(sha512)", },Hi Stephan:
Quoted 2 lines
I just noticed that unlike hmac(sha256) drbg with hmac(sha512) doesn't have a self-test. Could you add one for it please?
Thank you very much for pointing this out. I will prepare one asap.
Thanks
Stephan
Quoted 2 lines
Thanks,
PATCH 1/1 crypto: DRBG - self test for HMAC(SHA-512)
In reply to Herbert XuConsidering that the HMAC(SHA-512) DRBG is the default DRBG now, a self test is to be provided.
The test vector is obtained from a successful NIST ACVP test run.
--- crypto/testmgr.c | 5 ++++- crypto/testmgr.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-)
crypto/testmgr.c +4 -1
@@ -4686,8 +4686,11 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_null, }, { .alg = "drbg_nopr_hmac_sha512", - .test = alg_test_null, + .test = alg_test_drbg, .fips_allowed = 1, + .suite = { + .drbg = __VECS(drbg_nopr_hmac_sha512_tv_template) + } }, { .alg = "drbg_nopr_sha1", .fips_allowed = 1,
crypto/testmgr.h +49 -0
55 lines not on this page · raw message
Signature · 1 line
2.31.1
A message that is not in the archive (sent off-list or not yet received): CAMusb+TVdPRtDCY88kREZgWNH8XtrJS4yLkK3UJFqhXgn36raw@mail.gmail.com
Re: [PATCH] crypto: DRBG - self test for HMAC(SHA-512)
Hello, Stephan, Herbert,
Thank you for posting this patch. I would like to confirm that it fixes the issue
in the RHEL8, i.e. RHEL8 kernel boots up in the FIPS mode with your patch.
Herbert, could you please consider adding this patch to your cryptodev-2.6.git?
Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer
Quoted 13 lines · Stephan Müller
Considering that the HMAC(SHA-512) DRBG is the default DRBG now, a self test is to be provided.
The test vector is obtained from a successful NIST ACVP test run.
Signed-off-by Stephan Mueller <[email protected]>--- crypto/testmgr.c | 5 ++++- crypto/testmgr.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-)...
Herbert Xu
maintainerRe: [PATCH] crypto: DRBG - self test for HMAC(SHA-512)
In reply to Stephan MüllerQuoted 10 lines · Stephan Müller
Considering that the HMAC(SHA-512) DRBG is the default DRBG now, a self test is to be provided.
The test vector is obtained from a successful NIST ACVP test run.
Signed-off-by Stephan Mueller <[email protected]>--- crypto/testmgr.c | 5 ++++- crypto/testmgr.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt