FBE概要

参考文档

80-pn330-9_a_linux_android_userdata_encryption.pdf
80-nu861-1_j_qualcomm_android_security_features.pdf
https://source.android.google.cn/security/encryption/file-based.html
http://blog4jimmy.com/2018/04/473.html

kernel keyring:
https://lwn.net/Articles/210502/
http://man7.org/linux/man-pages/man7/keyrings.7.html

概要

file-based encryption,从android 7以及以后版本支持,提供以下FEATURES:

  1. direct boot:让加密设备直接启动到锁屏界面,在用户输入凭证之前就可以执行一些基本操作,闹钟、接收来电等。
  2. 多用户:每个用户都有两个keys,一个DE KEY和一个CE KEY

fbe使能要求

kernel 版本4.4或以后
/data挂载前启动keymaster
userdata 分区需要格式化为ext4或f2fs
fstab文件需要添加fileencryption=contents_encryption_mode[:filenames_encryption_mode],fileencryption=ice是硬件 FBE。

fbe软件架构

fbe处理流程

init_user0 -->init_user0(init) -->VoldNativeService::initUser0() {vold} //创建user 0 DE和CE key,install DE key到keyring
2:用户在锁屏界面输入凭证后,调用到VoldNativeService::unlockUserKey() //install userid 的CE key到keyring

fbe验证

getprop | grep crypto
[ro.crypto.fbefinish]: [1] // nubia自定义属性
[ro.crypto.state]: [encrypted]
[ro.crypto.type]: [file]

备注

  1. 首次启动时会创建三种类型的key,并应用到不同的目录中
    FBE三种类型key:
  • system DE key:/data/unencrypted/key
  • user 0 ce key:/data/misc/vold/user_keys/ce/0/
  • user 0 de key:/data/misc/vold/user_keys/de/0/
    非首次启动时,读取这三种类型key,加载到kernel keyring。
  1. 加密策略应用到目录级别,创建的文件或目录的加密策略会从父目录的加密策略继承。

  2. 查看 keyring里的keys:cat /proc/key

  3. data分区目录加密情况

posted @ 2020-12-05 16:10  bobfly1984  阅读(386)  评论(0编辑  收藏  举报