This removes the need to hand-write rust_wrapper.c, because bindgen can generate it for us. bindgen 0.65 or later is needed. Earlier versions of this were buggy. I've also removed the claim that bssl-sys is somehow a solution for version skew. That was the original thinking from Android, but it hasn't worked out. The version skew solution is simply "use bindgen, don't handwrite bindings". Android are quite behind their originaly July timeline for adding the build half of this mechanism, but as this is now in the way of other work, we're going to proceed with using this now. There is now a unsupported_inline_wrappers cfg that Android can set to use the old mechanism. Update-Note: Rust support now requires your build correctly handle --wrap-static-fns. On Android, you will need to enable the unsupported_inline_wrappers cfg option until b/290347127 is fixed. Chromium doesn't actually use any of the inline functions yet, so we can handle --wrap-static-fns asynchronously, but I have a CL ready to enable that. Fixed: 596 Change-Id: I51fd1108a8c17a06f1bdd9171ebf352cea871723 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58985 Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com>
40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
/* Copyright (c) 2022, Google Inc.
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
|
|
#ifndef OPENSSL_HEADER_RUST_WRAPPER_H
|
|
#define OPENSSL_HEADER_RUST_WRAPPER_H
|
|
|
|
#include <openssl/err.h>
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
// The following functions are wrappers over inline functions and macros in
|
|
// BoringSSL. These are not necessary, as bindgen has long supported
|
|
// --wrap-static-fns, however Android is still missing support for this. (See
|
|
// b/290347127.) These manual wrappers are, temporarily, retained for Android,
|
|
// but this codepath is no longer tested or supported by BoringSSL.
|
|
int ERR_GET_LIB_RUST(uint32_t packed_error);
|
|
int ERR_GET_REASON_RUST(uint32_t packed_error);
|
|
int ERR_GET_FUNC_RUST(uint32_t packed_error);
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
} // extern C
|
|
#endif
|
|
|
|
#endif // OPENSSL_HEADER_RUST_WRAPPER_H
|