xref: /rk3399_ARM-atf/plat/arm/board/common/protpk/arm_dev_protpk.S (revision 5808766210f4e127d150c9165dcd14c644c5bc9d)
132e26c06SSandrine Bailleux/*
2*da57b6e3SRyan Everett * Copyright (c) 2024, Arm Limited. All rights reserved.
332e26c06SSandrine Bailleux *
432e26c06SSandrine Bailleux * SPDX-License-Identifier: BSD-3-Clause
532e26c06SSandrine Bailleux */
632e26c06SSandrine Bailleux
732e26c06SSandrine Bailleux	.global arm_protpk_hash
832e26c06SSandrine Bailleux	.global arm_protpk_hash_end
932e26c06SSandrine Bailleux
1032e26c06SSandrine Bailleux	.section .rodata.arm_protpk_hash, "a"
1132e26c06SSandrine Bailleux
12*da57b6e3SRyan Everett/*
13*da57b6e3SRyan Everett* The protpk header is dependent only on the algorithm used to
14*da57b6e3SRyan Everett* generate the hash.
15*da57b6e3SRyan Everett* ASN1_HASH_ALG is the last byte used to encode the OID for
16*da57b6e3SRyan Everett* the hash algorithm into the header,
17*da57b6e3SRyan Everett* this byte distinguishes between SHA256, SHA384 and SHA512.
18*da57b6e3SRyan Everett*/
19*da57b6e3SRyan Everett.equ HASH_ASN1_LEN, ARM_ROTPK_HASH_LEN
20*da57b6e3SRyan Everett#if ARM_ROTPK_HASH_LEN == 48
21*da57b6e3SRyan Everett	.equ ASN1_HASH_ALG, 0x02
22*da57b6e3SRyan Everett	.equ TOTAL_ASN1_LEN, 0x41
23*da57b6e3SRyan Everett#elif ARM_ROTPK_HASH_LEN == 64
24*da57b6e3SRyan Everett	.equ ASN1_HASH_ALG, 0x03
25*da57b6e3SRyan Everett	.equ TOTAL_ASN1_LEN, 0x51
26*da57b6e3SRyan Everett#elif ARM_ROTPK_HASH_LEN == 32
27*da57b6e3SRyan Everett	.equ ASN1_HASH_ALG, 0x01
28*da57b6e3SRyan Everett	.equ TOTAL_ASN1_LEN, 0x31
29*da57b6e3SRyan Everett#else
30*da57b6e3SRyan Everett	.error "Invalid PROTPK hash length."
31*da57b6e3SRyan Everett#endif
32*da57b6e3SRyan Everett
3332e26c06SSandrine Bailleuxarm_protpk_hash:
3432e26c06SSandrine Bailleux	/* DER header. */
35*da57b6e3SRyan Everett	.byte 0x30, TOTAL_ASN1_LEN, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
36*da57b6e3SRyan Everett	.byte 0x01, 0x65, 0x03, 0x04, 0x02, ASN1_HASH_ALG, 0x05, 0x00, 0x04, HASH_ASN1_LEN
3732e26c06SSandrine Bailleux	/* Key hash. */
38*da57b6e3SRyan Everett	.incbin ARM_PROTPK
3932e26c06SSandrine Bailleuxarm_protpk_hash_end:
40