• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 4a7246ed78e8845dd2ac5477fb4abd490a83f6eb Mon Sep 17 00:00:00 2001
2From: Maurice Lam <yukl@google.com>
3Date: Thu, 2 Feb 2023 19:21:46 +0000
4Subject: [PATCH 2/3] Make openssl buildable
5
6---
7 openssl/src/bio.rs | 9 +++++++--
8 openssl/src/dh.rs  | 2 +-
9 2 files changed, 8 insertions(+), 3 deletions(-)
10
11diff --git a/openssl/src/bio.rs b/openssl/src/bio.rs
12index 6a72552a..5007d677 100644
13--- a/openssl/src/bio.rs
14+++ b/openssl/src/bio.rs
15@@ -7,6 +7,11 @@ use std::slice;
16 use crate::cvt_p;
17 use crate::error::ErrorStack;
18
19+#[cfg(boringssl)]
20+type SignedLenType = libc::ssize_t;
21+#[cfg(not(boringssl))]
22+type SignedLenType = libc::c_int;
23+
24 pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>);
25
26 impl<'a> Drop for MemBioSlice<'a> {
27@@ -25,7 +30,7 @@ impl<'a> MemBioSlice<'a> {
28         let bio = unsafe {
29             cvt_p(BIO_new_mem_buf(
30                 buf.as_ptr() as *const _,
31-                buf.len() as c_int,
32+                buf.len() as SignedLenType,
33             ))?
34         };
35
36@@ -78,7 +83,7 @@ cfg_if! {
37         use ffi::BIO_new_mem_buf;
38     } else {
39         #[allow(bad_style)]
40-        unsafe fn BIO_new_mem_buf(buf: *const ::libc::c_void, len: ::libc::c_int) -> *mut ffi::BIO {
41+        unsafe fn BIO_new_mem_buf(buf: *const ::libc::c_void, len: SignedLenType) -> *mut ffi::BIO {
42             ffi::BIO_new_mem_buf(buf as *mut _, len)
43         }
44     }
45diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs
46index 12170b99..e781543e 100644
47--- a/openssl/src/dh.rs
48+++ b/openssl/src/dh.rs
49@@ -239,7 +239,7 @@ where
50 }
51
52 cfg_if! {
53-    if #[cfg(any(ossl110, libressl270))] {
54+    if #[cfg(any(ossl110, libressl270, boringssl))] {
55         use ffi::{DH_set0_pqg, DH_get0_pqg, DH_get0_key, DH_set0_key};
56     } else {
57         #[allow(bad_style)]
58--
592.39.1.519.gcb327c4b5f-goog
60
61