14 Mar, 2019

1 commit

  • Fix coverity issue: CID 2970630: Resource leak (RESOURCE_LEAK)
    leaked_storage: Variable cdns going out of scope leaks the storage
    it points to.

    Memory allocated by devm_kzalloc() won't be freed automatically in
    u-boot, free the memory manually here.

    Test: Coverity scan pass.

    Change-Id: I3000a2385941cef3b8b7e01611cfdc999971a4ca
    Signed-off-by: Luo Ji

    Luo Ji
     

08 Mar, 2019

1 commit

  • Currenlty U1 and U2 low power modes are allowed in device mode.
    Allowing U1 and U2 low power modes during data transfers in
    device mode is causing U1 exit failure on some USB3 host: which
    will transite to SS.inactive instead of U0, then host will send
    warm reset and ultimately result in reenumeration. This is observed
    on UUU tool with some PC host. Hence disable U1 and U2 low power
    modes for now.

    USB3 spec 7.5.10.4.2 Exit from Recovery.Configuration
    The port shall transition to eSS.Inactive when the following
    conditions are met:
    1. Either the Ux_EXIT_TIMER or the 6-ms timer
    (tRecoveryConfigurationTimeout) times out.
    2. For a downstream port, the transition to Recovery is not to
    attempt a Hot Reset.

    Signed-off-by: Li Jun
    (cherry picked from commit ae0cdc741f7313398539f7b576ced73871f6cd71)

    Li Jun
     

13 Feb, 2019

1 commit


11 Feb, 2019

1 commit


24 Jan, 2019

1 commit

  • For dual bootloader, slot selection is made at spl stage, go to
    fastboot when current slot is marked as unbootable in AVB will
    give the user a chance to recover current slot with fastboot
    commands. But in this scenario, the device can't switch to another
    bootable slot automatically when a slot is marked as unbootable.

    Reboot the board when current slot is marked as unbootable to make the
    slot switch happen in spl.

    Test: Slot switch to 'b' automatically when 'a' is marked as unbootable
    on imx8qxp_mek.

    Change-Id: I94237965970d0c17ed564cf76e08d353f7b9c047
    Signed-off-by: Luo Ji

    Luo Ji
     

18 Jan, 2019

1 commit

  • Support dual bootloader feature for imx8q which uses the
    container format. Move the A/B slot select and verify to
    SPL stage, the bootloader rollback index will be stored
    at the last 8K bytes of eMMC rpmb storage.

    Test: Boot and rbindex verify pass on imx8q.

    Change-Id: I0a48210f65984a083037a0cd3f9558951029ed7d
    Signed-off-by: Ji Luo

    Ji Luo
     

09 Jan, 2019

4 commits


08 Jan, 2019

2 commits

  • Keystore attestation requires provision keys and cerificate chains into
    secure storage. Add commands to support rsa/ecdsa keys and certificate
    chains provision, each key/certificate should be staged before provision.
    Usage:
    Set rsa attestation key:
    fastboot stage
    fastboot oem set-rsa-atte-key
    Set ec attestation key:
    fastboot stage
    fastboot oem set-ec-atte-key
    Append rsa attestation certs:
    fastboot stage
    fastboot oem append-rsa-atte-cert
    Append ec attestation certs:
    fastboot stage
    fastboot oem append-ec-atte-cert

    Test: Pass CTS cases:
    android.keystore.cts.KeyAttestationTest#testRsaAttestation
    android.keystore.cts.KeyAttestationTest#testEcAttestation

    Change-Id: Ic3ed87e7e328a39b0f1bfb163356ea9e37d2f4fc
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Pass the verified boot key hash to keymaster, it will be
    treated as the root trust in keymaster service.
    Also set the 'initialized' flag after initializing the
    keymaster client or set keymaster boot parameters will fail.

    Test: Pass CTS cases:
    android.keystore.cts.KeyAttestationTest#testRsaAttestation
    android.keystore.cts.KeyAttestationTest#testEcAttestation

    Change-Id: I486b5493826160f42c61a3da0e6cd769df92254d
    Signed-off-by: Ji Luo

    Ji Luo
     

24 Dec, 2018

1 commit

  • Sometimes we need to set random rpmb key which is invisible
    except for the device.
    Generate the random key with hwcrypto interface and support
    fastboot command "fastboot oem set-rpmb-random-key" to set it.

    Test: build and boot on imx8q.

    Change-Id: I44e1b6b091366d8ffceb1159fc65c17610ce5243
    Signed-off-by: Ji Luo

    Ji Luo
     

21 Dec, 2018

1 commit

  • For mek_8qm, bootloader offset in SD card is 32kb, in eMMC
    bootpartition, it's 0kb. This patch fix the issue that bootloader offset
    used in uboot is always based on the device that the board boot from.

    Now, if uboot environment variable "target_ubootdev" is set, bootloader
    offset used in uboot is based on the device "target_ubootdev" specified.
    So boot from eMMC to flash SD, the board can boot from SD and vice versa.

    Change-Id: Ia2cd64ba6ece02b98ea3d2addbce00b1661077de
    Signed-off-by: faqiang.zhu

    faqiang.zhu
     

20 Dec, 2018

1 commit


18 Dec, 2018

9 commits


12 Dec, 2018

2 commits

  • Open configs to enable trusty for imx8mm_evk and also
    add new config imx8mm_evk_android_trusty_defconfig based
    on imx8mm_evk_android_defconfig.

    Test: Trusty starts ok.

    Change-Id: Iaea90de21f886ed23082a5e8e8d2fa7fb139a9cb
    Signed-off-by: Ji Luo

    Ji Luo
     
  • When moving to support partition reboot or android auto on XEN,
    linux kernel will runs into runtime suspend state, and the usb
    will be configured to low power suspend state by Linux.

    Then we reboot and runs into U-Boot, however the usb already in
    suspended state and uboot not able to lock the phy pll,
    after clearing PHCD to out of suspended state, the phy pll could be
    locked and fastboot works.

    Signed-off-by: Peng Fan
    Suggested-by: Li Jun
    Reviewed-by: Ye Li

    Peng Fan
     

06 Dec, 2018

2 commits


04 Dec, 2018

1 commit

  • Add commands to write/read vbmeta public key to/from secure
    storage. The vbmeta public key can only be set once.
    Comands to set the public key:
    fastboot stage
    fastboot oem set-public-key

    Test: build and boot on imx8qxp_mek.

    Change-Id: Id3ad4aa5aacef4fc8443f6a2d6ccb931310970ca
    Signed-off-by: Ji Luo

    Ji Luo
     

29 Nov, 2018

1 commit


28 Nov, 2018

1 commit


21 Nov, 2018

1 commit

  • Too many macros are used in fsl_avbkey.c and
    make it difficult to maintain.
    This patch made some refine by:
    1. Move all avb/atx operations to fsl_avb.c.
    2. Refine the functions logic.
    3. Drop some unsupported conditions/functions.

    Test: build and boot on
    imx8qm_mek/imx8mq_evk/imx6qp_sabresd/imx7d_pico/imx8m_aiy.

    Change-Id: I5c99732acfc47d53cdf188d69223983777e577f4
    Signed-off-by: Luo Ji

    Luo Ji
     

13 Nov, 2018

4 commits

  • Current code uses strlen of string to get the property data
    length, which is wrong for unicode string, also the whole
    property length also should be corrected(descriptor length
    minus head length, 142-10=132), detail data format of single
    GUID see below table:

    Table 4a: Microsoft Extended Properties Feature Descriptor
    ===================================================================
    Value | TYPE | Description
    ===================================================================
    0x8E, 0x00, 0x00, 0x00 | DWORD (LE) | Descriptor length
    | | (142 bytes)
    --------------------------------------------------------------------
    0x00, 0x01 | BCD WORD (LE) | Version ('1.0')
    --------------------------------------------------------------------
    0x05, 0x00 | WORD (LE) | Extended Property
    | | Descriptor index (5)
    --------------------------------------------------------------------
    0x01, 0x00 | WORD (LE) | Number of sections (1)
    --------------------------------------------------------------------
    0x84, 0x00, 0x00, 0x00 | DWORD (LE) | Size of the property
    | | section (132 bytes)
    --------------------------------------------------------------------
    0x01, 0x00, 0x00, 0x00 | DWORD (LE) | Property data type
    | | (1 = Unicode
    | | REG_SZ,
    | | see table below)
    --------------------------------------------------------------------
    0x28, 0x00 | WORD (LE) | Property name
    | | length (40 bytes)
    --------------------------------------------------------------------
    0x44, 0x00, 0x65, 0x00, | NUL-terminated | Property name
    (...) | Unicode String | "DeviceInterfaceGUID"
    0x74, 0x00, 0x00, 0x00 | (LE) |
    --------------------------------------------------------------------
    0x4e, 0x00, 0x00, 0x00 | DWORD (LE) | Property data
    | | length (78 bytes)
    --------------------------------------------------------------------
    0x7b, 0x00, 0x46, 0x00, | NUL-terminated | Property name
    (...) | Unicode String | "{xxxxxxxx-xxxx-
    0x7d, 0x00, 0x00, 0x00 | (LE) | xxxx-xxxx-
    | | xxxxxxxxxxxx}\0"
    --------------------------------------------------------------------

    Details of WCID see below link:
    https://github.com/pbatard/libwdi/wiki/WCID-Devices

    Reviewed-by: Ye Li
    Signed-off-by: Li Jun

    Li Jun
     
  • Fix coverity issue CID 5015449: Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking mmc suggests that it may be null, but it has
    already been dereferenced on all paths leading to the check

    Signed-off-by: Ye Li

    Ye Li
     
  • Fix coverity issue CID 1898965: Dereference null return value (NULL_RETURNS)
    dereference: Dereferencing a pointer that might be NULL dev_desc when calling
    write_backup_gpt_partitions

    Signed-off-by: Ye Li

    Ye Li
     
  • Fix coverity issue CID 3826473: Destination buffer too small (STRING_OVERFLOW)
    string_overflow: You might overrun the 16-character destination string buffer by
    writing 20 characters from

    The size of g_ptable->name is 20, but we use 16 bytes buffer for strcpy. It may
    cause buffer overflow.

    Signed-off-by: Ye Li

    Ye Li
     

12 Nov, 2018

4 commits

  • The rollback index should be updated when avb verify pass
    and the slot has been marked as successful, update the
    rollback index also for those enabled dual bootloader
    feature.
    This commit also fix some configs condition issue so
    read/write rollback index with trusty will work.

    Test: rollback index updated successfully on
    imx7d_pico and AIY.

    Change-Id: I2344d6462249d8d88f0622d331cdeffc7e12f885
    Signed-off-by: Ji Luo

    Ji Luo
     
  • SHA256 hash of the entire verified software stack should be calculated
    and passed to 'trusty_set_boot_params'. This commit will calculate the
    SHA256 hash which represents spl.bin and bootloader.img, and then extend
    that hash with the hash of vbmeta image into the final VBH.

    Bug: 110905171

    Test: VBH is calculated and passed ok on AIY.

    Change-Id: Id83ad36f3de79bedd435ca8f26035a35cca66b07
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Add support for fastboot variable 'at-vboot-state', it's composed
    by 6 sub-variable: 'bootloader-locked', 'bootloader-min-versions',
    'avb-perm-attr-set', 'avb-locked', 'avb-unlock-disabled' and
    'avb-min-versions'.

    Test: All 'at-vboot-state' variables are returned
    correctly on imx7d_pico and AIY.

    Change-Id: Ibb855cbcc7c41657af62dafb98a96c4dfb96ef22
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Device will be locked permanently after disabling the unlcok vboot, store
    the disable unlock vboot status into fuse. Since the fuse write operation
    is irreversible so config 'CONFIG_AVB_FUSE' is disabled by default, user
    need to add this config manually and run this command again.

    Test: Disable unlock vboot bit is set after enabling "CONFIG_AVB_FUSE",
    device was locked permanently after running this command. This is
    verified on both imx7d_pico and AIY.

    Change-Id: Iad8991a238763b1d662e33cba65f0b9eb44e97ef
    Signed-off-by: Ji Luo

    Ji Luo