apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.47k stars 166 forks source link

Include C++ implementations of BoringSSL algorithms #300

Open fpseverino opened 2 days ago

fpseverino commented 2 days ago

In BoringSSL some algorithms, like ML-KEM and ML-DSA, are written in C++, but the vendor-boringssl.sh script doesn't look for .cc files inside BoringSSL’s crypto directory.

New Issue Checklist

Expected behavior

Being able to use methods from algorithms written in C++

Actual behavior

Not being able to use methods from algorithms written in C++

Steps to reproduce

  1. Add the header file of an algorithm written in C++ inside Sources/CCryptoBoringSSL/include/CCryptoBoringSSL.h
  2. Import CCryptoBoringSSL
  3. Try to use a CCryptoBoringSSL_xxx method of an algorithm written in C++

Swift Crypto version/commit hash

commit: ff0f781cf7c6a22d52957e50b104f5768b50c779

Environment

Swift version: Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Unix version: Darwin MacBookPro.wind3.hub 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024
 root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64

macOS version: 15.1.1
Xcode-select path: '/Applications/Xcode.app/Contents/Developer
Xcode: Xcode 16.1 (Build version 16B40)
Lukasa commented 2 hours ago

Thanks for filing this @fpseverino! Let's nail this down before we move forward on #278 and #267, as I'd like us to make sure we aren't going to regress those.

fpseverino commented 2 hours ago

I agree @Lukasa! This will need a BoringSSL update too, right? Is it something that I can/should do?

Lukasa commented 2 hours ago

It's going to be a lot easier for me to do it than you, I suspect

fpseverino commented 2 hours ago

All right, just to clarify, would you also take care of updating the script or would you prefer me to do it?

Lukasa commented 2 hours ago

I can update the script as well. :smile: