[pvmfw] Use AEAD wrapper from libbssl_avf
This cl replaces the AEAD bssl wrappers in pvmfw with the ones in
libbssl_avf. The wrappers in libbssl_avf have undergone thorough
testing, and the context is cleaned and freed when it is dropped.
This cl decreases the size of pvmfw.bin from 532512 bytes to
511648 bytes.
Bug: 302286887
Test: atest MicrodroidHostTests
Change-Id: Iba12469410dd1069fb9c48b666010ff158cc1327
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index ed73bc9..65c8f26 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -15,9 +15,9 @@
//! Low-level entry and exit points of pvmfw.
use crate::config;
-use crate::crypto;
use crate::fdt;
use crate::memory;
+use bssl_ffi::CRYPTO_library_init;
use core::arch::asm;
use core::mem::{drop, size_of};
use core::num::NonZeroUsize;
@@ -196,7 +196,12 @@
// - only access non-pvmfw memory once (and while) it has been mapped
log::set_max_level(LevelFilter::Info);
- crypto::init();
+ // TODO(https://crbug.com/boringssl/35): Remove this init when BoringSSL can handle this
+ // internally.
+ // SAFETY: Configures the internal state of the library - may be called multiple times.
+ unsafe {
+ CRYPTO_library_init();
+ }
let page_table = memory::init_page_table().map_err(|e| {
error!("Failed to set up the dynamic page tables: {e}");