[rust] Add Ed25519/X25519 symbols
SEC-98
Change-Id: Iad5a189afd02bed0baa88c068dbab27af487a276
diff --git a/rust/boringssl-sys/bindgen.sh b/rust/boringssl-sys/bindgen.sh
index 3903631..65e0257 100755
--- a/rust/boringssl-sys/bindgen.sh
+++ b/rust/boringssl-sys/bindgen.sh
@@ -27,7 +27,7 @@
# Whitelist BoringSSL-related symbols so we don't get non-BoringSSL symbols such
# as platform-specific symbols (specific to the platform that is running
# 'bindgen') and other C standard library symbols.
-WHITELIST="(ERR|BIO|CRYPTO|RAND|V_ASN1|ASN1|B_ASN1|CBS_ASN1|CAST|EVP|CBS|CBB|CIPHER|OPENSSL|SSLEAY|DH|DES|DIGEST|DSA|NID|EC|ECDSA|ECDH|SHA|SHA1|SHA224|SHA256|SHA384|SHA512|HMAC)_.*"
+WHITELIST="(ERR|BIO|CRYPTO|RAND|V_ASN1|ASN1|B_ASN1|CBS_ASN1|CAST|EVP|CBS|CBB|CIPHER|OPENSSL|SSLEAY|DH|DES|DIGEST|DSA|NID|EC|ECDSA|ECDH|ED25519|X25519|SHA|SHA1|SHA224|SHA256|SHA384|SHA512|HMAC)_.*"
# NOTE(joshlf) on --target: Currently, we just pass x86_64 since none of the
# symbols we're linking against are architecture-specific (they may be
# word-size-specific, but Fuchsia only targets 64-bit platforms). If this ever
diff --git a/rust/boringssl-sys/src/lib.rs b/rust/boringssl-sys/src/lib.rs
index 620ff73..65dfdfd 100644
--- a/rust/boringssl-sys/src/lib.rs
+++ b/rust/boringssl-sys/src/lib.rs
@@ -6,8 +6,7 @@
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
-#[link(name = "crypto")]
-extern "C" {}
+#[link(name = "crypto")] extern {}
/* automatically generated by rust-bindgen */
@@ -600,6 +599,12 @@
pub const OPENSSL_INIT_NO_ADD_ALL_DIGESTS: u32 = 0;
pub const OPENSSL_INIT_LOAD_CONFIG: u32 = 0;
pub const OPENSSL_INIT_NO_LOAD_CONFIG: u32 = 0;
+pub const X25519_PRIVATE_KEY_LEN: u32 = 32;
+pub const X25519_PUBLIC_VALUE_LEN: u32 = 32;
+pub const X25519_SHARED_KEY_LEN: u32 = 32;
+pub const ED25519_PRIVATE_KEY_LEN: u32 = 64;
+pub const ED25519_PUBLIC_KEY_LEN: u32 = 32;
+pub const ED25519_SIGNATURE_LEN: u32 = 64;
pub const DES_ENCRYPT: u32 = 1;
pub const DES_DECRYPT: u32 = 0;
pub const DES_CBC_MODE: u32 = 0;
@@ -7688,6 +7693,38 @@
settings: *const OPENSSL_INIT_SETTINGS,
) -> ::std::os::raw::c_int;
}
+extern "C" {
+ pub fn X25519_keypair(out_public_value: *mut u8, out_private_key: *mut u8);
+}
+extern "C" {
+ pub fn X25519_public_from_private(out_public_value: *mut u8, private_key: *const u8);
+}
+extern "C" {
+ pub fn ED25519_keypair(out_public_key: *mut u8, out_private_key: *mut u8);
+}
+extern "C" {
+ pub fn ED25519_sign(
+ out_sig: *mut u8,
+ message: *const u8,
+ message_len: usize,
+ private_key: *const u8,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ED25519_verify(
+ message: *const u8,
+ message_len: usize,
+ signature: *const u8,
+ public_key: *const u8,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ED25519_keypair_from_seed(
+ out_public_key: *mut u8,
+ out_private_key: *mut u8,
+ seed: *const u8,
+ );
+}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DES_cblock_st {