1 // Copyright 2022, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! Native helper for compos_verify to call boringssl.
16 
17 pub use native::*;
18 
19 #[cxx::bridge]
20 mod native {
21     unsafe extern "C++" {
22         include!("verify_native.h");
23 
24         // SAFETY: The C++ implementation manages its own memory, and does not retain or abuse
25         // the references passed to it.
26 
27         /// Verify a PureEd25519 signature with the specified public key on the given data,
28         /// returning whether the signature is valid or not.
verify(public_key: &[u8], signature: &[u8], data: &[u8]) -> bool29         fn verify(public_key: &[u8], signature: &[u8], data: &[u8]) -> bool;
30     }
31 }
32