From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/openssl-sys/src/evp.rs | 17 ++++++++++ vendor/openssl-sys/src/handwritten/bio.rs | 1 + vendor/openssl-sys/src/handwritten/bn.rs | 9 ++++++ vendor/openssl-sys/src/handwritten/ec.rs | 14 ++++++++ vendor/openssl-sys/src/handwritten/evp.rs | 44 ++++++++++++++++---------- vendor/openssl-sys/src/handwritten/mod.rs | 4 +++ vendor/openssl-sys/src/handwritten/poly1305.rs | 23 ++++++++++++++ vendor/openssl-sys/src/handwritten/x509_vfy.rs | 6 ++++ vendor/openssl-sys/src/rsa.rs | 2 +- 9 files changed, 102 insertions(+), 18 deletions(-) create mode 100644 vendor/openssl-sys/src/handwritten/poly1305.rs (limited to 'vendor/openssl-sys/src') diff --git a/vendor/openssl-sys/src/evp.rs b/vendor/openssl-sys/src/evp.rs index 56eaa4bbf..d2ca21540 100644 --- a/vendor/openssl-sys/src/evp.rs +++ b/vendor/openssl-sys/src/evp.rs @@ -27,6 +27,9 @@ pub const EVP_PKEY_POLY1305: c_int = NID_poly1305; #[cfg(ossl110)] pub const EVP_PKEY_HKDF: c_int = NID_hkdf; +#[cfg(ossl102)] +pub const EVP_CIPHER_CTX_FLAG_WRAP_ALLOW: c_int = 0x1; + pub const EVP_CTRL_GCM_SET_IVLEN: c_int = 0x9; pub const EVP_CTRL_GCM_GET_TAG: c_int = 0x10; pub const EVP_CTRL_GCM_SET_TAG: c_int = 0x11; @@ -186,6 +189,8 @@ pub const EVP_PKEY_OP_TYPE_SIG: c_int = EVP_PKEY_OP_SIGN pub const EVP_PKEY_OP_TYPE_CRYPT: c_int = EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT; +pub const EVP_PKEY_CTRL_MD: c_int = 1; + pub const EVP_PKEY_CTRL_SET_MAC_KEY: c_int = 6; pub const EVP_PKEY_CTRL_CIPHER: c_int = 12; @@ -288,6 +293,18 @@ pub unsafe fn EVP_PKEY_CTX_add1_hkdf_info( ) } +#[cfg(all(not(ossl300), not(boringssl)))] +pub unsafe fn EVP_PKEY_CTX_set_signature_md(cxt: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int { + EVP_PKEY_CTX_ctrl( + cxt, + -1, + EVP_PKEY_OP_TYPE_SIG, + EVP_PKEY_CTRL_MD, + 0, + md as *mut c_void, + ) +} + pub unsafe fn EVP_PKEY_assign_RSA(pkey: *mut EVP_PKEY, rsa: *mut RSA) -> c_int { EVP_PKEY_assign(pkey, EVP_PKEY_RSA, rsa as *mut c_void) } diff --git a/vendor/openssl-sys/src/handwritten/bio.rs b/vendor/openssl-sys/src/handwritten/bio.rs index 7d9752225..5f65ec5e5 100644 --- a/vendor/openssl-sys/src/handwritten/bio.rs +++ b/vendor/openssl-sys/src/handwritten/bio.rs @@ -58,6 +58,7 @@ const_ptr_api! { } extern "C" { + #[cfg(not(osslconf = "OPENSSL_NO_SOCK"))] pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO; #[cfg(any(ossl110, libressl273))] diff --git a/vendor/openssl-sys/src/handwritten/bn.rs b/vendor/openssl-sys/src/handwritten/bn.rs index 5457f6171..fc42c1394 100644 --- a/vendor/openssl-sys/src/handwritten/bn.rs +++ b/vendor/openssl-sys/src/handwritten/bn.rs @@ -32,6 +32,8 @@ extern "C" { pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int); #[cfg(any(ossl110, libressl350))] pub fn BN_is_negative(b: *const BIGNUM) -> c_int; + #[cfg(any(ossl110, libressl350))] + pub fn BN_is_odd(b: *const BIGNUM) -> c_int; pub fn BN_div( dv: *mut BIGNUM, @@ -73,6 +75,13 @@ extern "C" { m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int; + #[cfg(ossl110)] + pub fn BN_mod_sqrt( + ret: *mut BIGNUM, + a: *const BIGNUM, + p: *const BIGNUM, + ctx: *mut BN_CTX, + ) -> *mut BIGNUM; pub fn BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG; pub fn BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG; diff --git a/vendor/openssl-sys/src/handwritten/ec.rs b/vendor/openssl-sys/src/handwritten/ec.rs index 182a5559a..f199bc891 100644 --- a/vendor/openssl-sys/src/handwritten/ec.rs +++ b/vendor/openssl-sys/src/handwritten/ec.rs @@ -152,6 +152,20 @@ extern "C" { ctx: *mut BN_CTX, ) -> c_int; + pub fn EC_POINT_point2hex( + group: *const EC_GROUP, + p: *const EC_POINT, + form: point_conversion_form_t, + ctx: *mut BN_CTX, + ) -> *mut c_char; + + pub fn EC_POINT_hex2point( + group: *const EC_GROUP, + s: *const c_char, + p: *mut EC_POINT, + ctx: *mut BN_CTX, + ) -> *mut EC_POINT; + pub fn EC_POINT_add( group: *const EC_GROUP, r: *mut EC_POINT, diff --git a/vendor/openssl-sys/src/handwritten/evp.rs b/vendor/openssl-sys/src/handwritten/evp.rs index 4041d8b67..e8ad6aa2d 100644 --- a/vendor/openssl-sys/src/handwritten/evp.rs +++ b/vendor/openssl-sys/src/handwritten/evp.rs @@ -271,6 +271,8 @@ const_ptr_api! { extern "C" { pub fn EVP_CIPHER_CTX_new() -> *mut EVP_CIPHER_CTX; pub fn EVP_CIPHER_CTX_free(ctx: *mut EVP_CIPHER_CTX); + pub fn EVP_CIPHER_CTX_copy(dst: *mut EVP_CIPHER_CTX, src: *const EVP_CIPHER_CTX) -> c_int; + pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int; #[cfg(ossl111)] pub fn EVP_MD_CTX_reset(ctx: *mut EVP_MD_CTX) -> c_int; @@ -283,6 +285,7 @@ extern "C" { ptr: *mut c_void, ) -> c_int; pub fn EVP_CIPHER_CTX_rand_key(ctx: *mut EVP_CIPHER_CTX, key: *mut c_uchar) -> c_int; + pub fn EVP_CIPHER_CTX_set_flags(ctx: *mut EVP_CIPHER_CTX, flags: c_int); pub fn EVP_md_null() -> *const EVP_MD; pub fn EVP_md5() -> *const EVP_MD; @@ -329,6 +332,10 @@ extern "C" { pub fn EVP_aes_128_ofb() -> *const EVP_CIPHER; #[cfg(ossl110)] pub fn EVP_aes_128_ocb() -> *const EVP_CIPHER; + #[cfg(ossl102)] + pub fn EVP_aes_128_wrap() -> *const EVP_CIPHER; + #[cfg(ossl110)] + pub fn EVP_aes_128_wrap_pad() -> *const EVP_CIPHER; pub fn EVP_aes_192_ecb() -> *const EVP_CIPHER; pub fn EVP_aes_192_cbc() -> *const EVP_CIPHER; pub fn EVP_aes_192_cfb1() -> *const EVP_CIPHER; @@ -340,6 +347,10 @@ extern "C" { pub fn EVP_aes_192_ofb() -> *const EVP_CIPHER; #[cfg(ossl110)] pub fn EVP_aes_192_ocb() -> *const EVP_CIPHER; + #[cfg(ossl102)] + pub fn EVP_aes_192_wrap() -> *const EVP_CIPHER; + #[cfg(ossl110)] + pub fn EVP_aes_192_wrap_pad() -> *const EVP_CIPHER; pub fn EVP_aes_256_ecb() -> *const EVP_CIPHER; pub fn EVP_aes_256_cbc() -> *const EVP_CIPHER; pub fn EVP_aes_256_cfb1() -> *const EVP_CIPHER; @@ -352,9 +363,13 @@ extern "C" { pub fn EVP_aes_256_ofb() -> *const EVP_CIPHER; #[cfg(ossl110)] pub fn EVP_aes_256_ocb() -> *const EVP_CIPHER; + #[cfg(ossl102)] + pub fn EVP_aes_256_wrap() -> *const EVP_CIPHER; + #[cfg(ossl110)] + pub fn EVP_aes_256_wrap_pad() -> *const EVP_CIPHER; #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn EVP_chacha20() -> *const EVP_CIPHER; - #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))] + #[cfg(all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER; #[cfg(not(osslconf = "OPENSSL_NO_SEED"))] pub fn EVP_seed_cbc() -> *const EVP_CIPHER; @@ -413,22 +428,6 @@ cfg_if! { pub fn EVP_PKEY_get_bits(key: *const EVP_PKEY) -> c_int; pub fn EVP_PKEY_get_security_bits(key: *const EVP_PKEY) -> c_int; } - - #[inline] - pub unsafe fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int { - EVP_PKEY_get_id(pkey) - } - - #[inline] - pub unsafe fn EVP_PKEY_bits(pkey: *const EVP_PKEY) -> c_int { - EVP_PKEY_get_bits(pkey) - } - - #[inline] - pub unsafe fn EVP_PKEY_security_bits(pkey: *const EVP_PKEY) -> c_int { - EVP_PKEY_get_security_bits(pkey) - } - } else { extern "C" { pub fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int; @@ -513,6 +512,9 @@ extern "C" { p2: *mut c_void, ) -> c_int; + #[cfg(ossl300)] + pub fn EVP_PKEY_CTX_set_signature_md(ctx: *mut EVP_PKEY_CTX, md: *const EVP_MD) -> c_int; + pub fn EVP_PKEY_new_mac_key( type_: c_int, e: *mut ENGINE, @@ -572,6 +574,14 @@ extern "C" { pin: *const c_uchar, pinlen: size_t, ) -> c_int; + pub fn EVP_PKEY_verify_recover_init(ctx: *mut EVP_PKEY_CTX) -> c_int; + pub fn EVP_PKEY_verify_recover( + ctx: *mut EVP_PKEY_CTX, + rout: *mut c_uchar, + routlen: *mut size_t, + sig: *const c_uchar, + siglen: size_t, + ) -> c_int; } const_ptr_api! { diff --git a/vendor/openssl-sys/src/handwritten/mod.rs b/vendor/openssl-sys/src/handwritten/mod.rs index 9c0f84450..d3adfa5a1 100644 --- a/vendor/openssl-sys/src/handwritten/mod.rs +++ b/vendor/openssl-sys/src/handwritten/mod.rs @@ -18,6 +18,8 @@ pub use self::ocsp::*; pub use self::pem::*; pub use self::pkcs12::*; pub use self::pkcs7::*; +#[cfg(libressl)] +pub use self::poly1305::*; pub use self::provider::*; pub use self::rand::*; pub use self::rsa::*; @@ -52,6 +54,8 @@ mod ocsp; mod pem; mod pkcs12; mod pkcs7; +#[cfg(libressl)] +mod poly1305; mod provider; mod rand; mod rsa; diff --git a/vendor/openssl-sys/src/handwritten/poly1305.rs b/vendor/openssl-sys/src/handwritten/poly1305.rs new file mode 100644 index 000000000..8ff22f358 --- /dev/null +++ b/vendor/openssl-sys/src/handwritten/poly1305.rs @@ -0,0 +1,23 @@ +use super::super::*; +use libc::*; + +cfg_if! { + if #[cfg(libressl)] { + #[repr(C)] + #[derive(Debug, Copy, Clone)] + pub struct poly1305_context { + pub aligner: usize, + pub opaque: [::libc::c_uchar; 136usize], + } + pub type poly1305_state = poly1305_context; + extern "C" { + pub fn CRYPTO_poly1305_init(ctx: *mut poly1305_context, key: *const ::libc::c_uchar); + pub fn CRYPTO_poly1305_update( + ctx: *mut poly1305_context, + in_: *const ::libc::c_uchar, + len: usize, + ); + pub fn CRYPTO_poly1305_finish(ctx: *mut poly1305_context, mac: *mut ::libc::c_uchar); + } + } +} diff --git a/vendor/openssl-sys/src/handwritten/x509_vfy.rs b/vendor/openssl-sys/src/handwritten/x509_vfy.rs index 9adf63fa0..a560e586d 100644 --- a/vendor/openssl-sys/src/handwritten/x509_vfy.rs +++ b/vendor/openssl-sys/src/handwritten/x509_vfy.rs @@ -118,6 +118,12 @@ extern "C" { #[cfg(any(ossl102, libressl261))] pub fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint); #[cfg(any(ossl102, libressl261))] + pub fn X509_VERIFY_PARAM_set1_email( + param: *mut X509_VERIFY_PARAM, + email: *const c_char, + emaillen: size_t, + ) -> c_int; + #[cfg(any(ossl102, libressl261))] pub fn X509_VERIFY_PARAM_set1_ip( param: *mut X509_VERIFY_PARAM, ip: *const c_uchar, diff --git a/vendor/openssl-sys/src/rsa.rs b/vendor/openssl-sys/src/rsa.rs index ff30cf1e2..64107cd6b 100644 --- a/vendor/openssl-sys/src/rsa.rs +++ b/vendor/openssl-sys/src/rsa.rs @@ -76,7 +76,7 @@ pub unsafe fn EVP_PKEY_CTX_set0_rsa_oaep_label( EVP_PKEY_OP_TYPE_CRYPT, EVP_PKEY_CTRL_RSA_OAEP_LABEL, len, - label as *mut c_void, + label, ) } -- cgit v1.2.3