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

chore: document why SHA1 is the only supported hash algorithm for cert_id generation in OCSP response #4625

Merged
merged 10 commits into from
Jul 10, 2024
Merged
6 changes: 6 additions & 0 deletions api/s2n.h
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,12 @@ S2N_API extern int s2n_config_set_verify_host_callback(struct s2n_config *config
*
* The default value is 1 if the underlying libCrypto implementation supports OCSP.
*
* @note SHA-1 is the only supported hash algorithm for the `certID` field. If a different hash
* algorithm is used, validation will fail and manual verification will be needed. This is
jouho marked this conversation as resolved.
Show resolved Hide resolved
* different from the hash algorithm used for the signature algorithm. See
jouho marked this conversation as resolved.
Show resolved Hide resolved
* [RFC6960](https://datatracker.ietf.org/doc/html/rfc6960#section-4.1.1) for details about
* `certID` field.
*
jouho marked this conversation as resolved.
Show resolved Hide resolved
* @param config The configuration object being updated
* @param check_ocsp The desired OCSP response check configuration
* @returns S2N_SUCCESS on success. S2N_FAILURE on failure
Expand Down
8 changes: 7 additions & 1 deletion tls/s2n_x509_validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,13 @@ S2N_RESULT s2n_x509_validator_validate_cert_stapled_ocsp_response(struct s2n_x50
int status = 0;
int reason = 0;

/* sha1 is the only supported OCSP digest */
/* SHA-1 is the only supported OCSP digest due to its wide compatibility and established use
jouho marked this conversation as resolved.
Show resolved Hide resolved
* in existing systems. Supporting additional hash algorithms would require changes to error
jouho marked this conversation as resolved.
Show resolved Hide resolved
* handling and compatibility checks, which are not currently justified by user demand. For
jouho marked this conversation as resolved.
Show resolved Hide resolved
* verifying OCSP response with non-SHA-1 hash algorithm, users can call
* s2n_connection_get_ocsp_response() to retrieve the received OCSP stapling information for
* manual verification.
jouho marked this conversation as resolved.
Show resolved Hide resolved
*/
OCSP_CERTID *cert_id = OCSP_cert_to_id(EVP_sha1(), subject, issuer);
RESULT_ENSURE_REF(cert_id);

Expand Down
Loading