Skip to content

Implement enc CLI#2877

Merged
justsmth merged 8 commits intoaws:mainfrom
nhatnghiho:enc-cli
Dec 12, 2025
Merged

Implement enc CLI#2877
justsmth merged 8 commits intoaws:mainfrom
nhatnghiho:enc-cli

Conversation

@nhatnghiho
Copy link
Copy Markdown
Contributor

Description of changes:

Implement enc CLI with the following options:

  • e
  • d
  • aes-128-cbc
  • K
  • in
  • out
  • iv

Testing:

Unit tests

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 December 3, 2025 17:38
Copy link
Copy Markdown
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
Copy Markdown

codecov-commenter commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 76.62338% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.20%. Comparing base (ec39cb3) to head (dbe1ea4).

Files with missing lines Patch % Lines
tool-openssl/enc_test.cc 72.72% 36 Missing ⚠️
tool-openssl/enc.cc 81.81% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2877      +/-   ##
==========================================
+ Coverage   78.19%   78.20%   +0.01%     
==========================================
  Files         685      687       +2     
  Lines      118074   118305     +231     
  Branches    16617    16652      +35     
==========================================
+ Hits        92330    92525     +195     
- Misses      24856    24894      +38     
+ Partials      888      886       -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.

@justsmth
Copy link
Copy Markdown
Contributor

justsmth commented Dec 9, 2025

I believe the Valgrind failure is this one: https://github.com/aws/aws-lc/actions/runs/20031393257/job/57441202249?pr=2877#step:4:1663

justsmth
justsmth previously approved these changes Dec 10, 2025
return false;
}

BIGNUM *raw = NULL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
BIGNUM *raw = NULL;
bssl::UniquePtr<BIGNUM> raw;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

BN_hex2bn requires BIGNUM **outp as a parameter so we can't use bssl::UniquePtr<BIGNUM> here :(

#include "../tool/internal.h"
#include "internal.h"

#define BUF_SIZE 1024
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should abstract BUF_SIZE from req.cc to a shared header.

#define BUF_SIZE 1024

Same for the other PR as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I feel like the choice of buffer size among different commands can be a little arbitrary. Standardizing that across all commands might not be a good idea?

@justsmth justsmth merged commit d981825 into aws:main Dec 12, 2025
480 of 487 checks passed
break;
}

inlen = fread(inbuf, 1, sizeof(inbuf), in_file.get());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use ReadFromFD here? And use ScopedFD for all the file descripters

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can we create a ScopedFD for stdin? My main reason for using ScopedFILE was because I couldn't find a straightforward way to use ScopedFD for stdin

nhatnghiho added a commit to nhatnghiho/aws-lc that referenced this pull request Jan 2, 2026
@nhatnghiho nhatnghiho mentioned this pull request Jan 2, 2026
nhatnghiho added a commit to nhatnghiho/aws-lc that referenced this pull request Jan 13, 2026
justsmth pushed a commit that referenced this pull request Mar 10, 2026
### Description of changes: 
This PR addresses the remaining comments from PRs #2877 and #2898. I
also took the liberty to clean up `tool-openssl` to make our code easier
to read.

### Testing:
Unit tests

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.

---------

Co-authored-by: Samuel Chiang <sachiang@amazon.com>
WillChilds-Klein pushed a commit to WillChilds-Klein/aws-lc that referenced this pull request Mar 11, 2026
### Description of changes: 
This PR addresses the remaining comments from PRs aws#2877 and aws#2898. I
also took the liberty to clean up `tool-openssl` to make our code easier
to read.

### Testing:
Unit tests

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.

---------

Co-authored-by: Samuel Chiang <sachiang@amazon.com>
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