1*3ccd4bb0SJason Zhu /* 2*3ccd4bb0SJason Zhu * Copyright (C) 2016 The Android Open Source Project 3*3ccd4bb0SJason Zhu * 4*3ccd4bb0SJason Zhu * Permission is hereby granted, free of charge, to any person 5*3ccd4bb0SJason Zhu * obtaining a copy of this software and associated documentation 6*3ccd4bb0SJason Zhu * files (the "Software"), to deal in the Software without 7*3ccd4bb0SJason Zhu * restriction, including without limitation the rights to use, copy, 8*3ccd4bb0SJason Zhu * modify, merge, publish, distribute, sublicense, and/or sell copies 9*3ccd4bb0SJason Zhu * of the Software, and to permit persons to whom the Software is 10*3ccd4bb0SJason Zhu * furnished to do so, subject to the following conditions: 11*3ccd4bb0SJason Zhu * 12*3ccd4bb0SJason Zhu * The above copyright notice and this permission notice shall be 13*3ccd4bb0SJason Zhu * included in all copies or substantial portions of the Software. 14*3ccd4bb0SJason Zhu * 15*3ccd4bb0SJason Zhu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16*3ccd4bb0SJason Zhu * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17*3ccd4bb0SJason Zhu * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18*3ccd4bb0SJason Zhu * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19*3ccd4bb0SJason Zhu * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20*3ccd4bb0SJason Zhu * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21*3ccd4bb0SJason Zhu * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22*3ccd4bb0SJason Zhu * SOFTWARE. 23*3ccd4bb0SJason Zhu */ 24*3ccd4bb0SJason Zhu 25*3ccd4bb0SJason Zhu /* 26*3ccd4bb0SJason Zhu #if !defined(AVB_INSIDE_LIBAVB_ATX_H) && !defined(AVB_COMPILATION) 27*3ccd4bb0SJason Zhu #error \ 28*3ccd4bb0SJason Zhu "Never include this file directly, include libavb_atx/libavb_atx.h instead." 29*3ccd4bb0SJason Zhu #endif 30*3ccd4bb0SJason Zhu */ 31*3ccd4bb0SJason Zhu 32*3ccd4bb0SJason Zhu #ifndef AVB_ATX_OPS_H_ 33*3ccd4bb0SJason Zhu #define AVB_ATX_OPS_H_ 34*3ccd4bb0SJason Zhu 35*3ccd4bb0SJason Zhu #include <android_avb/libavb.h> 36*3ccd4bb0SJason Zhu 37*3ccd4bb0SJason Zhu #include <android_avb/avb_atx_types.h> 38*3ccd4bb0SJason Zhu 39*3ccd4bb0SJason Zhu #ifdef __cplusplus 40*3ccd4bb0SJason Zhu extern "C" { 41*3ccd4bb0SJason Zhu #endif 42*3ccd4bb0SJason Zhu 43*3ccd4bb0SJason Zhu struct AvbAtxOps; 44*3ccd4bb0SJason Zhu typedef struct AvbAtxOps AvbAtxOps; 45*3ccd4bb0SJason Zhu 46*3ccd4bb0SJason Zhu /* An extension to AvbOps required by avb_atx_validate_vbmeta_public_key(). */ 47*3ccd4bb0SJason Zhu struct AvbAtxOps { 48*3ccd4bb0SJason Zhu /* Operations from libavb. */ 49*3ccd4bb0SJason Zhu AvbOps* ops; 50*3ccd4bb0SJason Zhu 51*3ccd4bb0SJason Zhu /* Reads permanent |attributes| data. There are no restrictions on where this 52*3ccd4bb0SJason Zhu * data is stored. On success, returns AVB_IO_RESULT_OK and populates 53*3ccd4bb0SJason Zhu * |attributes|. 54*3ccd4bb0SJason Zhu */ 55*3ccd4bb0SJason Zhu AvbIOResult (*read_permanent_attributes)( 56*3ccd4bb0SJason Zhu AvbAtxOps* atx_ops, AvbAtxPermanentAttributes* attributes); 57*3ccd4bb0SJason Zhu 58*3ccd4bb0SJason Zhu /* Reads a |hash| of permanent attributes. This hash MUST be retrieved from a 59*3ccd4bb0SJason Zhu * permanently read-only location (e.g. fuses) when a device is LOCKED. On 60*3ccd4bb0SJason Zhu * success, returned AVB_IO_RESULT_OK and populates |hash|. 61*3ccd4bb0SJason Zhu */ 62*3ccd4bb0SJason Zhu AvbIOResult (*read_permanent_attributes_hash)( 63*3ccd4bb0SJason Zhu AvbAtxOps* atx_ops, uint8_t hash[AVB_SHA256_DIGEST_SIZE]); 64*3ccd4bb0SJason Zhu }; 65*3ccd4bb0SJason Zhu 66*3ccd4bb0SJason Zhu #ifdef __cplusplus 67*3ccd4bb0SJason Zhu } 68*3ccd4bb0SJason Zhu #endif 69*3ccd4bb0SJason Zhu 70*3ccd4bb0SJason Zhu #endif /* AVB_ATX_OPS_H_ */ 71