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