Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X9.63 KDF with SHA-1 #1403

Closed
jvdsn opened this issue Jan 17, 2023 · 13 comments
Closed

X9.63 KDF with SHA-1 #1403

jvdsn opened this issue Jan 17, 2023 · 13 comments
Assignees
Milestone

Comments

@jvdsn
Copy link
Contributor

jvdsn commented Jan 17, 2023

Protocol Section
https://github.com/usnistgov/ACVP/blob/master/src/ans9.63/sections/05-capabilities.adoc

Protocol Question
Why does the X9.63 KDF only support SHA-224, SHA-256, SHA-384, and SHA-512? According to SP 800-135r1, all hash functions specified in FIPS 180-3 are approved. This would include SHA-1.

@livebe01 livebe01 self-assigned this Jan 19, 2023
@livebe01
Copy link
Collaborator

Agreed. Thanks. We'll fix this.

@livebe01 livebe01 added the Bug label Jan 19, 2023
@livebe01
Copy link
Collaborator

As a side note, we (NIST/CMVP/CAVP) are encouraging vendors to move away from SHA-1 and are planning for a transition away from SHA-1. See https://csrc.nist.gov/news/2022/nist-transitioning-away-from-sha-1-for-all-apps

@livebe01 livebe01 removed the Bug label Jan 20, 2023
@livebe01
Copy link
Collaborator

Hi @jvdsn, @celic tracked this down. It looks like the reason we didn't implement SHA-1 for the KDF is that section 5.6.2 of ANSI X9.63-2011 requires "An Approved hash function that offers 112 bits of security or more shall be used, i.e. an Approved hash function whose output is 224 bits or more."

@jvdsn
Copy link
Contributor Author

jvdsn commented Jan 20, 2023

Hi @jvdsn, @celic tracked this down. It looks like the reason we didn't implement SHA-1 for the KDF is that section 5.6.2 of ANSI X9.63-2011 requires "An Approved hash function that offers 112 bits of security or more shall be used, i.e. an Approved hash function whose output is 224 bits or more."

Hi @livebe01 could you check ANSI X9.63-2001? SP 800-135r1 specifically references the 2001 version of the standard, not the 2011 version.

@livebe01
Copy link
Collaborator

I can. Do you have a client that wants their X9.63 KDF tested w/ SHA-1?

@jvdsn
Copy link
Contributor Author

jvdsn commented Jan 20, 2023

Yes, I have. Specifically, it's OpenSSL 3 which implements the X9.63 KDF with a variety of hash functions, including SHA-1: https://www.openssl.org/docs/man3.0/man7/EVP_KDF-X963.html. Apart from SHA-1, it also seems to support the truncated SHA-512 hashes and SHA-3.

What's interesting is that ACVP supports pretty much every hash for the X9.42 KDF (https://github.com/usnistgov/ACVP/blob/master/src/ans9.42/sections/05-capabilities.adoc), but only a specific subset for the X9.63 KDF (https://github.com/usnistgov/ACVP/blob/master/src/ans9.63/sections/05-capabilities.adoc). Do you know why there is a difference there? I would expect them to be consistent.

@livebe01 livebe01 reopened this Jan 20, 2023
@celic
Copy link
Collaborator

celic commented Jan 20, 2023

This would be because of when x9.63 KDF was introduced by the CAVP. The x9.63 KDF was in CAVS originally which matched the definition provided in x9.63-2011. When we implemented CAVS algorithms in ACVTS, we copied the allowed parameters as well. The x9.42 KDF was not in CAVS (the algorithm was a functional duplicate of the TPM KDF I believe). It was introduced by the CAVP in ACVTS, and because it was "new", it made sense to support all reasonable hash algorithms.

I would agree that the truncated SHAs and SHA-3 would make sense to add to the x9.63 KDF. I would not be inclined to add SHA-1.

@jvdsn
Copy link
Contributor Author

jvdsn commented Jan 27, 2023

Hi @celic it would certainly be useful to add the truncated SHAs and SHA-3 to the X9.63 KDF as well. What is the reasoning behind not adding SHA-1?

@celic
Copy link
Collaborator

celic commented Jan 27, 2023 via email

@jvdsn
Copy link
Contributor Author

jvdsn commented Feb 8, 2023

Because the x9.63 KDF standard our testing is based on does not allow SHA-1.

Well, the 2001 version of the standard (the one referenced in SP 800-135) does in fact allow SHA-1. A quote from Section 5.6.2:

Any ANSI-approved hash function that offers 80 bits of security or more may be used, i.e. any
ANSI-approved hash function whose output is 160 bits or more. Possibilities, therefore, include
the hash function SHA-1 which is specified in [3].

@celic
Copy link
Collaborator

celic commented Feb 17, 2023

I took a deeper read at x9.63-2001. It says that you'd only be allowed to use SHA-1 to generate 80-bit symmetric keys (see Table H-3). The requirement of 112-bits of security strength would likely take precedence here. I think there is no current practical use for x9.63 KDF with SHA-1 within FIPS 140.

@livebe01 livebe01 added this to the v1.1.0.28 milestone Feb 22, 2023
livebe01 added a commit to livebe01/ACVP that referenced this issue Feb 22, 2023
Adds SHA2-512/224, SHA2-512/256, SHA3-224, SHA3-256, SHA3-384 and SHA3-512 support to the ANSI X9.63 KDF testing

usnistgov#1403
@livebe01
Copy link
Collaborator

livebe01 commented Mar 3, 2023

The fix for this is on Demo in release v1.1.0.28.

@livebe01
Copy link
Collaborator

The fix for this is on Prod in release v1.1.0.28.

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

No branches or pull requests

3 participants