1 /* 2 * Copyright 2017 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 #ifndef LIBATAP_H_ 18 #define LIBATAP_H_ 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /* Library users only need to include this file to integrate with the 25 * Android Things Attestation Provisioning reference library. 26 */ 27 28 #include "atap_ops.h" 29 #include "atap_sysdeps.h" 30 #include "atap_types.h" 31 #include "atap_util.h" 32 33 /* 34 * Parses |operation_start_size| bytes from |operation_start| and 35 * constructs a request for the Android Things CA. Number of bytes 36 * allocated for the CA Request message is written to 37 * |*ca_request_size_p|, and caller takes ownership of |*ca_request_p|, 38 * and must free with atap_free(). On success, returns ATAP_RESULT_OK. 39 */ 40 AtapResult atap_get_ca_request(AtapOps* ops, 41 const uint8_t* operation_start, 42 uint32_t operation_start_size, 43 uint8_t** ca_request_p, 44 uint32_t* ca_request_size_p); 45 /* 46 * Stores product keys issued/certified by the Android Things CA. 47 * |ca_response| contains |ca_response_size| bytes of the CA Response 48 * message, which holds the encrypted product certificate chains and 49 * (optionally) keys. On success, returns ATAP_RESULT_OK. 50 */ 51 AtapResult atap_set_ca_response(AtapOps* ops, 52 const uint8_t* ca_response, 53 uint32_t ca_response_size); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /* LIBATAP_H_ */ 60