Skip to content

Block SHA1 mechanism for FIPS 140-3:#145

Open
vkanjur wants to merge 1 commit intoopencryptoki:masterfrom
vkanjur:sha1_fips_fix
Open

Block SHA1 mechanism for FIPS 140-3:#145
vkanjur wants to merge 1 commit intoopencryptoki:masterfrom
vkanjur:sha1_fips_fix

Conversation

@vkanjur
Copy link
Copy Markdown
Contributor

@vkanjur vkanjur commented May 5, 2026

This commit removes SHA1 mechanism when FIPS 140-3 is active.

This commit removes SHA1 mechanism when FIPS 140-3 is active.

Signed-off-by: Vishnudatha Kanjur <kanjur@ibm.com>
@vkanjur vkanjur requested a review from ifranzki May 5, 2026 13:34
Comment thread src/fips.c
DES3_CBC_MAC, DES3_CMAC, ED25519_KEYGEN, ED25519_SIGN, ED25519_VERIFY,
ED448_KEYGEN, ED448_SIGN, ED448_VERIFY, X25519_KEYGEN, X25519_DERIVE,
X448_KEYGEN, X448_DERIVE, RSA_ME, RSA_CRT, SHA512_DRNG, -1, -1 };
X448_KEYGEN, X448_DERIVE, RSA_ME, RSA_CRT, SHA512_DRNG, SHA1, -1, -1 };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding SHA1 here causes it to no longer be included in the mechanism list (ica_get_functionlist()), but it does not hinder anyone from using the ica_sha1() function.....

I checked how this is done for e.g. DES, and there the ica_des_xxx() functions have

#ifdef ICA_FIPS
	if (fips)
		return EACCES;
#endif /* ICA_FIPS */

at the top of the function body. So this block the function when fips is active.

Note that ica_sha1() has the following there:

#ifdef ICA_FIPS
	if (fips >> 1)
		return EACCES;
#endif /* ICA_FIPS */

This blocks the function only if the fips selftests have failed (note (fips) vs (fips >> 1)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants