diff -Nru rust-botan-sys-0.10.1/.cargo_vcs_info.json rust-botan-sys-0.10.5/.cargo_vcs_info.json --- rust-botan-sys-0.10.1/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 +++ rust-botan-sys-0.10.5/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,6 +1,6 @@ { "git": { - "sha1": "6fc8f5ca64578b7281bf286eed353559f25b19b8" + "sha1": "132583ab4f783b1de125efd46d0ad1357cff76c7" }, "path_in_vcs": "botan-sys" } \ No newline at end of file diff -Nru rust-botan-sys-0.10.1/Cargo.toml rust-botan-sys-0.10.5/Cargo.toml --- rust-botan-sys-0.10.1/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 +++ rust-botan-sys-0.10.5/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.58" name = "botan-sys" -version = "0.10.1" +version = "0.10.5" authors = ["Jack Lloyd "] build = "build.rs" links = "botan-2" @@ -31,11 +31,14 @@ resolver = "1" [build-dependencies.botan-src] -version = "0.21903" +version = "0.30101.2" optional = true [features] botan3 = [] default = [] no-std = [] -vendored = ["botan-src"] +vendored = [ + "botan-src", + "botan3", +] diff -Nru rust-botan-sys-0.10.1/Cargo.toml.orig rust-botan-sys-0.10.5/Cargo.toml.orig --- rust-botan-sys-0.10.1/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "botan-sys" -version = "0.10.1" +version = "0.10.5" authors = ["Jack Lloyd "] links = "botan-2" build = "build.rs" @@ -17,8 +17,8 @@ [features] default = [] no-std = [] -vendored = ["botan-src"] +vendored = ["botan-src", "botan3"] botan3 = [] [build-dependencies] -botan-src = { version = "0.21903", optional = true, path = "../botan-src" } +botan-src = { version = "0.30101.2", optional = true, path = "../botan-src" } diff -Nru rust-botan-sys-0.10.1/build.rs rust-botan-sys-0.10.5/build.rs --- rust-botan-sys-0.10.1/build.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/build.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,24 +1,24 @@ #[cfg(feature = "vendored")] -fn os_uses_gnu_libstdcpp() -> bool { - /* - * Possibly other OSes should default to libstdc++ as well. But - * given macOS, iOS, Android, FreeBSD, etc should all use libc++ - * probably defaulting to libc++ when in doubt is the correct move. - */ +fn emit_dylibs() -> Vec<&'static str> { + // Windows doesn't need to dynamically link the C++ runtime + // but we do need to link to DLLs with needed functionality: + if cfg!(target_os = "windows") { + return vec!["user32", "crypt32"]; + } + + // On Linux we use libstdc++ if cfg!(any(target_os = "linux")) { - true - } else { - false + return vec!["stdc++"]; } + + // For all other platforms, link to libc++ from LLVM/Clang + vec!["c++"] } fn botan_lib_major_version() -> i32 { - #[cfg(feature = "botan3")] - { + if cfg!(any(feature = "vendored", feature = "botan3")) { 3 - } - #[cfg(not(feature = "botan3"))] - { + } else { 2 } } @@ -36,10 +36,6 @@ } fn main() { - if cfg!(feature = "vendored") && cfg!(feature = "botan3") { - panic!("The current vendored library does not support botan3 APIs"); - } - #[cfg(feature = "vendored")] { let (lib_dir, _) = botan_src::build(); @@ -47,10 +43,8 @@ println!("cargo:rustc-link-search=native={}", &lib_dir); println!("cargo:rustc-link-lib=static={}", botan_library_name(),); - if os_uses_gnu_libstdcpp() { - println!("cargo:rustc-flags=-l dylib=stdc++"); - } else { - println!("cargo:rustc-flags=-l dylib=c++"); + for dylib in emit_dylibs() { + println!("cargo:rustc-flags=-l dylib={}", dylib); } } #[cfg(not(feature = "vendored"))] diff -Nru rust-botan-sys-0.10.1/debian/changelog rust-botan-sys-0.10.5/debian/changelog --- rust-botan-sys-0.10.1/debian/changelog 2023-06-17 08:02:26.000000000 +0000 +++ rust-botan-sys-0.10.5/debian/changelog 2023-11-22 21:29:42.000000000 +0000 @@ -1,3 +1,9 @@ +rust-botan-sys (0.10.5-1) unstable; urgency=medium + + * Package botan-sys 0.10.5 from crates.io using debcargo 2.6.0 + + -- Alexander Kjäll Wed, 22 Nov 2023 16:29:42 -0500 + rust-botan-sys (0.10.1-1) unstable; urgency=medium * Package botan-sys 0.10.1 from crates.io using debcargo 2.6.0 diff -Nru rust-botan-sys-0.10.1/debian/control rust-botan-sys-0.10.5/debian/control --- rust-botan-sys-0.10.1/debian/control 2023-06-17 08:02:26.000000000 +0000 +++ rust-botan-sys-0.10.5/debian/control 2023-11-22 21:29:42.000000000 +0000 @@ -35,10 +35,10 @@ librust-botan-sys-0.10+botan3-dev (= ${binary:Version}), librust-botan-sys-0.10+default-dev (= ${binary:Version}), librust-botan-sys-0.10+no-std-dev (= ${binary:Version}), - librust-botan-sys-0.10.1-dev (= ${binary:Version}), - librust-botan-sys-0.10.1+botan3-dev (= ${binary:Version}), - librust-botan-sys-0.10.1+default-dev (= ${binary:Version}), - librust-botan-sys-0.10.1+no-std-dev (= ${binary:Version}) + librust-botan-sys-0.10.5-dev (= ${binary:Version}), + librust-botan-sys-0.10.5+botan3-dev (= ${binary:Version}), + librust-botan-sys-0.10.5+default-dev (= ${binary:Version}), + librust-botan-sys-0.10.5+no-std-dev (= ${binary:Version}) Description: FFI wrapper for Botan cryptography library - Rust source code This package contains the source for the Rust botan-sys crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-botan-sys-0.10.1/debian/patches/disable-vendord-sources.patch rust-botan-sys-0.10.5/debian/patches/disable-vendord-sources.patch --- rust-botan-sys-0.10.1/debian/patches/disable-vendord-sources.patch 2023-06-17 08:02:26.000000000 +0000 +++ rust-botan-sys-0.10.5/debian/patches/disable-vendord-sources.patch 2023-11-22 21:29:42.000000000 +0000 @@ -1,21 +1,29 @@ +as botan is already packaged in debian we don't want to build it from source + diff --git a/Cargo.toml b/Cargo.toml -index 4ec9733..73f2adf 100644 +index e74450f..35d2f7f 100644 --- a/Cargo.toml +++ b/Cargo.toml -@@ -30,12 +30,12 @@ license = "MIT" +@@ -30,15 +30,15 @@ license = "MIT" repository = "https://github.com/randombit/botan-rs" resolver = "1" -[build-dependencies.botan-src] --version = "0.21903" +-version = "0.30101.2" -optional = true +#[build-dependencies.botan-src] -+#version = "0.21903" ++#version = "0.30101.2" +#optional = true [features] botan3 = [] default = [] no-std = [] --vendored = ["botan-src"] -+#vendored = ["botan-src"] +-vendored = [ +- "botan-src", +- "botan3", +-] ++#vendored = [ ++# "botan-src", ++# "botan3", ++#] diff -Nru rust-botan-sys-0.10.1/debian/tests/control rust-botan-sys-0.10.5/debian/tests/control --- rust-botan-sys-0.10.1/debian/tests/control 2023-06-17 08:02:26.000000000 +0000 +++ rust-botan-sys-0.10.5/debian/tests/control 2023-11-22 21:29:42.000000000 +0000 @@ -1,24 +1,24 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.1 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.5 --all-targets --all-features Features: test-name=rust-botan-sys:@ Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.1 --all-targets --no-default-features --features botan3 +Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.5 --all-targets --no-default-features --features botan3 Features: test-name=librust-botan-sys-dev:botan3 Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.1 --all-targets +Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.5 --all-targets Features: test-name=librust-botan-sys-dev:default Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.1 --all-targets --no-default-features --features no-std +Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.5 --all-targets --no-default-features --features no-std Features: test-name=librust-botan-sys-dev:no-std Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.1 --all-targets --no-default-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test botan-sys 0.10.5 --all-targets --no-default-features Features: test-name=librust-botan-sys-dev: Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-botan-sys-0.10.1/src/cipher.rs rust-botan-sys-0.10.5/src/cipher.rs --- rust-botan-sys-0.10.1/src/cipher.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/cipher.rs 2006-07-24 01:21:28.000000000 +0000 @@ -10,6 +10,13 @@ pub fn botan_cipher_get_tag_length(cipher: botan_cipher_t, tag_size: *mut usize) -> c_int; pub fn botan_cipher_get_default_nonce_length(cipher: botan_cipher_t, nl: *mut usize) -> c_int; pub fn botan_cipher_get_update_granularity(cipher: botan_cipher_t, ug: *mut usize) -> c_int; + + #[cfg(feature = "botan3")] + pub fn botan_cipher_get_ideal_update_granularity( + cipher: botan_cipher_t, + ug: *mut usize, + ) -> c_int; + pub fn botan_cipher_query_keylen( cipher: botan_cipher_t, out_minimum_keylength: *mut usize, diff -Nru rust-botan-sys-0.10.1/src/errors.rs rust-botan-sys-0.10.5/src/errors.rs --- rust-botan-sys-0.10.1/src/errors.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/errors.rs 2006-07-24 01:21:28.000000000 +0000 @@ -9,6 +9,7 @@ pub const BOTAN_FFI_ERROR_INVALID_INPUT: BOTAN_FFI_ERROR = -1; pub const BOTAN_FFI_ERROR_BAD_MAC: BOTAN_FFI_ERROR = -2; pub const BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE: BOTAN_FFI_ERROR = -10; +pub const BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR: BOTAN_FFI_ERROR = -11; pub const BOTAN_FFI_ERROR_EXCEPTION_THROWN: BOTAN_FFI_ERROR = -20; pub const BOTAN_FFI_ERROR_OUT_OF_MEMORY: BOTAN_FFI_ERROR = -21; pub const BOTAN_FFI_ERROR_SYSTEM_ERROR: BOTAN_FFI_ERROR = -22; diff -Nru rust-botan-sys-0.10.1/src/lib.rs rust-botan-sys-0.10.5/src/lib.rs --- rust-botan-sys-0.10.1/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 @@ -26,6 +26,17 @@ #[cfg(not(feature = "no-std"))] pub use std::os::raw::{c_char, c_int, c_uint, c_void}; + + #[cfg(feature = "botan3")] + pub type botan_view_ctx = *mut c_void; + + #[cfg(feature = "botan3")] + pub type botan_view_bin_fn = + extern "C" fn(view_ctx: botan_view_ctx, data: *const u8, len: usize) -> c_int; + + #[cfg(feature = "botan3")] + pub type botan_view_str_fn = + extern "C" fn(view_ctx: botan_view_ctx, data: *const c_char, len: usize) -> c_int; } pub use block::*; diff -Nru rust-botan-sys-0.10.1/src/pk_ops.rs rust-botan-sys-0.10.5/src/pk_ops.rs --- rust-botan-sys-0.10.1/src/pk_ops.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/pk_ops.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,4 +1,4 @@ -use crate::ffi_types::{c_char, c_int}; +use crate::ffi_types::*; use crate::pubkey::{botan_privkey_t, botan_pubkey_t}; use crate::rng::botan_rng_t; @@ -18,6 +18,12 @@ pub enum botan_pk_op_ka_struct {} pub type botan_pk_op_ka_t = *mut botan_pk_op_ka_struct; +pub enum botan_pk_op_kem_encrypt_struct {} +pub type botan_pk_op_kem_encrypt_t = *mut botan_pk_op_kem_encrypt_struct; + +pub enum botan_pk_op_kem_decrypt_struct {} +pub type botan_pk_op_kem_decrypt_t = *mut botan_pk_op_kem_decrypt_struct; + extern "C" { pub fn botan_pk_op_encrypt_create( op: *mut botan_pk_op_encrypt_t, @@ -109,6 +115,7 @@ out: *mut u8, out_len: *mut usize, ) -> c_int; + pub fn botan_pk_op_key_agreement( op: botan_pk_op_ka_t, out: *mut u8, @@ -123,5 +130,69 @@ pkcs_id: *mut u8, pkcs_id_len: *mut usize, ) -> c_int; +} + +#[cfg(feature = "botan3")] +extern "C" { + pub fn botan_pk_op_key_agreement_view_public( + key: botan_privkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + pub fn botan_pk_op_kem_encrypt_create( + op: *mut botan_pk_op_kem_encrypt_t, + key: botan_pubkey_t, + kdf: *const c_char, + ) -> c_int; + + pub fn botan_pk_op_kem_encrypt_destroy(op: botan_pk_op_kem_encrypt_t) -> c_int; + + pub fn botan_pk_op_kem_encrypt_shared_key_length( + op: botan_pk_op_kem_encrypt_t, + desired_shared_key_length: usize, + output_shared_key_length: *mut usize, + ) -> c_int; + + pub fn botan_pk_op_kem_encrypt_encapsulated_key_length( + op: botan_pk_op_kem_encrypt_t, + output_encapsulated_key_length: *mut usize, + ) -> c_int; + + pub fn botan_pk_op_kem_encrypt_create_shared_key( + op: botan_pk_op_kem_encrypt_t, + rng: botan_rng_t, + salt: *const u8, + salt_len: usize, + desired_shared_key_len: usize, + shared_key: *mut u8, + shared_key_len: *mut usize, + encapsulated_key: *mut u8, + encapsulated_key_len: *mut usize, + ) -> c_int; + + pub fn botan_pk_op_kem_decrypt_destroy(op: botan_pk_op_kem_decrypt_t) -> c_int; + + pub fn botan_pk_op_kem_decrypt_create( + op: *mut botan_pk_op_kem_decrypt_t, + key: botan_privkey_t, + kdf: *const c_char, + ) -> c_int; + + pub fn botan_pk_op_kem_decrypt_shared_key_length( + op: botan_pk_op_kem_decrypt_t, + desired_shared_key_length: usize, + output_shared_key_length: *mut usize, + ) -> c_int; + pub fn botan_pk_op_kem_decrypt_shared_key( + op: botan_pk_op_kem_decrypt_t, + salt: *const u8, + salt_len: usize, + encapsulated_key: *const u8, + encapsulated_key_len: usize, + desired_shared_key_len: usize, + shared_key: *mut u8, + shared_key_len: *mut usize, + ) -> c_int; } diff -Nru rust-botan-sys-0.10.1/src/pubkey.rs rust-botan-sys-0.10.5/src/pubkey.rs --- rust-botan-sys-0.10.1/src/pubkey.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/pubkey.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,4 +1,4 @@ -use crate::ffi_types::{c_char, c_int}; +use crate::ffi_types::*; use crate::mp::botan_mp_t; use crate::rng::botan_rng_t; @@ -263,3 +263,58 @@ key: botan_pubkey_t, ) -> c_int; } + +#[cfg(feature = "botan3")] +extern "C" { + pub fn botan_pubkey_view_der( + key: botan_pubkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + pub fn botan_pubkey_view_pem( + key: botan_pubkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_str_fn, + ) -> c_int; + + pub fn botan_privkey_view_der( + key: botan_privkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + pub fn botan_privkey_view_pem( + key: botan_privkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_str_fn, + ) -> c_int; + + pub fn botan_pubkey_view_ec_public_point( + key: botan_pubkey_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + pub fn botan_privkey_view_encrypted_der( + key: botan_privkey_t, + rng: botan_rng_t, + passphrase: *const c_char, + cipher_algo: *const c_char, + pbkdf_algo: *const c_char, + pbkdf_iterations: usize, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + pub fn botan_privkey_view_encrypted_pem( + key: botan_privkey_t, + rng: botan_rng_t, + passphrase: *const c_char, + cipher_algo: *const c_char, + pbkdf_algo: *const c_char, + pbkdf_iterations: usize, + view_ctx: botan_view_ctx, + view_fn: botan_view_str_fn, + ) -> c_int; +} diff -Nru rust-botan-sys-0.10.1/src/x509.rs rust-botan-sys-0.10.5/src/x509.rs --- rust-botan-sys-0.10.1/src/x509.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/x509.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,4 +1,4 @@ -use crate::ffi_types::{c_char, c_int, c_uint}; +use crate::ffi_types::*; use crate::pubkey::{botan_privkey_t, botan_pubkey_t}; use crate::rng::botan_rng_t; @@ -6,6 +6,9 @@ pub enum botan_x509_cert_struct {} pub type botan_x509_cert_t = *mut botan_x509_cert_struct; +pub enum botan_x509_crl_struct {} +pub type botan_x509_crl_t = *mut botan_x509_crl_struct; + #[repr(u32)] #[allow(clippy::upper_case_acronyms)] pub enum X509KeyConstraints { @@ -120,4 +123,33 @@ ) -> c_int; pub fn botan_x509_cert_validation_status(code: c_int) -> *const c_char; + + #[cfg(feature = "botan3")] + pub fn botan_x509_cert_view_public_key_bits( + cert: botan_x509_cert_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_bin_fn, + ) -> c_int; + + #[cfg(feature = "botan3")] + pub fn botan_x509_cert_view_as_string( + cert: botan_x509_cert_t, + view_ctx: botan_view_ctx, + view_fn: botan_view_str_fn, + ) -> c_int; + + pub fn botan_x509_crl_load_file(crl: *mut botan_x509_crl_t, file_path: *const c_char) -> c_int; + + pub fn botan_x509_crl_load( + crl: *mut botan_x509_crl_t, + data: *const u8, + data_len: usize, + ) -> c_int; + + pub fn botan_x509_crl_destroy(crl: botan_x509_crl_t) -> c_int; + + pub fn botan_x509_is_revoked(crl: botan_x509_crl_t, cert: botan_x509_cert_t) -> c_int; + + // TODO: botan_x509_cert_verify_with_crl + } diff -Nru rust-botan-sys-0.10.1/src/zfec.rs rust-botan-sys-0.10.5/src/zfec.rs --- rust-botan-sys-0.10.1/src/zfec.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/src/zfec.rs 2006-07-24 01:21:28.000000000 +0000 @@ -7,7 +7,7 @@ input: *const u8, input_len: usize, outputs: *mut *mut u8, - ) -> core::ffi::c_int; + ) -> crate::ffi_types::c_int; #[cfg(feature = "botan3")] pub fn botan_zfec_decode( @@ -17,5 +17,5 @@ shares: *const *const u8, share_size: usize, outputs: *mut *mut u8, - ) -> core::ffi::c_int; + ) -> crate::ffi_types::c_int; } diff -Nru rust-botan-sys-0.10.1/tests/tests.rs rust-botan-sys-0.10.5/tests/tests.rs --- rust-botan-sys-0.10.1/tests/tests.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-botan-sys-0.10.5/tests/tests.rs 2006-07-24 01:21:28.000000000 +0000 @@ -82,8 +82,11 @@ #[cfg(not(feature = "botan3"))] { - assert_eq!(botan_version_major(), 2); - assert!(botan_version_minor() > 8); + if botan_version_major() == 2 { + assert!(botan_version_minor() > 8); + } else { + assert_eq!(botan_version_major(), 3); + } } } }