1 // Copyright 2023, 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 //! Rust libavb. 16 //! 17 //! This library wraps the libavb C code with safe Rust APIs. This does not materially affect the 18 //! safety of the library itself, since the internal implementation is still C. The goal here is 19 //! instead to provide a simple way to use libavb from Rust, in order to make Rust a more 20 //! appealing option for code that may want to use libavb such as bootloaders. 21 //! 22 //! This library is [no_std] for portability. 23 24 // ANDROID: Use std to allow building as a dylib. 25 // This condition lets us make the hack to add a dependency on std for the 26 // panic_handler and eh_personality conditional on actually building a dylib. 27 #![cfg_attr(not(any(test, android_dylib)), no_std)] 28 29 mod cert; 30 mod descriptor; 31 mod error; 32 mod ops; 33 mod verify; 34 35 pub use cert::{ 36 cert_generate_unlock_challenge, cert_validate_unlock_credential, 37 cert_validate_vbmeta_public_key, CertOps, CertPermanentAttributes, CertUnlockChallenge, 38 CertUnlockCredential, CERT_PIK_VERSION_LOCATION, CERT_PSK_VERSION_LOCATION, SHA256_DIGEST_SIZE, 39 }; 40 pub use descriptor::{ 41 ChainPartitionDescriptor, ChainPartitionDescriptorFlags, Descriptor, DescriptorError, 42 DescriptorResult, HashDescriptor, HashDescriptorFlags, HashtreeDescriptor, 43 HashtreeDescriptorFlags, KernelCommandlineDescriptor, KernelCommandlineDescriptorFlags, 44 PropertyDescriptor, 45 }; 46 pub use error::{ 47 IoError, IoResult, SlotVerifyError, SlotVerifyNoDataResult, SlotVerifyResult, 48 VbmetaVerifyError, VbmetaVerifyResult, 49 }; 50 pub use ops::{Ops, PublicKeyForPartitionInfo}; 51 pub use verify::{ 52 slot_verify, HashtreeErrorMode, PartitionData, SlotVerifyData, SlotVerifyFlags, VbmetaData, 53 }; 54