microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.32k stars 113 forks source link

Need Rust bindings for bcrypt_provider.h and ncrypt_provider.h #1907

Closed ajrzeznik closed 3 months ago

ajrzeznik commented 3 months ago

My team is writing a KSP Provider in Rust. Currently we need to use the following headers in our implementation of a KSP provider:

bcrypt.h ncrypt.h wincrypt.h bcrypt_provider.h ncrypt_provider.h

Based on our analysis, the first 3 headers are already covered by the windows-rs crate, but it seems that the last 2 headers, for the providers specifically, are not included. It would be great to get those eventually included to allow us to avoid our own bindgen completely for writing a KSP provider. Please let me know if you need any additional info or if there's anything else I can do to help. (Issue posted here after discussing with @jder )

riverar commented 3 months ago

Hi @ajrzeznik, can you provide some examples of APIs from the last two headers? Those headers don't seem to be in the SDK.

riverar commented 3 months ago

Oh I see, this is part of the Microsoft Cryptographic Provider Development Kit (CPDK).

riverar commented 3 months ago

I was able to generate a Rust crate using my steps documented at https://withinrafael.com/2023/01/18/generating-metadata-for-the-windows-crate/ (along with some elbow grease). But as expected, there's a great amount of overlap with the existing Win32 metadata--the CPDK only introduces 5 net new functions and a handful of constants/types.

@mikebattista Are you okay with me incorporating the Microsoft CPDK (https://www.microsoft.com/en-my/download/details.aspx?id=30688) into this repository for inclusion in our existing crypto partitions?

jder commented 3 months ago

Just wanted to follow up on this -- are we waiting for feedback from @mikebattista on the approach from @riverar?

riverar commented 3 months ago

Yep.

mikebattista commented 3 months ago

I was able to generate a Rust crate using my steps documented at https://withinrafael.com/2023/01/18/generating-metadata-for-the-windows-crate/ (along with some elbow grease). But as expected, there's a great amount of overlap with the existing Win32 metadata--the CPDK only introduces 5 net new functions and a handful of constants/types.

@mikebattista Are you okay with me incorporating the Microsoft CPDK (https://www.microsoft.com/en-my/download/details.aspx?id=30688) into this repository for inclusion in our existing crypto partitions?

Yes that seems reasonable.