Make the old sk_* functions into full functions
Due to b/290792019 and b/290785937, we need them to actually exist at
the original symbols. For all of Rust's language-level safety benefits,
the ecosystem seems determined to undo it with patterns that are even
less safe than C.
This is not great and the bugs need to be fixed, but do this for now to
unblock the Android update.
Change-Id: Ia883336879779f652e7320cecdd5ca843996f6a3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61525
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c
index 6b4f8bc..0bb5041 100644
--- a/crypto/stack/stack.c
+++ b/crypto/stack/stack.c
@@ -518,3 +518,17 @@
return ret;
}
+
+OPENSSL_STACK *sk_new_null(void) { return OPENSSL_sk_new_null(); }
+
+size_t sk_num(const OPENSSL_STACK *sk) { return OPENSSL_sk_num(sk); }
+
+void *sk_value(const OPENSSL_STACK *sk, size_t i) {
+ return OPENSSL_sk_value(sk, i);
+}
+
+void sk_free(OPENSSL_STACK *sk) { OPENSSL_sk_free(sk); }
+
+size_t sk_push(OPENSSL_STACK *sk, void *p) { return OPENSSL_sk_push(sk, p); }
+
+void *sk_pop(OPENSSL_STACK *sk) { return OPENSSL_sk_pop(sk); }
diff --git a/include/openssl/stack.h b/include/openssl/stack.h
index 7d5d4d7..812bccf 100644
--- a/include/openssl/stack.h
+++ b/include/openssl/stack.h
@@ -330,28 +330,19 @@
//
// TODO(crbug.com/boringssl/499): Migrate callers to the typed wrappers, or at
// least the new names and remove the old ones.
+//
+// TODO(b/290792019, b/290785937): Ideally these would at least be inline
+// functions, so we do not squat the symbols.
typedef OPENSSL_STACK _STACK;
-OPENSSL_INLINE OPENSSL_STACK *sk_new_null(void) {
- return OPENSSL_sk_new_null();
-}
-
-OPENSSL_INLINE size_t sk_num(const OPENSSL_STACK *sk) {
- return OPENSSL_sk_num(sk);
-}
-
-OPENSSL_INLINE void *sk_value(const OPENSSL_STACK *sk, size_t i) {
- return OPENSSL_sk_value(sk, i);
-}
-
-OPENSSL_INLINE void sk_free(OPENSSL_STACK *sk) { OPENSSL_sk_free(sk); }
-
-OPENSSL_INLINE size_t sk_push(OPENSSL_STACK *sk, void *p) {
- return OPENSSL_sk_push(sk, p);
-}
-
-OPENSSL_INLINE void *sk_pop(OPENSSL_STACK *sk) { return OPENSSL_sk_pop(sk); }
+// The following functions call the corresponding |OPENSSL_sk_*| function.
+OPENSSL_EXPORT OPENSSL_STACK *sk_new_null(void);
+OPENSSL_EXPORT size_t sk_num(const OPENSSL_STACK *sk);
+OPENSSL_EXPORT void *sk_value(const OPENSSL_STACK *sk, size_t i);
+OPENSSL_EXPORT void sk_free(OPENSSL_STACK *sk);
+OPENSSL_EXPORT size_t sk_push(OPENSSL_STACK *sk, void *p);
+OPENSSL_EXPORT void *sk_pop(OPENSSL_STACK *sk);
// sk_pop_free behaves like |sk_pop_free_ex| but performs an invalid function
// pointer cast. It exists because some existing callers called |sk_pop_free|
diff --git a/rust/bssl-sys/src/lib.rs b/rust/bssl-sys/src/lib.rs
index 3b37110..06b907c 100644
--- a/rust/bssl-sys/src/lib.rs
+++ b/rust/bssl-sys/src/lib.rs
@@ -18,13 +18,6 @@
unsafe { ERR_GET_FUNC_RUST(packed_error) }
}
-pub use OPENSSL_sk_free as sk_free;
-pub use OPENSSL_sk_new_null as sk_new_null;
-pub use OPENSSL_sk_num as sk_num;
-pub use OPENSSL_sk_pop as sk_pop;
-pub use OPENSSL_sk_push as sk_push;
-pub use OPENSSL_sk_value as sk_value;
-
pub fn init() {
unsafe {
CRYPTO_library_init();