Skip to content

Conversation

@justsmth
Copy link
Contributor

Issues:

Addresses aws/aws-lc#1997

Description of changes:

When targeting Windows 7, ensure that there's a definition for _WIN32_WINNT).

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.

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.45%. Comparing base (c358484) to head (929b3d6).
⚠️ Report is 313 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1000      +/-   ##
==========================================
- Coverage   95.80%   92.45%   -3.35%     
==========================================
  Files          61       71      +10     
  Lines        8143     9812    +1669     
  Branches        0     9812    +9812     
==========================================
+ Hits         7801     9072    +1271     
- Misses        342      451     +109     
- Partials        0      289     +289     

☔ 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 0blu January 13, 2026 19:32
Copy link

@0blu 0blu left a comment

Choose a reason for hiding this comment

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

lgtm! 👍

I've tested the changes by compiling on my Windows 11 PC and executing a simple program in my Windows 7 VM.

fn main() {
    let rng = SystemRandom::new();
    let mut buffer = [0u8; 32];
    if rng.fill(&mut buffer).is_err() {
        println!("Error filling random bytes");
    } else {
        println!("Everything is okay");
        println!("{:02X?}", buffer);
    }
}

cargo +nightly build --release --target x86_64-win7-windows-msvc -Zbuild-std

Used commits:
justsmth@929b3d6
justsmth/aws-lc@c7599cd

justsmth added a commit to aws/aws-lc that referenced this pull request Jan 16, 2026
### Issues:
Addresses #1997

### Description of changes: 
`ProcessPrng` (from `bcryptprimitives.dll`) is only available on Windows
8+. So the current code fails at runtime on Windows 7 because
`GetProcAddress` returns `NULL` and causes an `abort()`.

This change defines `AWSLC_WINDOWS_7_COMPAT` when `_WIN32_WINNT <=
_WIN32_WINNT_WIN7`. Then uses the existing `BCryptGenRandom` logic when
it's is defined.

* Related: aws/aws-lc-rs#1000

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.
@justsmth justsmth requested a review from skmcgrail January 21, 2026 20:32

if target().ends_with("-win7-windows-msvc") {
// 0x0601 is the value of `_WIN32_WINNT_WIN7`
build_options.push(BuildOption::define("_WIN32_WINNT", "0x0601"));

Choose a reason for hiding this comment

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

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