diff options
Diffstat (limited to 'lib/avb/libavb/avb_ops.h')
-rw-r--r-- | lib/avb/libavb/avb_ops.h | 69 |
1 files changed, 16 insertions, 53 deletions
diff --git a/lib/avb/libavb/avb_ops.h b/lib/avb/libavb/avb_ops.h index 908c66c..30309c5 100644 --- a/lib/avb/libavb/avb_ops.h +++ b/lib/avb/libavb/avb_ops.h @@ -63,32 +63,12 @@ typedef enum { struct AvbOps; typedef struct AvbOps AvbOps; -/* Forward-declaration of operations in libavb_ab. */ -struct AvbABOps; - -/* Forward-declaration of operations in libavb_atx. */ -struct AvbAtxOps; +struct AvbABData; /* High-level operations/functions/methods that are platform * dependent. */ struct AvbOps { - /* This pointer can be used by the application/bootloader using - * libavb and is typically used in each operation to get a pointer - * to platform-specific resources. It cannot be used by libraries. - */ - void* user_data; - - /* If libavb_ab is used, this should point to the - * AvbABOps. Otherwise it must be set to NULL. - */ - struct AvbABOps* ab_ops; - - /* If libavb_atx is used, this should point to the - * AvbAtxOps. Otherwise it must be set to NULL. - */ - struct AvbAtxOps* atx_ops; - /* Reads |num_bytes| from offset |offset| from partition with name * |partition| (NUL-terminated UTF-8 string). If |offset| is * negative, its absolute value should be interpreted as the number @@ -106,12 +86,9 @@ struct AvbOps { * of the partition. In this case the value returned in * |out_num_read| may be smaller than |num_bytes|. */ - AvbIOResult (*read_from_partition)(AvbOps* ops, - const char* partition, - int64_t offset, - size_t num_bytes, - void* buffer, - size_t* out_num_read); + AvbIOResult (*read_from_partition)(AvbOps* ops, const char* partition, + int64_t offset, size_t num_bytes, + void* buffer, size_t* out_num_read); /* Writes |num_bytes| from |bffer| at offset |offset| to partition * with name |partition| (NUL-terminated UTF-8 string). If |offset| @@ -129,10 +106,8 @@ struct AvbOps { * This function never does any partial I/O, it either transfers all * of the requested bytes or returns an error. */ - AvbIOResult (*write_to_partition)(AvbOps* ops, - const char* partition, - int64_t offset, - size_t num_bytes, + AvbIOResult (*write_to_partition)(AvbOps* ops, const char* partition, + int64_t offset, size_t num_bytes, const void* buffer); /* Checks if the given public key used to sign the 'vbmeta' @@ -140,48 +115,36 @@ struct AvbOps { * embedded key material generated with 'avbtool * extract_public_key'. * - * The public key is in the array pointed to by |public_key_data| - * and is of |public_key_length| bytes. - * - * If there is no public key metadata (set with the avbtool option - * --public_key_metadata) then |public_key_metadata| will be set to - * NULL. Otherwise this field points to the data which is - * |public_key_metadata_length| bytes long. - * * If AVB_IO_RESULT_OK is returned then |out_is_trusted| is set - * true if trusted or false if untrusted. */ AvbIOResult (*validate_vbmeta_public_key)(AvbOps* ops, const uint8_t* public_key_data, size_t public_key_length, - const uint8_t* public_key_metadata, - size_t public_key_metadata_length, bool* out_is_trusted); - /* Gets the rollback index corresponding to the location given by - * |rollback_index_location|. The value is returned in + /* Gets the rollback index corresponding to the slot given by + * |rollback_index_slot|. The value is returned in * |out_rollback_index|. Returns AVB_IO_RESULT_OK if the rollback * index was retrieved, otherwise an error code. * - * A device may have a limited amount of rollback index locations (say, - * one or four) so may error out if |rollback_index_location| exceeds + * A device may have a limited amount of rollback index slots (say, + * one or four) so may error out if |rollback_index_slot| exceeds * this number. */ - AvbIOResult (*read_rollback_index)(AvbOps* ops, - size_t rollback_index_location, + AvbIOResult (*read_rollback_index)(AvbOps* ops, size_t rollback_index_slot, uint64_t* out_rollback_index); - /* Sets the rollback index corresponding to the location given by - * |rollback_index_location| to |rollback_index|. Returns + /* Sets the rollback index corresponding to the slot given by + * |rollback_index_slot| to |rollback_index|. Returns * AVB_IO_RESULT_OK if the rollback index was set, otherwise an * error code. * - * A device may have a limited amount of rollback index locations (say, - * one or four) so may error out if |rollback_index_location| exceeds + * A device may have a limited amount of rollback index slots (say, + * one or four) so may error out if |rollback_index_slot| exceeds * this number. */ - AvbIOResult (*write_rollback_index)(AvbOps* ops, - size_t rollback_index_location, + AvbIOResult (*write_rollback_index)(AvbOps* ops, size_t rollback_index_slot, uint64_t rollback_index); /* Gets whether the device is unlocked. The value is returned in |