Compare commits

..

3 Commits

Author SHA1 Message Date
Aydin Mercan 771f543cb5
bearssl-sys: use bindgen's usize setting
* `bindgen` can now set size_t as usize. This should remove the annoying
  type definition.
2022-11-05 16:12:38 +03:00
Aydin Mercan 8d5a9f7a16
bearssl(-sys): bump msrv to 1.65 2022-11-05 16:10:37 +03:00
Aydin Mercan bd4230a01c
bearssl(-sys): bump dependencies 2022-10-30 16:08:43 +03:00
6 changed files with 29 additions and 157 deletions

164
Cargo.lock generated
View File

@ -2,32 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "aho-corasick"
version = "0.7.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
dependencies = [
"memchr",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bearssl" name = "bearssl"
version = "0.0.2-pre.0" version = "0.0.2-pre.0"
@ -49,15 +23,13 @@ dependencies = [
[[package]] [[package]]
name = "bindgen" name = "bindgen"
version = "0.60.1" version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" checksum = "8a022e58a142a46fea340d68012b9201c094e93ec3d033a944a24f8fd4a4f09a"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"clap",
"env_logger",
"lazy_static", "lazy_static",
"lazycell", "lazycell",
"log", "log",
@ -67,6 +39,7 @@ dependencies = [
"regex", "regex",
"rustc-hash", "rustc-hash",
"shlex", "shlex",
"syn",
"which", "which",
] ]
@ -78,9 +51,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.73" version = "1.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574"
[[package]] [[package]]
name = "cexpr" name = "cexpr"
@ -108,54 +81,17 @@ dependencies = [
"libloading", "libloading",
] ]
[[package]]
name = "clap"
version = "3.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
dependencies = [
"atty",
"bitflags",
"clap_lex",
"indexmap",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "either" name = "either"
version = "1.8.0" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "env_logger"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.7" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@ -168,37 +104,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -213,9 +118,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.134" version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -260,15 +165,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.15.0" version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "os_str_bytes"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]] [[package]]
name = "peeking_take_while" name = "peeking_take_while"
@ -278,9 +177,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.46" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -309,8 +208,6 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [ dependencies = [
"aho-corasick",
"memchr",
"regex-syntax", "regex-syntax",
] ]
@ -333,31 +230,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "strsim" name = "syn"
version = "0.10.0" version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [ dependencies = [
"winapi-util", "proc-macro2",
"quote",
"unicode-ident",
] ]
[[package]]
name = "textwrap"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.4" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
[[package]] [[package]]
name = "wasi" name = "wasi"
@ -392,15 +279,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View File

@ -9,16 +9,16 @@ build = "build/main.rs"
categories = ["cryptography", "no-std", "external-ffi-bindings"] categories = ["cryptography", "no-std", "external-ffi-bindings"]
keywords = ["bearssl", "crypto", "tls", "ssl"] keywords = ["bearssl", "crypto", "tls", "ssl"]
edition = "2021" edition = "2021"
rust-version = "1.64" rust-version = "1.65"
[badges] [badges]
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }
[dependencies] [dependencies]
libc = { version = "0.2.134", optional = true } libc = { version = "0.2.137", optional = true }
[build-dependencies] [build-dependencies]
bindgen = "0.60.1" bindgen = "0.61.0"
cc = { version = "1.0.73", optional = true } cc = { version = "1.0.73", optional = true }
[features] [features]

View File

@ -11,12 +11,6 @@ Currently BearSSL 0.6 and latest Rust stable is supported.
* `bundled`: Build and link statically BearSSL. Needs a working C compiler and autoenables some sensible flags for the build target. * `bundled`: Build and link statically BearSSL. Needs a working C compiler and autoenables some sensible flags for the build target.
* `dont-assume-size_t-equals-uintptr_t`: Use libc's `size_t` instead of `usize`. Should only needed when `sizeof(uintptr_t) != sizeof(size_t)`. * `dont-assume-size_t-equals-uintptr_t`: Use libc's `size_t` instead of `usize`. Should only needed when `sizeof(uintptr_t) != sizeof(size_t)`.
## Misc.
Once `core::ffi` types are stable, the bindings can and should be
dependency-free for platforms where `dont-assume-size_t-equals-uintptr_t`
isn't required.
## License ## License
This repository is licensed under the BSD-3-Clause. Please refer to `LICENSE` and This repository is licensed under the BSD-3-Clause. Please refer to `LICENSE` and

View File

@ -5,6 +5,8 @@ use std::path::PathBuf;
fn main() { fn main() {
linkage::configure(); linkage::configure();
let usize_equals_size_t = !cfg!(feature = "dont-assume-size_t-equals-uintptr_t");
let bindings = bindgen::builder() let bindings = bindgen::builder()
.use_core() .use_core()
.ctypes_prefix("::core::ffi") .ctypes_prefix("::core::ffi")
@ -17,6 +19,7 @@ fn main() {
.blocklist_type("__.*_t") .blocklist_type("__.*_t")
.blocklist_type("size_t") .blocklist_type("size_t")
.generate_comments(false) .generate_comments(false)
.size_t_is_usize(usize_equals_size_t)
.generate() .generate()
.expect("Unable to generate bindings"); .expect("Unable to generate bindings");

View File

@ -15,7 +15,4 @@
#[cfg(feature = "dont-assume-size_t-equals-uintptr_t")] #[cfg(feature = "dont-assume-size_t-equals-uintptr_t")]
use libc::size_t; use libc::size_t;
#[cfg(not(feature = "dont-assume-size_t-equals-uintptr_t"))]
type size_t = usize;
include!(concat!(env!("OUT_DIR"), "/bindings.rs")); include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

View File

@ -8,14 +8,14 @@ readme = "README.md"
categories = ["cryptography", "no-std", "api-bindings"] categories = ["cryptography", "no-std", "api-bindings"]
keywords = ["bearssl", "crypto", "tls", "ssl"] keywords = ["bearssl", "crypto", "tls", "ssl"]
edition = "2021" edition = "2021"
rust-version = "1.64" rust-version = "1.65"
[badges] [badges]
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }
[dependencies] [dependencies]
bearssl-sys = { path = "../bearssl-sys" } bearssl-sys = { path = "../bearssl-sys" }
libc = { version = "0.2.134", optional = true } libc = { version = "0.2.137", optional = true }
rand_core = { version = "0.6.3", default-features = false } rand_core = { version = "0.6.3", default-features = false }
zeroize = { version = "1.5.7", default-features = false, optional = true } zeroize = { version = "1.5.7", default-features = false, optional = true }