Skip to content

Commit

Permalink
openssl/gen_cert: mark evidence extension as non-critical (#150)
Browse files Browse the repository at this point in the history
Mark evidence extensions as non-critical, since many TLS libraries (such as openssl or mbedtls) do not support extracting critical extensions.

See: CCC-Attestation/interoperable-ra-tls#9

Signed-off-by: Kun Lai <[email protected]>
  • Loading branch information
imlk0 authored Feb 27, 2023
1 parent 7cb81f7 commit 2378719
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crypto_wrappers/openssl/gen_cert.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ crypto_wrapper_err_t openssl_gen_cert(crypto_wrapper_ctx_t *ctx, rats_tls_cert_a
/* Add evidence extension */
if (cert_info->evidence_buffer_size) {
/* The DiceTaggedEvidence extension criticality flag SHOULD be marked critical. */
if (!x509_extension_add(cert, TCG_DICE_TAGGED_EVIDENCE_OID, true,
if (!x509_extension_add(cert, TCG_DICE_TAGGED_EVIDENCE_OID, false,
cert_info->evidence_buffer,
cert_info->evidence_buffer_size) != RATS_TLS_ERR_NONE)
goto err;
}

/* Add endorsements extension */
if (cert_info->endorsements_buffer_size) {
if (!x509_extension_add(cert, TCG_DICE_ENDORSEMENT_MANIFEST_OID, true,
if (!x509_extension_add(cert, TCG_DICE_ENDORSEMENT_MANIFEST_OID, false,
cert_info->endorsements_buffer,
cert_info->endorsements_buffer_size) != RATS_TLS_ERR_NONE)
goto err;
Expand Down
2 changes: 2 additions & 0 deletions src/tls_wrappers/openssl/un_negotiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ int verify_certificate(int preverify_ok, X509_STORE_CTX *ctx)
if (err == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
return SSL_SUCCESS;

#if 0
/* According to the dice standard, the DiceTaggedEvidence extension should be set to critical=true.
* However, there is no way via the openssl api to know directly which extension is causing
* X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION, so we have to tolerate all this cases here.
Expand All @@ -188,6 +189,7 @@ int verify_certificate(int preverify_ok, X509_STORE_CTX *ctx)
*/
if (err == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION)
return SSL_SUCCESS;
#endif

/*
* A typical and unrecoverable error code is
Expand Down

0 comments on commit 2378719

Please sign in to comment.