lib: avb: add a permanent attribute flag

Add a flag to indicate the permanent attributes
have been written or not.

Change-Id: Id0b22158772bdf18466205df5f08cb0ddb820fbf
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2017-11-02 10:25:36 +08:00 committed by Kever Yang
parent 5b09015999
commit f74d184a88
2 changed files with 40 additions and 0 deletions

View File

@ -28,6 +28,9 @@
#include <android_avb/libavb.h> #include <android_avb/libavb.h>
#include <android_avb/avb_ab_flow.h> #include <android_avb/avb_ab_flow.h>
#define PERM_ATTR_DIGEST_SIZE 32
#define PERM_ATTR_TOTAL_SIZE 1084
/* Allocates an AvbOps instance suitable for use in Android userspace /* Allocates an AvbOps instance suitable for use in Android userspace
* on the device. Returns NULL on OOM. * on the device. Returns NULL on OOM.
* *
@ -162,4 +165,27 @@ int avb_read_lock_state(uint8_t *lock_state);
*/ */
int avb_write_lock_state(uint8_t lock_state); int avb_write_lock_state(uint8_t lock_state);
/**
* The android things uses fastboot to flash the permanent attributes.
* And if them were written, there must have a flag to indicate.
*
* @param flag indicate the permanent attributes have been written
* or not.
*
* @return 0 if the command succeeded, -1 if it failed
*/
int avb_read_perm_attr_flag(uint8_t *flag);
/**
* The android things uses fastboot to flash the permanent attributes.
* And if them were written, there must have a flag to indicate.
*
* @param flag We can call this function to write the flag '1'
* to indicate the permanent attributes has been
* written.
*
* @return 0 if the command succeeded, -1 if it failed
*/
int avb_write_perm_attr_flag(uint8_t flag);
#endif #endif

View File

@ -429,3 +429,17 @@ int avb_write_lock_state(uint8_t lock_state)
return -1; return -1;
return 0; return 0;
} }
int avb_read_perm_attr_flag(uint8_t *flag)
{
if (trusty_read_permanent_attributes_flag(flag))
return -1;
return 0;
}
int avb_write_perm_attr_flag(uint8_t flag)
{
if (trusty_write_permanent_attributes_flag(flag))
return -1;
return 0;
}