#security #aws-security #crypto

sys no-std aws-lc-rs

aws-lc-rs is a cryptographic library using AWS-LC for its cryptographic operations. This library strives to be API-compatible with the popular Rust library named ring.

16 stable releases

1.7.0 Apr 16, 2024
1.6.2 Feb 14, 2024
1.5.2 Nov 20, 2023
1.2.1 Jul 10, 2023
0.0.1 Apr 11, 2023

#34 in Cryptography

Download history 14229/week @ 2024-01-03 15315/week @ 2024-01-10 22333/week @ 2024-01-17 21740/week @ 2024-01-24 18652/week @ 2024-01-31 28647/week @ 2024-02-07 29790/week @ 2024-02-14 22394/week @ 2024-02-21 22560/week @ 2024-02-28 28160/week @ 2024-03-06 32717/week @ 2024-03-13 34162/week @ 2024-03-20 26972/week @ 2024-03-27 36498/week @ 2024-04-03 29214/week @ 2024-04-10 35675/week @ 2024-04-17

133,741 downloads per month
Used in 35 crates (16 directly)

ISC AND (Apache-2.0 OR ISC)

58MB
1.5M SLoC

GNU Style Assembly 745K SLoC // 0.0% comments Rust 529K SLoC // 0.0% comments C 112K SLoC // 0.2% comments C++ 111K SLoC // 0.1% comments Perl 102K SLoC // 0.1% comments Assembly 94K SLoC // 0.0% comments Go 13K SLoC // 0.1% comments Bitbake 10K SLoC Shell 53 SLoC // 0.2% comments Pan 29 SLoC // 0.2% comments Batch 9 SLoC

AWS Libcrypto for Rust (aws-lc-rs)

Crates.io GitHub

A ring-compatible crypto library using the cryptographic operations provided by AWS-LC. It uses either the auto-generated aws-lc-sys or aws-lc-fips-sys Foreign Function Interface (FFI) crates found in this repository for invoking AWS-LC.

Build

aws-lc-rs is available through crates.io. It can be added to your project in the standard way using Cargo.toml:

[dependencies]
aws-lc-rs = "1.0.0"

Consuming projects will need a C Compiler (Clang or GCC) and Cmake to build.

Requirements:

  • C compiler (Clang or GCC or Visual Studio Build Tools 2017)
  • Cmake (>= v3.12)
  • Linux or macOS or Windows

Platform- and Feature-specific Requirements

  • Linux - required for fips
  • Go - required for fips
  • libclang - required for bindgen and for any platform lacking pre-generated bindings (like Windows or M1 Macs)

See our User Guide for guidance on installing these requirements.

Feature Flags

alloc (default)

Allows implementation to allocate values of arbitrary size. (The meaning of this feature differs from the "alloc" feature of ring.) Currently, this is required by the io::writer module.

ring-io (default)

Enable feature to access the io module.

ring-sig-verify (default)

Enable feature to preserve compatibility with ring's signature::VerificationAlgorithm::verify function. This adds a requirement on untrusted = "0.7.1".

fips

Enable this feature to have aws-lc-rs use the aws-lc-fips-sys crate for the cryptographic implementations. The aws-lc-fips-sys crate provides bindings to AWS-LC-FIPS 2.x, which has completed FIPS validation testing by an accredited lab and has been submitted to NIST for certification. The static build of AWS-LC-FIPS is used.

Supported Targets
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu

Refer to the NIST Cryptographic Module Validation Program's Modules In Progress List for the latest status of the static or dynamic AWS-LC Cryptographic Module. A complete list of supported operating environments will be made available in the vendor security policy once the validation certificate has been issued. We will also update our release notes and documentation to reflect any changes in FIPS certification status.

asan

Performs an "address sanitizer" build. This can be used to help detect memory leaks. See the "Address Sanitizer" section of the Rust Unstable Book.

bindgen

Causes aws-lc-sys or aws-lc-fips-sys to generates fresh bindings for AWS-LC instead of using the pre-generated bindings. This feature requires libclang to be installed. See the requirements for rust-bindgen

ring-compatibility

Although this library attempts to be fully compatible with ring (v0.16.x), there are a few places where our behavior is observably different.

  • Our implementation requires the std library. We currently do not support a #![no_std] build.
  • We can only support a subset of the platforms supported by aws-lc-sys. See the list of supported platforms above.
  • Ed25519KeyPair::from_pkcs8 and Ed25519KeyPair::from_pkcs8_maybe_unchecked both support parsing of v1 or v2 PKCS#8 documents. If a v2 encoded key is provided to either function, public key component, if present, will be verified to match the one derived from the encoded private key.

Motivation

Rust developers increasingly need to deploy applications that meet US and Canadian government cryptographic requirements. We evaluated how to deliver FIPS validated cryptography in idiomatic and performant Rust, built around our AWS-LC offering. We found that the popular ring (v0.16) library fulfilled much of the cryptographic needs in the Rust community, but it did not meet the needs of developers with FIPS requirements. Our intention is to contribute a drop-in replacement for ring that provides FIPS support and is compatible with the ring API. Rust developers with prescribed cryptographic requirements can seamlessly integrate aws-lc-rs into their applications and deploy them into AWS Regions.

Contributor Quickstart for Amazon Linux 2023

For those who would like to contribute to our project or build it directly from our repository, a few more packages may be needed. The listing below shows the steps needed for you to begin building and testing our project locally.

# Install dependencies needed for build and testing
sudo yum install -y cmake3 clang git clang-libs golang openssl-devel perl-FindBin

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

# Clone and initialize a local repository
git clone https://github.com/awslabs/aws-lc-rs.git
cd aws-lc-rs
git submodule update --init --recursive

# Build and test the project
cargo test

Questions, Feedback and Contributing

We use GitHub Issues for managing feature requests, bug reports, or questions about aws-lc-rs API usage.

Otherwise, if you think you might have found a security impacting issue, please instead follow our Security Notification Process below.

Security Notification Process

If you discover a potential security issue in AWS-LC or aws-lc-rs, we ask that you notify AWS Security via our vulnerability reporting page. Please do not create a public GitHub issue.

If you package or distribute aws-lc-rs, or use aws-lc-rs as part of a large multi-user service, you may be eligible for pre-notification of future aws-lc-rs releases. Please contact aws-lc-pre-notifications@amazon.com.

License

This library is licensed under the Apache-2.0 or the ISC License.

Dependencies