Skip to content

Commit 69fdc59

Browse files
Jason ZhuJosephChen2017
authored andcommitted
lib: avb: update and modify the avb library
The commit point is updated to google external/avb/ which commit point is 868db2a514bbb02e166fb55b1592b27de8c9680c. Change-Id: I10f7c0ac356a7666b518b62e59ccb62277668578 Signed-off-by: Jason Zhu <[email protected]>
1 parent eca6f1f commit 69fdc59

File tree

13 files changed

+4574
-4068
lines changed

13 files changed

+4574
-4068
lines changed

include/android_avb/avb_cmdline.h

100755100644
Lines changed: 96 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,96 @@
1-
/*
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-
/*
26-
#ifdef AVB_INSIDE_LIBAVB_H
27-
#error "You can't include avb_sha.h in the public header libavb.h."
28-
#endif
29-
*/
30-
31-
/*
32-
#ifndef AVB_COMPILATION
33-
#error "Never include this file, it may only be used from internal avb code."
34-
#endif
35-
*/
36-
37-
#ifndef AVB_CMDLINE_H_
38-
#define AVB_CMDLINE_H_
39-
40-
#include <android_avb/avb_ops.h>
41-
#include <android_avb/avb_slot_verify.h>
42-
43-
/* Maximum allow length (in bytes) of a partition name, including
44-
* ab_suffix.
45-
*/
46-
#define AVB_PART_NAME_MAX_SIZE 32
47-
48-
#define AVB_MAX_NUM_CMDLINE_SUBST 10
49-
50-
/* Holds information about command-line substitutions. */
51-
typedef struct AvbCmdlineSubstList {
52-
size_t size;
53-
char* tokens[AVB_MAX_NUM_CMDLINE_SUBST];
54-
char* values[AVB_MAX_NUM_CMDLINE_SUBST];
55-
} AvbCmdlineSubstList;
56-
57-
/* Substitutes all variables (e.g. $(ANDROID_SYSTEM_PARTUUID)) with
58-
* values. Returns NULL on OOM, otherwise the cmdline with values
59-
* replaced.
60-
*/
61-
char* avb_sub_cmdline(AvbOps* ops,
62-
const char* cmdline,
63-
const char* ab_suffix,
64-
bool using_boot_for_vbmeta,
65-
const AvbCmdlineSubstList* additional_substitutions);
66-
67-
AvbSlotVerifyResult avb_append_options(
68-
AvbOps* ops,
69-
AvbSlotVerifyData* slot_data,
70-
AvbVBMetaImageHeader* toplevel_vbmeta,
71-
AvbAlgorithmType algorithm_type,
72-
AvbHashtreeErrorMode hashtree_error_mode);
73-
74-
/* Allocates and initializes a new command line substitution list. Free with
75-
* |avb_free_cmdline_subst_list|.
76-
*/
77-
AvbCmdlineSubstList* avb_new_cmdline_subst_list(void);
78-
79-
/* Use this instead of |avb_free| to deallocate a AvbCmdlineSubstList. */
80-
void avb_free_cmdline_subst_list(AvbCmdlineSubstList* cmdline_subst);
81-
82-
/* Adds a hashtree root digest to be substituted in $(AVB_*_ROOT_DIGEST)
83-
* variables. The partition name differentiates the variable. For example, if
84-
* |part_name| is "foo" then $(AVB_FOO_ROOT_DIGEST) will be substituted with the
85-
* hex encoding of the digest. The substitution will be added to
86-
* |out_cmdline_subst|. Returns AVB_SLOT_VERIFY_RESULT_OK on success.
87-
*/
88-
AvbSlotVerifyResult avb_add_root_digest_substitution(
89-
const char* part_name,
90-
const uint8_t* digest,
91-
size_t digest_size,
92-
AvbCmdlineSubstList* out_cmdline_subst);
93-
94-
#endif
1+
/*
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+
/*
26+
#ifdef AVB_INSIDE_LIBAVB_H
27+
#error "You can't include avb_sha.h in the public header libavb.h."
28+
#endif
29+
*/
30+
31+
/*
32+
#ifndef AVB_COMPILATION
33+
#error "Never include this file, it may only be used from internal avb code."
34+
#endif
35+
*/
36+
37+
#ifndef AVB_CMDLINE_H_
38+
#define AVB_CMDLINE_H_
39+
40+
#include <android_avb/avb_ops.h>
41+
#include <android_avb/avb_slot_verify.h>
42+
43+
/* Maximum allow length (in bytes) of a partition name, including
44+
* ab_suffix.
45+
*/
46+
#define AVB_PART_NAME_MAX_SIZE 32
47+
48+
#define AVB_MAX_NUM_CMDLINE_SUBST 10
49+
50+
/* Holds information about command-line substitutions. */
51+
typedef struct AvbCmdlineSubstList {
52+
size_t size;
53+
char* tokens[AVB_MAX_NUM_CMDLINE_SUBST];
54+
char* values[AVB_MAX_NUM_CMDLINE_SUBST];
55+
} AvbCmdlineSubstList;
56+
57+
/* Substitutes all variables (e.g. $(ANDROID_SYSTEM_PARTUUID)) with
58+
* values. Returns NULL on OOM, otherwise the cmdline with values
59+
* replaced.
60+
*/
61+
char* avb_sub_cmdline(AvbOps* ops,
62+
const char* cmdline,
63+
const char* ab_suffix,
64+
bool using_boot_for_vbmeta,
65+
const AvbCmdlineSubstList* additional_substitutions);
66+
67+
AvbSlotVerifyResult avb_append_options(
68+
AvbOps* ops,
69+
AvbSlotVerifyFlags flags,
70+
AvbSlotVerifyData* slot_data,
71+
AvbVBMetaImageHeader* toplevel_vbmeta,
72+
AvbAlgorithmType algorithm_type,
73+
AvbHashtreeErrorMode hashtree_error_mode,
74+
AvbHashtreeErrorMode resolved_hashtree_error_mode);
75+
76+
/* Allocates and initializes a new command line substitution list. Free with
77+
* |avb_free_cmdline_subst_list|.
78+
*/
79+
AvbCmdlineSubstList* avb_new_cmdline_subst_list(void);
80+
81+
/* Use this instead of |avb_free| to deallocate a AvbCmdlineSubstList. */
82+
void avb_free_cmdline_subst_list(AvbCmdlineSubstList* cmdline_subst);
83+
84+
/* Adds a hashtree root digest to be substituted in $(AVB_*_ROOT_DIGEST)
85+
* variables. The partition name differentiates the variable. For example, if
86+
* |part_name| is "foo" then $(AVB_FOO_ROOT_DIGEST) will be substituted with the
87+
* hex encoding of the digest. The substitution will be added to
88+
* |out_cmdline_subst|. Returns AVB_SLOT_VERIFY_RESULT_OK on success.
89+
*/
90+
AvbSlotVerifyResult avb_add_root_digest_substitution(
91+
const char* part_name,
92+
const uint8_t* digest,
93+
size_t digest_size,
94+
AvbCmdlineSubstList* out_cmdline_subst);
95+
96+
#endif

0 commit comments

Comments
 (0)