1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <stdbool.h> 20 #include <stddef.h> 21 #include <sys/cdefs.h> 22 23 #include "vm_payload.h" 24 25 // The functions declared here are restricted to VMs created with a config file; 26 // they will fail if called in other VMs. The ability to create such VMs 27 // requires the android.permission.USE_CUSTOM_VIRTUAL_MACHINE permission, and is 28 // therefore not available to privileged or third party apps. 29 30 // These functions can be used by tests, if the permission is granted via shell. 31 32 __BEGIN_DECLS 33 34 /** 35 * Get the VM's DICE attestation chain. 36 * 37 * \param data pointer to size bytes where the chain is written (may be null if size is 0). 38 * \param size number of bytes that can be written to data. 39 * 40 * \return the total size of the chain 41 */ 42 size_t AVmPayload_getDiceAttestationChain(void* _Nullable data, size_t size); 43 44 /** 45 * Get the VM's DICE attestation CDI. 46 * 47 * \param data pointer to size bytes where the CDI is written (may be null if size is 0). 48 * \param size number of bytes that can be written to data. 49 * 50 * \return the total size of the CDI 51 */ 52 size_t AVmPayload_getDiceAttestationCdi(void* _Nullable data, size_t size); 53 54 __END_DECLS 55