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