• 検索結果がありません。

HSM モードを使用した Zynq UltraScale+ MPSoC デバイス ブート イメージの作成

ドキュメント内 Bootgen ユーザー ガイド (ページ 96-103)

stage8:

{ [headersignature] ImageHeaderTable.sha256.sig [bootimage] fsbl_e_ac.bin

[bootimage] system_e_ac.bin }

Bootgen コマンドは次のとおりです。

bootgen -image stage8.bif -w -o final.bin 出力は、ブートイメージファイル (final.bin) です。

HSM モードを使用した Zynq UltraScale+ MPSoC デバイス ブート

BH hash

BOOTGEN

Stage- 7a

Encrypt FSBL PPK &

SPK FSBL with

auth certificate encrypted

FSBL

SPK sign BOOTGEN

Stage- 7a

Encrypt FSBL PPK &

encrypted SPK FSBL

SPK sign

BOOTGEN

Generate SPK Hash FSBL

nky key BOOTGEN

Stage-2b

Generate SPK Hash FSBL

nky key HSM

Stage-1

Generate SPK signature

SPK hash SPK

signature

BOOTGEN

Stage- 2a

Encrypt FSBL

FSBL encrypted

nky key FSBL

BOOTGEN

Stage-3

Generate BH hash

PPK & SPK BH hash

Encrypted FSBL

HSM

Stage-4

Generate BH signature BH hash

BH signature

BOOTGEN

Stage-5

Generate partition hashes

PPK & SPK partition

hashes encrypted

partitions

SPK signature BH signature

HSM

Stage-6

Generate partition signatures partition

hashes

partition signatures

Stage- 7a

PPK & SPK

FSBL with authentication certificate encrypted

FSBL

Stage-0

Generate SPK SPK Hash SPK

SPK hash

BOOTGEN

Stage-8

Generate Header Table hash Partitions with

Authenticated Certificate

Header Table hash

HSM

Stage-9

Generate header

Table signature Header

Table hash

Header Table signature

BOOTGEN

Stage-10

Generate bootmage Partitions with

Authenticated Certificate

final bootimage header Table signature

SPK Signature

Insert FSBL Signature

Stage-7b Stage-7c

Stage-2c

SSK

SSK

SSK AC header

SPK ID

X21547-052120

HSM モードを使用した Zynq® UltraScale+™ MPSoC デバイスのブート イメージの作成は、次の BIF ファイルを使用 して標準フローでブート イメージを作成するのと似ています。これらの例は、必要に応じてハッシュ ファイルを生 成するために OpenSSL プログラムを使用します。

all:{

[fsbl_config] bh_auth_enable [keysrc_encryption] bbram_red_key [pskfile] primary0.pem

bootloader,

destination_cpu=a53-0, encryption=aes,

aeskeyfile=aes0.nky, authentication=rsa ] fsbl.elf

[

destination_device=pl, encryption=aes,

aeskeyfile=aes1.nky, authentication=rsa ] system.bit

[

destination_cpu=a53-0, authentication=rsa, exception_level=el-3, trustzone=secure ] bl31.elf

[

destination_cpu=a53-0, authentication=rsa, exception_level=el-2 ] u-boot.elf

}

注記: HSM フローで pmufw_image を使用するには、上記の BIF に [pmufw_image] pmufw.elf を追加します。同 様の行の場合、これは FSBL が暗号化される stage2a bif に追加する必要があります。フローの残りは、同じままにな ります。

ステージ 0: SPK のハッシュを生成 次に、BIF ファイルの抜粋を示します。

stage0:

{ [ppkfile]primary.pub [spkfile]secondary.pub }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage0.bif -generate_hashes -w on -log error ステージ 1: SPK ハッシュに署名 (パーティションを暗号化)

次に、OpenSSL を使用して SPK ハッシュを生成するコードの抜粋を示します。

openssl rsautl -raw -sign -inkey primary0.pem -in secondary.pub.sha384 >

secondary.pub.sha384.sig

Stage 2a:

{ [keysrc_encryption] bbram_red_key [

bootloader,destination_cpu=a53-0, encryption=aes,

aeskeyfile=aes0.nky ] fsbl.elf

}

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage2a.bif -o fsbl_e.bin -w on -log error ステージ 2b: ビットストリームを暗号化

次の BIF ファイル エントリを生成します。

stage2b:

{ [

encryption=aes, aeskeyfile=aes1.nky, destination_device=pl, pid=1

] system.bit }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage2b.bif -o system_e.bin -w on -log error ステージ 3: ブート ヘッダー ハッシュを生成

次の BIF ファイルを使用してブート ヘッダー ハッシュを生成します。

stage3:

{ [fsbl_config] bh_auth_enable [ppkfile] primary.pub

[spkfile] secondary.pub

[spksignature]secondary.pub.sha384.sig [bootimage,authentication=rsa]fsbl_e.bin }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage3.bif -generate_hashes -w on -log error

openssl rsautl -raw -sign -inkey secondary0.pem -in bootheader.sha384 >

bootheader.sha384.sig

ステージ 5: パーティション ハッシュを取得

BIF ファイルの次のコマンドを使用して、パーティション ハッシュを取得します。

stage5:

{

[ppkfile]primary.pub [spkfile]secondary.pub

[spksignature]secondary.pub.sha384.sig [bhsignature]bootheader.sha384.sig [bootimage,authentication=rsa]fsbl_e.bin [bootimage,authentication=rsa]system_e.bin [

destination_cpu=a53-0, authentication=rsa, exception_level=el-3, trustzone=secure ] bl31.elf

[

destination_cpu=a53-0, authentication=rsa, exception_level=el-2 ] u-boot.elf

}

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage5.bif -generate_hashes -w on -log error ビットストリーム パーティション用に複数のハッシュが生成されます。詳細は、外部メモリを使用したビットストリ ーム認証 を参照してください。

ブート ヘッダー ハッシュもこのステージ 5 で生成されます。ステージ 5 では bh_auth_enable が使用されないの で、このハッシュはステージ 3 で生成されたものとは異なります。これは必要に応じてステージ 5 に追加できます が、ステージ 3 で生成されたブート ヘッダー ハッシュはステージ 4 で署名され、この署名は HSM モード フローで しか使用されないので、大きな影響はありません。

ステージ 6: パーティション ハッシュに署名 OpenSSL を使用して次のファイルを作成します。

openssl rsautl -raw -sign -inkey secondary0.pem -in fsbl.elf.0.sha384 >

fsbl.elf.0.sha384.sig

openssl rsautl -raw -sign -inkey secondary0.pem -in system.bit.0.sha384 >

system.bit.0.sha384.sig

boot.elf.0.sha384.sig

openssl rsautl -raw -sign -inkey secondary0.pem -in bl31.elf.0.sha384 >

bl31.elf.0.sha384.sig

openssl rsautl -raw -sign -inkey secondary0.pem -in bl31.elf.1.sha384 >

bl31.elf.1.sha384.sig

ステージ 7: パーティション署名を認証証明に挿入

ステージ 7a: 次のコードを BIF ファイルに追加して FSBL 署名を挿入します。

Stage7a:

{ [fsbl_config] bh_auth_enable [ppkfile] primary.pub

[spkfile] secondary.pub

[spksignature]secondary.pub.sha384.sig [bhsignature]bootheader.sha384.sig

[bootimage,authentication=rsa,presign=fsbl.elf.0.sha384.sig]fsbl_e.bin }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage7a.bif -o fsbl_e_ac.bin -efuseppkbits efuseppkbits.txt -nonbooting -w on -log error

ステージ 7b: BIF ファイルに次を追加してビットストリーム署名を挿入します。

stage7b:

{ [ppkfile]primary.pub [spkfile]secondary.pub

[spksignature]secondary.pub.sha384.sig [bhsignature]bootheader.sha384.sig [

bootimage,

authentication=rsa,

presign=system.bit.0.sha384.sig ] system_e.bin

}

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage7b.bif -o system_e_ac.bin -nonbooting -w on -log error

ステージ 7c: BIF ファイルに次を追加して U-Boot 署名を挿入します。

stage7c:

{ [ppkfile] primary.pub [spkfile] secondary.pub

[spksignature]secondary.pub.sha384.sig [bhsignature]bootheader.sha384.sig [

destination_cpu=a53-0,

] u-boot.elf }

Bootgen コマンドは次のとおりです。

bootgen arch zynqmp image stage7c.bif o uboot_ac.bin nonbooting w on -log error

ステージ 7d: BIF ファイルに次を追加して ATF 署名を挿入します。

stage7d:

{ [ppkfile] primary.pub [spkfile] secondary.pub

[spksignature]secondary.pub.sha384.sig [bhsignature]bootheader.sha384.sig [

destination_cpu=a53-0, authentication=rsa, exception_level=el-3, trustzone=secure,

presign=bl31.elf.0.sha384.sig ] bl31.elf

}

Bootgen コマンドは次のとおりです。

bootgen arch zynqmp image stage7d.bif o bl31_ac.bin nonbooting w on -log error

ステージ 8: パーティションを結合し、ヘッダー テーブル ハッシュを取得 BIF ファイルに次を追加します。

stage8:

{ [bootimage]fsbl_e_ac.bin [bootimage]system_e_ac.bin [bootimage]bl31_ac.bin [bootimage]u-boot_ac.bin }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage8.bif -generate_hashes -o stage8.bin -w on -log error

ステージ 9: ヘッダー テーブル ハッシュに署名 OpenSSL を使用して次のファイルを生成します。

stage10:

{ [headersignature]ImageHeaderTable.sha384.sig [bootimage]fsbl_e_ac.bin

[bootimage]system_e_ac.bin [bootimage]bl31_ac.bin [bootimage]u-boot_ac.bin }

Bootgen コマンドは次のとおりです。

bootgen -arch zynqmp -image stage10.bif -o final.bin -w on -log error 注記: 現時点では、Versal デバイスでは HSM モードはサポートされていません。

ドキュメント内 Bootgen ユーザー ガイド (ページ 96-103)