1diff --git a/.cargo/config.toml b/.cargo/config.toml 2new file mode 100644 3index 0000000..e2b197d 4--- /dev/null 5+++ b/.cargo/config.toml 6@@ -0,0 +1,2 @@ 7+[patch.crates-io] 8+bssl-sys = { version = "0.1.0", path = "../../../boringssl/src/rust/bssl-sys", optional=true } 9diff --git a/src/cipher.rs b/src/cipher.rs 10index ab5f49d..84a8265 100644 11--- a/src/cipher.rs 12+++ b/src/cipher.rs 13@@ -208,6 +208,7 @@ impl Cipher { 14 unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_cfb1() as *mut _) } 15 } 16 17+ #[cfg(not(boringssl))] 18 pub fn aes_192_cfb128() -> &'static CipherRef { 19 unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_cfb128() as *mut _) } 20 } 21@@ -253,6 +254,7 @@ impl Cipher { 22 unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_cfb1() as *mut _) } 23 } 24 25+ #[cfg(not(boringssl))] 26 pub fn aes_256_cfb128() -> &'static CipherRef { 27 unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_cfb128() as *mut _) } 28 } 29@@ -282,11 +284,13 @@ impl Cipher { 30 } 31 32 #[cfg(not(osslconf = "OPENSSL_NO_BF"))] 33+ #[cfg(not(boringssl))] 34 pub fn bf_cbc() -> &'static CipherRef { 35 unsafe { CipherRef::from_ptr(ffi::EVP_bf_cbc() as *mut _) } 36 } 37 38 #[cfg(not(osslconf = "OPENSSL_NO_BF"))] 39+ #[cfg(not(boringssl))] 40 pub fn bf_ecb() -> &'static CipherRef { 41 unsafe { CipherRef::from_ptr(ffi::EVP_bf_ecb() as *mut _) } 42 } 43diff --git a/src/encrypt.rs b/src/encrypt.rs 44index 3cb10fc..34a9eb8 100644 45--- a/src/encrypt.rs 46+++ b/src/encrypt.rs 47@@ -148,7 +148,7 @@ impl<'a> Encrypter<'a> { 48 /// This corresponds to [`EVP_PKEY_CTX_set_rsa_oaep_md`]. 49 /// 50 /// [`EVP_PKEY_CTX_set_rsa_oaep_md`]: https://www.openssl.org/docs/manmaster/man3/EVP_PKEY_CTX_set_rsa_oaep_md.html 51- #[cfg(any(ossl102, libressl310))] 52+ #[cfg(any(ossl102, libressl310, boringssl))] 53 pub fn set_rsa_oaep_md(&mut self, md: MessageDigest) -> Result<(), ErrorStack> { 54 unsafe { 55 cvt(ffi::EVP_PKEY_CTX_set_rsa_oaep_md( 56@@ -352,7 +352,7 @@ impl<'a> Decrypter<'a> { 57 /// This corresponds to [`EVP_PKEY_CTX_set_rsa_oaep_md`]. 58 /// 59 /// [`EVP_PKEY_CTX_set_rsa_oaep_md`]: https://www.openssl.org/docs/manmaster/man3/EVP_PKEY_CTX_set_rsa_oaep_md.html 60- #[cfg(any(ossl102, libressl310))] 61+ #[cfg(any(ossl102, libressl310, boringssl))] 62 pub fn set_rsa_oaep_md(&mut self, md: MessageDigest) -> Result<(), ErrorStack> { 63 unsafe { 64 cvt(ffi::EVP_PKEY_CTX_set_rsa_oaep_md( 65diff --git a/src/lib.rs b/src/lib.rs 66index 891651e..f149bfd 100644 67--- a/src/lib.rs 68+++ b/src/lib.rs 69@@ -120,6 +120,9 @@ 70 #![doc(html_root_url = "https://docs.rs/openssl/0.10")] 71 #![warn(rust_2018_idioms)] 72 73+#[cfg(all(soong, boringssl))] 74+extern crate bssl_sys as ffi; 75+ 76 #[doc(inline)] 77 pub use ffi::init; 78 79@@ -155,6 +158,10 @@ pub mod ex_data; 80 #[cfg(not(any(libressl, ossl300)))] 81 pub mod fips; 82 pub mod hash; 83+#[cfg(boringssl)] 84+pub mod hkdf; 85+#[cfg(boringssl)] 86+pub mod hmac; 87 #[cfg(ossl300)] 88 pub mod lib_ctx; 89 pub mod md; 90diff --git a/src/symm.rs b/src/symm.rs 91index c75bbc0..beff5fc 100644 92--- a/src/symm.rs 93+++ b/src/symm.rs 94@@ -119,6 +119,7 @@ impl Cipher { 95 unsafe { Cipher(ffi::EVP_aes_128_cfb1()) } 96 } 97 98+ #[cfg(not(boringssl))] 99 pub fn aes_128_cfb128() -> Cipher { 100 unsafe { Cipher(ffi::EVP_aes_128_cfb128()) } 101 } 102@@ -164,6 +165,7 @@ impl Cipher { 103 unsafe { Cipher(ffi::EVP_aes_192_cfb1()) } 104 } 105 106+ #[cfg(not(boringssl))] 107 pub fn aes_192_cfb128() -> Cipher { 108 unsafe { Cipher(ffi::EVP_aes_192_cfb128()) } 109 } 110@@ -214,6 +216,7 @@ impl Cipher { 111 unsafe { Cipher(ffi::EVP_aes_256_cfb1()) } 112 } 113 114+ #[cfg(not(boringssl))] 115 pub fn aes_256_cfb128() -> Cipher { 116 unsafe { Cipher(ffi::EVP_aes_256_cfb128()) } 117 } 118@@ -242,12 +245,12 @@ impl Cipher { 119 unsafe { Cipher(ffi::EVP_aes_256_ocb()) } 120 } 121 122- #[cfg(not(osslconf = "OPENSSL_NO_BF"))] 123+ #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_BF")))] 124 pub fn bf_cbc() -> Cipher { 125 unsafe { Cipher(ffi::EVP_bf_cbc()) } 126 } 127 128- #[cfg(not(osslconf = "OPENSSL_NO_BF"))] 129+ #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_BF")))] 130 pub fn bf_ecb() -> Cipher { 131 unsafe { Cipher(ffi::EVP_bf_ecb()) } 132 } 133