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

HSM モードを使用した Zynq-7000 SoC デバイス ブート イメージ の作成

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

Stage-2b

BOOTGEN

Stage- 7a

PPK & SPK

FSBL with auth certificate encrypted

FSBL

SPK sign BOOTGEN

Stage- 7a

PPK & SPK

FSBL with auth certificate encrypted

FSBL

SPK sign HSM

Stage-1

PSK hash Generate SPK

signature

SPK hash SPK

signature

nky key

HSM

Stage- 4a

Generate FSBL Signature

FSBL hash FSBL

Signature

BOOTGEN

Stage- 5a

PPK & SPK

FSBL Signature encrypted

FSBL

SPK signature

Stage-0

Generate SPK Hash SPK

SPK hash

BOOTGEN

Stage-6

Generate header Table

hash

Header Table hash

HSM

Stage-7

Generate Header Table

signature Header

Table hash

Header Table Signature

Stage-8

Generate bootmage

final bootimage Header Table

Signature PSK

Generate FSBL hashe

PPK & SPKencrypted FSBL hash FSBL

SPK signature

Stage-3b

Generate FSBL Hash

Stage-4b

Stage-5b

Partions with Authenticated Certificates

Stage- 3a BOOTGEN

Stage- 2a

Encrypt FSBL FSBL

nky Key

encrypted FSBL

BOOTGEN

Stage- 3a

SSK

FSBL signature

Insert FSBL Signature

SSK

BOOTGEN

Stage-8

Generate Boot Image

Final Boot Image Partions with

Authenticated Certificates

Header Table Signature AC header

SPK ID

X21416-052120

all:{

[aeskeyfile]my_efuse.nky [pskfile]primary.pem [sskfile]secondary.pem

[bootloader,encryption=aes,authentication=rsa] zynq_fsbl_0.elf [authentication=rsa]system.bit

}

ステージ 0: SPK のハッシュを生成

このステージは、SPK キーのハッシュを生成します。

stage0:

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

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

bootgen -image stage0.bif –w -generate_hashes ステージ 1: SPK ハッシュに署名

このステージは SPK ハッシュにサインして署名を作成します。

xil_rsa_sign.exe -gensig -sk primary.pem -data secondary.pub.sha256 -out secondary.pub.sha256.sig

または、OpenSSL プログラムを使用して署名を作成します。

#Swap the bytes in SPK hash

objcopy -I binary -O binary --reverse-bytes=256 secondary.pub.sha256

#Generate SPK signature using OpenSSL

openssl rsautl -raw -sign -inkey primary.pem -in secondary.pub.sha256 >

secondary.pub.sha256.sig

#Swap the bytes in SPK signature

objcopy -I binary -O binary --reverse-bytes=256 secondary.pub.sha256.sig ステージ 2: AES を使用して暗号化

このステージはパーティションを暗号化します。stage2.bif は次のとおりです。

stage2:

{ [aeskeyfile] my_efuse.nky

出力は、暗号化されたファイル (fsbl_e.bin) です。

ステージ 3: パーティションのハッシュを生成

このステージは、さまざまなパーティションのハッシュを生成します。

ステージ 3a: FSBL ハッシュを生成 BIF ファイルは次のとおりです。

stage3a:

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

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

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

bootgen -image stage3a.bif -w -generate_hashes 出力は、ハッシュファイル (zynq_fsbl_0.elf.0.sha256) です。

ステージ 3b: ビットストリーム ハッシュを生成 このステージの BIF ファイルは次のとおりです。

stage3b:

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

[spksignature] secondary.pub.sha256.sig [authentication=rsa] system.bit

}

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

bootgen -image stage3b.bif -w -generate_hashes 出力は、ハッシュ ファイル (system.bit.0.sha256) です。

ステージ 4: ハッシュに署名

このステージは作成したパーティション ハッシュ ファイルから署名を作成します。

ステージ 4a: FSBL パーティション ハッシュに署名

xil_rsa_sign.exe gensig sk secondary.pem data zynq_fsbl_0.elf.0.sha256 -out zynq_fsbl_0.elf.0.sha256.sig

objcopy -I binary -O binary --reverse-bytes=256 zynq_fsbl_0.elf.0.sha256

#Generate FSBL signature using OpenSSL

openssl rsautl -raw -sign -inkey secondary.pem -in zynq_fsbl_0.elf.0.sha256

> zynq_fsbl_0.elf.0.sha256.sig

#Swap the bytes in FSBL signature

objcopy -I binary -O binary --reverse-bytes=256 zynq_fsbl_0.elf.0.sha256.sig 出力は、署名ファイル (zynq_fsbl_0.elf.0.sha256.sig) です。

ステージ 4b: ビットストリーム ハッシュに署名

xil_rsa_sign.exe -gensig -sk secondary.pem -data system.bit.0.sha256 -out system.bit.0.sha256.sig

または、OpenSSL プログラムを使用して署名を作成します。

#Swap the bytes in bitstream hash

objcopy -I binary -O binary --reverse-bytes=256 system.bit.0.sha256

#Generate bitstream signature using OpenSSL

openssl rsautl -raw -sign -inkey secondary.pem -in system.bit.0.sha256 >

system.bit.0.sha256.sig

#Swap the bytes in bitstream signature

objcopy -I binary -O binary --reverse-bytes=256 system.bit.0.sha256.sig 出力は、署名ファイル (system.bit.0.sha256.sig) です。

ステージ 5: パーティションの署名を挿入

上記のステージで作成したパーティションの署名を挿入し、認証証明に変更します。

ステージ 5a: FSBL 署名を挿入 stage5a.bif は次のとおりです。

stage5a:

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

[spksignature] secondary.pub.sha256.sig

[bootimage, authentication=rsa, presign=zynq_fsbl_0.elf.0.sha256.sig]

fsbl_e.bin }

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

bootgen -image stage5a.bif -w -o fsbl_e_ac.bin -efuseppkbits efuseppkbits.txt -nonbooting

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

[spksignature] secondary.pub.sha256.sig

[authentication=rsa, presign=system.bit.0.sha256.sig] system.bit }

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

bootgen -image stage5b.bif -o system_e_ac.bin –nonbooting 認証された出力ファイルは system_e_ac.bin です。

ステージ 6: ヘッダー テーブルのハッシュを生成

このステージは、ヘッダーテーブルのハッシュを生成します。

stage6.bif は次のとおりです。

stage6:

{ [bootimage] fsbl_e_ac.bin [bootimage] system_e_ac.bin }

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

bootgen -image stage6.bif -generate_hashes 出力ハッシュ ファイルは ImageHeaderTable.sha256 です。

ステージ 7: ヘッダー テーブル署名を生成

このステージは、ヘッダー テーブル署名を生成します。

xil_rsa_sign.exe gensig sk secondary.pem data ImageHeaderTable.sha256 -out ImageHeaderTable.sha256.sig

または、OpenSSL プログラムを使用して署名を作成します。

#Swap the bytes in header table hash

objcopy -I binary -O binary --reverse-bytes=256 ImageHeaderTable.sha256

#Generate header table signature using OpenSSL

openssl rsautl -raw -sign -inkey secondary.pem -in ImageHeaderTable.sha256

> ImageHeaderTable.sha256.sig

#Swap the bytes in header table signature

objcopy -I binary -O binary --reverse-bytes=256 ImageHeaderTable.sha256.sig 出力は、署名ファイル (ImageHeaderTable.sha256.sig) です。

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 デバイス ブート

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