Skip to content

Conversation

@skmcgrail
Copy link
Member

@skmcgrail skmcgrail commented Jan 9, 2026

Description of changes:

Adds a fairly limited openssl ca command that is targeted towards supporting the specific efs-utils use case for generating and self-signing a certificate.

Call-outs:

  • This only supports the self-signed certificate use case
  • Some code paths are retained to make it easier to add support for non-self-signed use cases in the future
  • A limited set of command-line options were added to support efs-utils use-case, there are more that could be added in the future. There are analogous options in the configuration file that can be provided in lieu of the missing command line arguments.
  • openssl ca has a series of "database" files that it record and tracks metadata in. Some of the behaviors like revocation checking is retained even though generation of revocations is not supported.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 98. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 88. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 72. Check the log or trigger a new build to see more.

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 72.22758% with 576 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.07%. Comparing base (a166bd1) to head (58e8e9b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
tool-openssl/ca.cc 61.57% 400 Missing ⚠️
tool-openssl/txt_db/txt_db.cc 71.10% 63 Missing ⚠️
tool-openssl/ca_req_common.cc 68.04% 31 Missing ⚠️
tool-openssl/test_util.cc 50.84% 29 Missing ⚠️
crypto/asn1/f_int.c 66.66% 22 Missing ⚠️
crypto/conf/conf.c 68.57% 22 Missing ⚠️
tool-openssl/ca_test.cc 99.20% 2 Missing and 2 partials ⚠️
crypto/fipsmodule/rsa/rsa.c 0.00% 2 Missing ⚠️
tool-openssl/req.cc 75.00% 2 Missing ⚠️
tool-openssl/txt_db/txt_db.h 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2937      +/-   ##
==========================================
- Coverage   78.21%   78.07%   -0.15%     
==========================================
  Files         690      685       -5     
  Lines      118750   119914    +1164     
  Branches    16681    16948     +267     
==========================================
+ Hits        92885    93623     +738     
- Misses      24976    25400     +424     
- Partials      889      891       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 62. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 42. Check the log or trigger a new build to see more.

@skmcgrail skmcgrail force-pushed the openssl-ca branch 2 times, most recently from e543f78 to 4921f38 Compare January 13, 2026 00:19
@skmcgrail skmcgrail changed the title [DRAFT] openssl-ca command implementation for self-sign certificates openssl-ca command implementation for self-sign certificates Jan 13, 2026
@skmcgrail skmcgrail marked this pull request as ready for review January 13, 2026 00:20
@skmcgrail skmcgrail requested a review from a team as a code owner January 13, 2026 00:20
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 32. Check the log or trigger a new build to see more.

@skmcgrail skmcgrail requested a review from justsmth January 13, 2026 19:26
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 17. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@skmcgrail skmcgrail force-pushed the openssl-ca branch 5 times, most recently from 54b7abb to b3f75e6 Compare January 15, 2026 21:39
#endif

// Windows compatibility layer
#ifdef _WIN32
Copy link
Contributor

Choose a reason for hiding this comment

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

#if defined(OPENSSL_WINDOWS)

using ossl_uint8_ptr = std::unique_ptr<uint8_t, ossl_free>;
using ossl_char_ptr = std::unique_ptr<char, ossl_free>;

#ifdef _WIN32
Copy link
Contributor

Choose a reason for hiding this comment

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

#if defined(OPENSSL_WINDOWS)

#include <cstring>
#include <memory>

// TODO: figure out windows
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment still needed?

}
}
k = 0;
i -= again;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a i -= again? It's possible that the loop on lines 90-96 had stopped prior to reaching the '\' character, so why decrease i based upon a character that exists potentially beyond the current position of i?

}
i /= 2;
if (num + i > slen) {
sp = OPENSSL_realloc(s, num + i * 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

NP: Allocating num + i * 2 bytes is unnecessary, since we only need num + i bytes to be allocated. This leads to 1/2 fewer allocations, but it also means we always over-allocate beyond what's needed.

Comment on lines +131 to +134
if (!OPENSSL_fromxdigit(&hex, bufp[k + n])) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_NON_HEX_CHARACTERS);
goto err;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NP: This can (should?) never fail b/c of the loop on lines 90-96 truncates on any character that might fail. It's fine to leave, but I wonder where we should rethink the loop above.

#include <openssl/bio.h>
#include <openssl/err.h>

int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment above this function documenting what it expects from the input (and how it handles variance from expectations) would be helpful.

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.

3 participants