aws / aws-lc-rs

aws-lc-rs is a cryptographic library using AWS-LC for its cryptographic operations. The library strives to be API-compatible with the popular Rust library named ring.
Other
320 stars 49 forks source link

Exported symbols conflict with boring-sys crate #446

Closed Diggsey closed 2 months ago

Diggsey commented 5 months ago

Problem:

The libaws_lc_sys crate exports symbols which conflict with other crates, such as libboring_sys.

Relevant details

AWS-LC for Rust versions or commit: (6b1bce0...)

System information: for linux, below info can be collected by running uname -srvmp

Build log:

= note: libboring_sys-85d2b9b1e2fceefe.rlib(crypto.obj) : error LNK2005: library_init_constructor already defined in libaws_lc_sys-adbe0a2ef2d693b0.rlib(crypto.obj)
          libboring_sys-85d2b9b1e2fceefe.rlib(thread_win.obj) : error LNK2005: p_thread_callback_boringssl already defined in libaws_lc_sys-adbe0a2ef2d693b0.rlib(thread_win.obj)
             ...
          fatal error LNK1169: one or more multiply defined symbols found
justsmth commented 3 months ago

I believe this problem will be resolved for Windows once we have a release for PR #486

I've been using the following basic setup to successfully test on MacOS, Linux, and now Windows (using that PR branch):

Cargo.toml

[package]
name = "aws-lc-rs-test"
version = "0.1.0"
edition = "2021"

[dependencies]
aws-lc-rs = "1.8.1"
boring = "4.9.1"

src/main.rs

fn main() {
    const MESSAGE: &[u8] = b"Hello Technician!";

    let output = aws_lc_rs::digest::digest(&aws_lc_rs::digest::SHA256, MESSAGE);

    print!("\nAWS-LC: ");
    for v in output.as_ref() {
        print!("{:02x}", *v);
    }
    print!("\nBoringSSL: ");
    let digest = boring::hash::MessageDigest::sha256();
    let boring_output = boring::hash::hash(digest, MESSAGE).unwrap();
    for v in boring_output.as_ref() {
        print!("{:02x}", *v);
    }
    println!();
}

I'll follow up once we've merged the relevant PRs.

justsmth commented 2 months ago

This is resolved with the release of aws-lc-rs v1.9.0.