xref: /aosp_15_r20/system/keymint/boringssl/src/tests.rs (revision 9860b7637a5f185913c70aa0caabe3ecb78441e4)
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 use super::*;
16 
17 // Inject the BoringSSL-based implementations of crypto traits into the smoke tests from
18 // `kmr_tests`.
19 
20 #[test]
test_rng()21 fn test_rng() {
22     let mut rng = rng::BoringRng;
23     kmr_tests::test_rng(&mut rng);
24 }
25 
26 #[test]
test_eq()27 fn test_eq() {
28     let comparator = eq::BoringEq;
29     kmr_tests::test_eq(comparator);
30 }
31 
32 #[test]
test_hkdf()33 fn test_hkdf() {
34     kmr_tests::test_hkdf(hmac::BoringHmac {});
35 }
36 
37 #[test]
test_hmac()38 fn test_hmac() {
39     kmr_tests::test_hmac(hmac::BoringHmac {});
40 }
41 
42 #[cfg(soong)]
43 #[test]
test_aes_cmac()44 fn test_aes_cmac() {
45     kmr_tests::test_aes_cmac(aes_cmac::BoringAesCmac {});
46 }
47 
48 #[cfg(soong)]
49 #[test]
test_ckdf()50 fn test_ckdf() {
51     kmr_tests::test_ckdf(aes_cmac::BoringAesCmac {});
52 }
53 
54 #[test]
test_aes_gcm()55 fn test_aes_gcm() {
56     kmr_tests::test_aes_gcm(aes::BoringAes {});
57 }
58 
59 #[test]
test_des()60 fn test_des() {
61     kmr_tests::test_des(des::BoringDes {});
62 }
63 
64 #[test]
test_sha256()65 fn test_sha256() {
66     kmr_tests::test_sha256(sha256::BoringSha256 {});
67 }
68