Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Jul 16, 2023
1 parent 01661a9 commit e9ada99
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ documentation = "https://docs.rs/hacl/"
description = "Crypto library using formally verified code from the HACL project"
readme = "README.md"
repository = "https://github.com/cryspen/hacl-packages"
rust-version = "1.60"

[lib]
crate-type = ["staticlib", "cdylib", "lib"]
Expand Down
5 changes: 2 additions & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# HACL Rust bindings

[![Build & Test][github-actions-badge]][github-actions-link]
![Rust Version][rustc-image]
[![crates.io][hacl-crate-badge]](https://crates.io/crates/hacl)
[![Docs][docs-badge]](https://docs.rs/hacl)

Expand All @@ -17,7 +16,8 @@ Please see the [top level readme] for more information about the underlying code
| iOS ||
| Linux x64 ||
| Linux x86 ||
| Windows x64 ||
| Windows x64 ||
| Windows x86 ||
| Arm64 Linux ||
| Arm32 Linux ||

Expand Down Expand Up @@ -53,4 +53,3 @@ This will also run automatically generated binding tests from bindgen.
[hacl-crate-badge]: https://img.shields.io/crates/v/hacl.svg?style=for-the-badge
[docs-badge]: https://img.shields.io/badge/docs-blue.svg?style=for-the-badge
[top level readme]: https://github.com/cryspen/hacl-packages#readme
[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg?style=for-the-badge
2 changes: 2 additions & 0 deletions rust/hacl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ exclude = [
".c/.git",
".c/.gitignore",
]
rust-version = "1.60"

[dependencies]
libc = "0.2.147"

[target.'cfg(all(not(windows), not(nobindgen)))'.build-dependencies]
bindgen = "0.65"
Expand Down
32 changes: 11 additions & 21 deletions rust/hacl-sys/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
# hacl-sys

[![Build & Test][github-actions-badge]][github-actions-link]
![Rust Version][rustc-image]
[![crates.io][hacl-sys-crate-badge]](https://crates.io/crates/hacl-sys)
[![Docs][docs-badge]](https://docs.rs/hacl-sys)

Rust wrapper for [hacl](https://github.com/cryspen/hacl-packages).

### Platforms

| Platform | Supported |
| :------------------- | :-------: |
| MacOS ||
| MacOS Arm64 ||
| iOS ||
| iOS Simulator x86_64 ||
| Linux x64 ||
| Linux x86 ||
| Windows x64 ||
| Arm64 Linux ||
| Arm32 Linux ||

#### Building on Windows

Enabling builds on Windows is tracked in [#78](https://github.com/cryspen/hacl-packages/issues/78).

<!-- To build `evercrypt` and `evercrypt-sys` on Windows ensure path for the `VsDevCmd.bat`
called in in `hacl-build.bat` is correct on your system.
The build has only been tested with VisualStudio 2019. -->
| Platform | Supported |
| :---------- | :-------: |
| MacOS ||
| MacOS Arm64 ||
| iOS ||
| Linux x64 ||
| Linux x86 ||
| Windows x64 ||
| Windows x86 ||
| Arm64 Linux ||
| Arm32 Linux ||

[maturity-badge]: https://img.shields.io/badge/maturity-beta-orange.svg?style=for-the-badge
[github-actions-badge]: https://img.shields.io/github/actions/workflow/status/cryspen/hacl-packages/rust.yml?label=build%20%26%20tests&logo=github&style=for-the-badge&branch=main
[github-actions-link]: https://github.com/cryspen/hacl-packages/actions/workflows/rust.yml?query=branch%3Amain
[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg?style=for-the-badge
[docs-badge]: https://img.shields.io/badge/docs-blue.svg?style=for-the-badge
[hacl-sys-crate-badge]: https://img.shields.io/crates/v/hacl-sys.svg?style=for-the-badge
5 changes: 5 additions & 0 deletions rust/hacl-sys/src/hacl_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ pub struct EverCrypt_AEAD_state_s {
r#impl: u8,
ek: *mut u8,
}

/// Free a raw C pointer.
pub unsafe fn free(p: *mut u64) {
libc::free(p as *mut libc::c_void);
}
6 changes: 4 additions & 2 deletions rust/src/rsa_pss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn sign(
let key_size_bits = (key_len as u32) * 8;

unsafe {
let skey = Hacl_RSAPSS_new_rsapss_load_skey(
let s_key = Hacl_RSAPSS_new_rsapss_load_skey(
key_size_bits,
E_BITS,
key_size_bits,
Expand All @@ -132,15 +132,17 @@ pub fn sign(
key_size_bits,
E_BITS,
key_size_bits,
skey,
s_key,
salt.len() as u32,
salt.as_ptr() as _,
msg.len() as u32,
msg.as_ptr() as _,
signature.as_mut_ptr(),
) {
free(s_key);
return Err(Error::SigningError);
}
free(s_key);
}
Ok(signature)
}
Expand Down

0 comments on commit e9ada99

Please sign in to comment.