首页 > 其他分享 >Android AVB中的几种Descriptor

Android AVB中的几种Descriptor

时间:2023-04-03 14:00:26浏览次数:39  
标签:struct descriptor bytes len Descriptor Android uint32 AVB

avbtool info_image查看img信息

./android/external/avb/avbtool info_image --image out/evb/download_images/emmc/vbmeta.img 
Minimum libavb version:   1.0
Header Block:             256 bytes
Authentication Block:     576 bytes
Auxiliary Block:          3456 bytes
Public key (sha1):        xxxx
Algorithm:                SHA256_RSA4096
Rollback Index:           0
Flags:                    0
Release String:           'avbtool 1.1.0'
Descriptors:
    Chain Partition descriptor:
      Partition Name:          vbmeta_system
      Rollback Index Location: 2
      Public key (sha1):       xxxx
    Prop: com.android.build.boot.fingerprint -> 'Android/evb/evb:11/RD2A.211001.002/test:userdebug/test-keys'
    Prop: com.android.build.boot.os_version -> '11'
    Prop: com.android.build.boot.security_patch -> '2022-11-05'
    Prop: com.android.build.vendor_boot.fingerprint -> 'Android/evb/evb:11/RD2A.211001.002/test:userdebug/test-keys'
    Prop: com.android.build.vendor.fingerprint -> 'Android/evb/evb:11/RD2A.211001.002/test:userdebug/test-keys'
    Prop: com.android.build.vendor.os_version -> '11'
    Prop: com.android.build.vendor.security_patch -> '2022-11-05'
    Prop: com.android.build.dtbo.fingerprint -> 'Android/evb/evb:11/RD2A.211001.002/test:userdebug/test-keys'
    Hash descriptor:
      Image Size:            28246016 bytes
      Hash Algorithm:        sha256
      Partition Name:        boot
      Salt:                  xxxx
      Digest:                xxxx
      Flags:                 0
    Hash descriptor:
      Image Size:            1193543 bytes
      Hash Algorithm:        sha256
      Partition Name:        dtbo
      Salt:                  xxxx
      Digest:                xxxx
      Flags:                 0
    Hash descriptor:
      Image Size:            327680 bytes
      Hash Algorithm:        sha256
      Partition Name:        vendor_boot
      Salt:                  xxxx
      Digest:                xxxx
      Flags:                 0
    Hashtree descriptor:
      Version of dm-verity:  1
      Image Size:            611209216 bytes
      Tree Offset:           611209216
      Tree Size:             4820992 bytes
      Data Block Size:       4096 bytes
      Hash Block Size:       4096 bytes
      FEC num roots:         2
      FEC offset:            616030208
      FEC size:              4874240 bytes
      Hash Algorithm:        sha1
      Partition Name:        vendor
      Salt:                  xxxx
      Root Digest:           xxxx
      Flags:                 0

AvbChainPartitionDescriptor

/* A descriptor containing a pointer to signed integrity data stored
 * on another partition. The descriptor contains the partition name in
 * question (without the A/B suffix), the public key used to sign the
 * integrity data, and rollback index location to use for rollback
 * protection.
 *
 * Following this struct are |partition_name_len| bytes of the
 * partition name (UTF-8 encoded) and |public_key_len| bytes of the
 * public key.
 *
 * The |reserved| field is for future expansion and must be set to NUL
 * bytes.
 */
typedef struct AvbChainPartitionDescriptor {
  AvbDescriptor parent_descriptor;
  uint32_t rollback_index_location;
  uint32_t partition_name_len;
  uint32_t public_key_len;
  uint8_t reserved[64];
} AVB_ATTR_PACKED AvbChainPartitionDescriptor;

AvbDescriptor

/* Well-known descriptor tags.
 *
 * AVB_DESCRIPTOR_TAG_PROPERTY: see |AvbPropertyDescriptor| struct.
 * AVB_DESCRIPTOR_TAG_HASHTREE: see |AvbHashtreeDescriptor| struct.
 * AVB_DESCRIPTOR_TAG_HASH: see |AvbHashDescriptor| struct.
 * AVB_DESCRIPTOR_TAG_KERNEL_CMDLINE: see |AvbKernelCmdlineDescriptor| struct.
 * AVB_DESCRIPTOR_TAG_CHAIN_PARTITION: see |AvbChainPartitionDescriptor| struct.
 */
typedef enum {
  AVB_DESCRIPTOR_TAG_PROPERTY,
  AVB_DESCRIPTOR_TAG_HASHTREE,
  AVB_DESCRIPTOR_TAG_HASH,
  AVB_DESCRIPTOR_TAG_KERNEL_CMDLINE,
  AVB_DESCRIPTOR_TAG_CHAIN_PARTITION,
} AvbDescriptorTag;

/* The header for a serialized descriptor.
 *
 * A descriptor always have two fields, a |tag| (denoting its type,
 * see the |AvbDescriptorTag| enumeration) and the size of the bytes
 * following, |num_bytes_following|.
 *
 * For padding, |num_bytes_following| is always a multiple of 8.
 */
typedef struct AvbDescriptor {
  uint64_t tag;
  uint64_t num_bytes_following;
} AVB_ATTR_PACKED AvbDescriptor;

AvbHashDescriptor

/* A descriptor containing information about hash for an image.
 *
 * This descriptor is typically used for boot partitions to verify the
 * entire kernel+initramfs image before executing it.
 *
 * Following this struct are |partition_name_len| bytes of the
 * partition name (UTF-8 encoded), |salt_len| bytes of salt, and then
 * |digest_len| bytes of the digest.
 *
 * The |reserved| field is for future expansion and must be set to NUL
 * bytes.
 */
typedef struct AvbHashDescriptor {
  AvbDescriptor parent_descriptor;
  uint64_t image_size;
  uint8_t hash_algorithm[32];
  uint32_t partition_name_len;
  uint32_t salt_len;
  uint32_t digest_len;
  uint8_t reserved[64];
} AVB_ATTR_PACKED AvbHashDescriptor;

AvbHashtreeDescriptor

/* A descriptor containing information about a dm-verity hashtree.
 *
 * Hash-trees are used to verify large partitions typically containing
 * file systems. See
 * https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity for more
 * information about dm-verity.
 *
 * Following this struct are |partition_name_len| bytes of the
 * partition name (UTF-8 encoded), |salt_len| bytes of salt, and then
 * |root_digest_len| bytes of the root digest.
 *
 * The |reserved| field is for future expansion and must be set to NUL
 * bytes.
 */
typedef struct AvbHashtreeDescriptor {
  AvbDescriptor parent_descriptor;
  uint32_t dm_verity_version;
  uint64_t image_size;
  uint64_t tree_offset;
  uint64_t tree_size;
  uint32_t data_block_size;
  uint32_t hash_block_size;
  uint32_t fec_num_roots;
  uint64_t fec_offset;
  uint64_t fec_size;
  uint8_t hash_algorithm[32];
  uint32_t partition_name_len;
  uint32_t salt_len;
  uint32_t root_digest_len;
  uint8_t reserved[64];
} AVB_ATTR_PACKED AvbHashtreeDescriptor;

 

标签:struct,descriptor,bytes,len,Descriptor,Android,uint32,AVB
From: https://www.cnblogs.com/xiululu/p/17282863.html

相关文章

  • Android Studio——sdk相关包
    SDKPlatforms相关   SDKTools相关 ......
  • 在Android应用中通过Chaquopy使用Python
    在Android应用中通过Chaquopy使用Python[译]通过Python脚本和包为Android应用带来更多的功能翻译自https://proandroiddev.com/chaquopy-using-python-in-android-apps-dd5177c9ab6b欢迎通过我的Blog访问此文章.Python在开发者社区中时最受欢迎的语言之一,因为其简单,健......
  • Android Camera相关知识整理
    View相关原文:SerfaceView与TextureView的区别区别:Sureface有自己的Serface(由屏幕显示内容合成器(screencompositor)所管理的原生缓冲器的句柄)是一个单独的View,会在WMS中创建单独的窗口,有自己的渲染进程,不受UI层的控制,因此不能与其他UI组合在一起,不能进行平移缩放等变换。而Tex......
  • cordova android使用https协议
     在cordvoa添加平台后,cordovalib的文件夹下SystemWebViewClient.java文件(code\platforms\android\CordovaLib\src\org\apache\cordova\engine);修改:onReceivedSslError,方法,只需按以下方法修改publicvoidonReceivedSslError(WebViewview,SslErrorHandlerhandler,SslErr......
  • uniapp android检查权限,不进行获取
    varManifest=plus.android.importClass("android.Manifest");varMainActivity=plus.android.runtimeMainActivity();MainActivity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)......
  • Android开发 Jetpack Compose FlowColumn与FlowRow瀑布流布局
    前言  FlowColumn与FlowRow是Jetpack提供的辅助库accompanist的一员,以提供那些在JetpackComposesdk中目前还没有的功能API。因为默认库中的Column、Row、LazyVerticalGrid、LazyHorizontalGrid都无法满足流瀑布布局的需求,而且类似这种网格布局LazyVerticalGrid、LazyHorizont......
  • android - AsyncTask 完成后重新启动完整的 Android 应用程序
    我正在编写的应用程序会检查/sdcard下的目录中是否有特殊的ZIP文件,如果没有则开始下载并解压缩它。下载和解压缩工作得很好,即使是子目录。但我需要在完成后重新启动该应用程序-但这是行不通的。起初我有一个特殊的Activity“PreMainActivity.java”只是为了重启目的:imp......
  • 直播网站源码,Android中点击图片放大的简单方法
    直播网站源码,Android中点击图片放大的简单方法简单的思路就是把要放大的图片显示在一个对话框中显示出来 Java代码: publicvoidonThumbnailClick(Viewv){//finalAlertDialogdialog=newAlertDialog.Builder(this).create();//ImageViewimgView=getView();//di......
  • android popwindow实现左侧弹出菜…
    http://www.apkbus.com/android-44903-1-1.html学习一下PopupWindow的浮层显示效果。PopupWindow可以实现浮层效果,主要方法有:可以自定义view,通过LayoutInflator方法;可以出现和退出时显示动画;可以指定显示位置等。为了将PopupWindow的多个功能展现并力求用简单的代码实......
  • Android NDK开发环境搭建
    必先利其器, 下面介绍下EclipseSDKNDKCygwinCDT 集成开发环境的搭建。1、Android 开发环境搭建Android开发环境搭建不是重点,相信看此文章的很多人都已经搭建成功,这里随便概述性的说说。1)     下载JDK2)     下载Eclipse3)     下载AndroidSDK4)  ......