Skip to content

Conversation

@nhatnghiho
Copy link
Contributor

Issues:

Resolves #CryptoAlg-3383

Description of changes:

Re-implement dgst cli commands with the following options:
-binary
-sha256 (and a handful of other digest algorithms)
-sigopt
-passin
-sign
-out
-verify
-signature
-keyform

Call-outs:

Waiting for #2555 to implement -passin

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?

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.

@nhatnghiho nhatnghiho requested a review from a team as a code owner August 25, 2025 15:49
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

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 58.59729% with 183 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.90%. Comparing base (154edc9) to head (8b97425).

Files with missing lines Patch % Lines
tool-openssl/dgst.cc 68.35% 75 Missing ⚠️
tool-openssl/dgst_test.cc 48.63% 75 Missing ⚠️
tool-openssl/test_util.h 6.66% 14 Missing ⚠️
tool/args.cc 12.50% 14 Missing ⚠️
tool-openssl/ordered_args.cc 77.27% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2638      +/-   ##
==========================================
+ Coverage   78.81%   78.90%   +0.08%     
==========================================
  Files         667      667              
  Lines      114088   114343     +255     
  Branches    16063    16107      +44     
==========================================
+ Hits        89923    90225     +302     
+ Misses      23390    23340      -50     
- Partials      775      778       +3     

☔ 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.

@justsmth justsmth requested a review from smittals2 October 3, 2025 16:55
bool GetBoolArgument(bool *out, const std::string &arg_name,
const ordered_args_map_t &args);

bool GetExclusiveBoolArgument(std::string *out_arg, const argument_t *templates,
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious on reasoning here. Why do we want to do exclusive bool arguments at the parsing layer, as opposed to for example writing a func at tool level to validate parsed options?

Copy link
Contributor Author

@nhatnghiho nhatnghiho Oct 3, 2025

Choose a reason for hiding this comment

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

Since the supported digest suite is fairly large, I think that doing it the parsing layer makes more sense. Otherwise, we'd need to 1) maintain a list of supported digests (in addition to the arg templates), 2) parse the arguments a 2nd time to get the digest names, and 3) check for mutual exclusivity. Computationally, it's the same amount of work either way but doing it at the parsing layer is much cleaner.

And since we're already relying on the kExclusiveBooleanArgument type for the parsing, might as well make it a util function rather than a one-off function in the digest tool. I thought it'd be useful in the future if we ever need to do handle multiple exclusive bool args again.

@justsmth justsmth merged commit eaaa97b into aws:main Oct 6, 2025
364 of 369 checks passed
@justsmth justsmth mentioned this pull request Oct 13, 2025
justsmth added a commit that referenced this pull request Oct 13, 2025
### Description of changes: 
Prepare v1.62.0 release

#### What's Changed
* nginx now supports AWS-LC by @samuel40791765 in
#2714
* Fix tests that assume X25519 will be negotiated by @alexw91 in
#2682
* Fixing a bug in ML-DSA poly_uniform function by @dkostic in
#2721
* Migrate integration omnibus by @skmcgrail in
#2715
* Delete util/bot directory by @justsmth in
#2723
* Don't ignore CMAKE_C_FLAGS w/ MSVC by @justsmth in
#2722
* Bump urllib3 from 2.2.3 to 2.5.0 in /tests/ci by @dependabot[bot] in
#2551
* Type fix in mldsa by @manastasova in
#2308
* Centralize password handling tool-openssl by @kingstjo in
#2555
* crypto/pem: replace strncmp with CRYPTO_memcmp to fix -Wstring-compare
error by @R3hankhan123 in #2724
* Implement dgst CLI command by @nhatnghiho in
#2638
* Add ASN.1 decoding for ML-KEM private keys as seeds by @jakemas in
#2707
* Implement genrsa command by @kingstjo in
#2535
* Move udiv and sencond tweak calculations to when needed by @nebeid in
#2726
* Add null check on RSA key checks by @samuel40791765 in
#2727
* Implement workaround for FORTIFY_SOURCE warning with jitterentropy by
@skmcgrail in #2728
* Implement coverity suggestions by @skmcgrail in
#2730
* Add minimal EC CLI tool implementation by @kingstjo in
#2640
* Adding pkeyutl tool to the CLI by @smittals2 in
#2575
* Add CI dimensions for legacy AVX512 flags by @smittals2 in
#2732
* Fix Libwebsockets CI by @smittals2 in
#2737
* Add option ENABLE_SOURCE_MODIFICATION by @justsmth in
#2739
* Simple script to build/run tests by @justsmth in
#2736
* Add build-time option to opt-out of CPU Jitter Entropy by
@torben-hansen in #2733


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.
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.

4 participants