crypto: testmgr - block Crypto API xxhash64 in FIPS mode
Subsystems (3)
PATCH 1/1 crypto: testmgr - block Crypto API xxhash64 in FIPS mode
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit fe11ac191ce0 ("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.
--- crypto/testmgr.c | 1 - 1 file changed, 1 deletion(-)
crypto/testmgr.c +0 -1
@@ -5609,7 +5609,6 @@ static const struct alg_test_desc alg_test_descs[] = {#endif .alg = "xxhash64", .test = alg_test_hash, - .fips_allowed = 1, .suite = { .hash =__VECS (xxhash64_tv_template) }
Signature · 1 line
2.53.0
Quoted 11 lines · Joachim Vandersmissen
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.
It sounds like xxhash should be removed the crypto API entirely. There's no user of it, it's not crypto, and doing xxhash through the userspace crypto API socket is so stupid that I doubt anyone attempted it.
[+Cc [email protected]]
Quoted 13 lines · Christoph Hellwig
Quoted 11 lines · Joachim Vandersmissen
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.
Quoted 4 lines
It sounds like xxhash should be removed the crypto API entirely. There's no user of it, it's not crypto, and doing xxhash through the userspace crypto API socket is so stupid that I doubt anyone attempted it.
dm-integrity, which uses crypto_shash and accepts arbitrary hash algorithm strings from userspace, might be relying on "xxhash64" being supported in crypto_shash. The integritysetup man page specifically mentions xxhash64:
--integrity, -I algorithm
Use internal integrity calculation (standalone mode). The integrity algorithm can be CRC (crc32c/crc32), a non-cryptographic hash function (xxhash64) or a hash function (sha1, sha256).
For HMAC (hmac-sha256), you must specify an integrity key and its size.
Maybe the device-mapper maintainers have some insight into whether anyone is actually using xxhash64 with dm-integrity.
If yes, then dm-integrity could still switch to using the library API for it. dm-integrity would just need to gain some helper functions that call either the xxhash64 library or crypto_shash depending on the configured algorithm. If the full set of algorithms being used can be determined, then dm-integrity could even switch to the library APIs entirely, like many other kernel subsystems such as btrfs have.
- Eric
Quoted 3 lines · Eric Biggers
Maybe the device-mapper maintainers have some insight into whether anyone is actually using xxhash64 with dm-integrity.
Someone requested to mention it in integritysetup man page
https://gitlab.com/cryptsetup/cryptsetup/-/issues/632
I think there were more reports people are using it in some specific cases.
Milan
Quoted 9 lines · Eric Biggers
Quoted 4 lines
It sounds like xxhash should be removed the crypto API entirely. There's no user of it, it's not crypto, and doing xxhash through the userspace crypto API socket is so stupid that I doubt anyone attempted it.
dm-integrity, which uses
crypto_shashand accepts arbitrary hash algorithm strings from userspace, might be relying on "xxhash64" being supported incrypto_shash. The integritysetup man page specifically mentions xxhash64:
Oh, ok. So at least for now we need it, although it would be nice to convert dm-integrity to lib/crypto/ and limit it to the advertised algorithms (including xxhash).
Thanks for the discussion below, it sounds like I need to ensure dm-integrity can use lib/crypto (at least for xxhash64) before blocking it in the crypto API.
Quoted 14 lines · Christoph Hellwig
Quoted 8 lines · Eric Biggers
Quoted 4 lines
It sounds like xxhash should be removed the crypto API entirely. There's no user of it, it's not crypto, and doing xxhash through the userspace crypto API socket is so stupid that I doubt anyone attempted it.
dm-integrity, which uses
crypto_shashand accepts arbitrary hash algorithm strings from userspace, might be relying on "xxhash64" being supported incrypto_shash. The integritysetup man page specifically mentions xxhash64:Oh, ok. So at least for now we need it, although it would be nice to convert dm-integrity to
lib/crypto/and limit it to the advertised algorithms (including xxhash).
Herbert Xu
maintainerQuoted 12 lines · Joachim Vandersmissen
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.
Quoted 4 lines
Signed-off-by Joachim Vandersmissen <[email protected]>--- crypto/testmgr.c | 1 - 1 file changed, 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
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Kind regards,
Joachim
Quoted 18 lines · Herbert Xu
Quoted 12 lines · Joachim Vandersmissen
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.Quoted 4 lines
Signed-off-by Joachim Vandersmissen <[email protected]>--- crypto/testmgr.c | 1 - 1 file changed, 1 deletion(-)Patch applied. Thanks.
Herbert Xu
maintainerQuoted 5 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
OK I've removed the patch.
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
Quoted 3 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
Thomas
Quoted 21 lines · Herbert Xu
Quoted 18 lines · Joachim Vandersmissen
Quoted 12 lines
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.Quoted 4 lines
Signed-off-by Joachim Vandersmissen <[email protected]>---
crypto/testmgr.c| 1 -1 file changed, 1 deletion(-)Patch applied. Thanks.
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 3 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
There is a risk that users may not know that xxhash64 is not FIPS compliant and would still use it. Especially considering it was marked as "fips_allowed = 1" for a while.
Distributions that actually need FIPS validation will probably apply this patch anyway and deal with the breakage if it happens.
Quoted 25 lines
Thomas
Quoted 21 lines · Herbert Xu
Quoted 18 lines · Joachim Vandersmissen
Quoted 12 lines
xxhash64 is not a cryptographic hash algorithm, but is offered in the same API (shash) as actual cryptographic hash algorithms such as SHA-256. The Cryptographic Module Validation Program (CMVP), managing FIPS certification, believes that this could cause confusion. xxhash64 must therefore be blocked in FIPS mode.
The only usage of xxhash64 in the kernel is btrfs. Commit
fe11ac191ce0("btrfs: switch to library APIs for checksums") recently modified the btrfs code to use the lib/crypto API, avoiding the Kernel Cryptographic API. Consequently, the removal of xxhash64 from the Crypto API in FIPS mode should now have no impact on btrfs usage.Quoted 4 lines
Signed-off-by Joachim Vandersmissen <[email protected]>---
crypto/testmgr.c| 1 -1 file changed, 1 deletion(-)Patch applied. Thanks.
Quoted 11 lines · Joachim Vandersmissen
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 3 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
There is a risk that users may not know that xxhash64 is not FIPS compliant and would still use it. Especially considering it was marked as "
fips_allowed= 1" for a while.
So isn't that a very bad situation? They think they are FIPS compliant, but actually they are not since they use an unapproved algorithm by accident. Maybe it would be better to include this patch so that they are aware of the mistake? If there is really somebody running into this issue, they could boot once with fips=0, fix their system, reboot again with fips=1 and finally be really compliant. Sounds like the better solution to me. WDYT?
Thomas
Quoted 20 lines · Thomas Huth
Quoted 10 lines · Joachim Vandersmissen
Hi Thomas,
Quoted 7 lines · Thomas Huth
Quoted 5 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Quoted 8 lines
Quoted 4 lines
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
There is a risk that users may not know that xxhash64 is not FIPS compliant and would still use it. Especially considering it was marked as "
fips_allowed= 1" for a while.
Quoted 6 lines
So isn't that a very bad situation? They think they are FIPS compliant, but actually they are not since they use an unapproved algorithm by accident. Maybe it would be better to include this patch so that they are aware of the mistake? If there is really somebody running into this issue, they could boot once with fips=0, fix their system, reboot again with fips=1 and finally be really compliant. Sounds like the better solution to me. WDYT?
As described in the dm-integrity documentation, dm-integrity supports non-cryptographic checksums for protection from accidental corruption. That use case is no different from any other use case of a checksum.
It's also no different from using crc32 or crc32c, which similarly have fips_allowed=1 and this patch completely ignores.
The solution is not banning checksums or making any other code change, but rather just doing what it seems everyone has already been doing:
documenting in their FIPS security policy that checksums are only for use cases that are not "security functions".
- Eric
Hi Eric,
Quoted 28 lines · Eric Biggers
Quoted 17 lines · Thomas Huth
Quoted 9 lines · Joachim Vandersmissen
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Quoted 7 lines
Quoted 4 lines
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
There is a risk that users may not know that xxhash64 is not FIPS compliant and would still use it. Especially considering it was marked as "
fips_allowed= 1" for a while.Quoted 6 lines
So isn't that a very bad situation? They think they are FIPS compliant, but actually they are not since they use an unapproved algorithm by accident. Maybe it would be better to include this patch so that they are aware of the mistake? If there is really somebody running into this issue, they could boot once with fips=0, fix their system, reboot again with fips=1 and finally be really compliant. Sounds like the better solution to me. WDYT?
As described in the dm-integrity documentation, dm-integrity supports non-cryptographic checksums for protection from accidental corruption. That use case is no different from any other use case of a checksum.
Quoted 7 lines
It's also no different from using crc32 or crc32c, which similarly have fips_allowed=1 and this patch completely ignores.
The solution is not banning checksums or making any other code change, but rather just doing what it seems everyone has already been doing:
documenting in their FIPS security policy that checksums are only for use cases that are not "security functions".
Unfortunately, this is not an option anymore due to the opinion of the CMVP that was issued back in March. If you have an account (you can sign up for free), you can read it in full here: https://cmuf-workspace.org/Products/Projects/Messages.aspx?prjID=3&id=559. I can also send a copy of the PDF file privately, if necessary.
The relevant text is:
1.a. Can xxhash64 be used in approved mode as non-security function without any further action (in this case FIPS IG 2.4.A will not be applicable)?
Answer: No, xxhash64 cannot be understood as a non-security function because:
1) It is offered as an equivalent hash alternative to approved hash algorithms (i.e., SHA) using the same interface/API and therefore appears to an operator that it can provide cryptographic protection (i.e., security).
2) Its return value (i.e., mode indicator) is the same as for approved cryptographic functions that provide security.
3) It is accessed by an interface/API that has “crypto” in the name and thus implies security.
4) It is an available hash function (i.e. PRF) of HMAC, which is a keyed algorithm that implies security.
crc32 and crc32c were not explicitly called out in the resolution, which is why this patch didn't target them. Though following the same rationale, they should also be disabled.
Quoted 2 lines
- Eric
Quoted 46 lines · Joachim Vandersmissen
Hi Eric,
Quoted 28 lines · Eric Biggers
Quoted 17 lines · Thomas Huth
Quoted 9 lines · Joachim Vandersmissen
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Joachim Vandersmissen
Hi Herbert,
I don't think this one can be applied yet since dm-integrity still uses xxhash64 through the crypto API. This would break fips=1 systems that use it.
Quoted 7 lines
Quoted 4 lines
Out of curiosity: Wouldn't such a system be FIPS-incompliant anyway? If xxhash64 isn't FIPS-compliant, nobody should use it for dm-integrity there, right? So I doubt that there are any systems out there that use fips=1 and use xxhash64 at the same time?
There is a risk that users may not know that xxhash64 is not FIPS compliant and would still use it. Especially considering it was marked as "
fips_allowed= 1" for a while.Quoted 6 lines
So isn't that a very bad situation? They think they are FIPS compliant, but actually they are not since they use an unapproved algorithm by accident. Maybe it would be better to include this patch so that they are aware of the mistake? If there is really somebody running into this issue, they could boot once with fips=0, fix their system, reboot again with fips=1 and finally be really compliant. Sounds like the better solution to me. WDYT?
As described in the dm-integrity documentation, dm-integrity supports non-cryptographic checksums for protection from accidental corruption. That use case is no different from any other use case of a checksum.
Quoted 7 lines
It's also no different from using crc32 or crc32c, which similarly have fips_allowed=1 and this patch completely ignores.
The solution is not banning checksums or making any other code change, but rather just doing what it seems everyone has already been doing:
documenting in their FIPS security policy that checksums are only for use cases that are not "security functions".Unfortunately, this is not an option anymore due to the opinion of the CMVP that was issued back in March. If you have an account (you can sign up for free), you can read it in full here: https://cmuf-workspace.org/Products/ Projects/Messages.aspx?prjID=3&id=559. I can also send a copy of the PDF file privately, if necessary.
The relevant text is:
1.a. Can xxhash64 be used in approved mode as non-security function
without any further action (in this case FIPS IG 2.4.A will not be applicable)?
Quoted 10 lines
Answer: No, xxhash64 cannot be understood as a non-security function
because:
1) It is offered as an equivalent hash alternative to approved hash
algorithms (i.e., SHA) using the same interface/API and therefore appears to an operator that it can provide cryptographic protection (i.e., security).
2) Its return value (i.e., mode indicator) is the same as for approved
cryptographic functions that provide security.
3) It is accessed by an interface/API that has “crypto” in the name and
thus implies security.
4) It is an available hash function (i.e. PRF) of HMAC, which is a
keyed algorithm that implies security.
Ok, thanks for making this clear. So that means for FIPS certification, xxhash64 *has* to be disabled in fips_enabled mode, right? Thus every distro that cares for FIPS certification has to include this patch. Every other distro doesn't care for fips_enabled anyway, so they should not care about this patch whether it's applied or not. I.e. there cannot be any user who uses xxhash64 in a fips_enabled system (unless someone is masochistic enough to turn it on with an upstream kernel in a environment that does not need FIPS compliance). So I think we really should include this patch into the upstream kernel now, too. WDYT?
Quoted 1 line
crc32 and crc32c were not explicitly called out in the resolution, which is why this patch didn't target them. Though following the same rationale, they should also be disabled.
Sounds reasonable to me, but maybe this can wait 'til the CMVP explicitely asks for it?
Thomas