xref: /OK3568_Linux_fs/kernel/crypto/fips140-refs.S (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun/* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun/*
3*4882a593Smuzhiyun * Copyright 2021 Google LLC
4*4882a593Smuzhiyun * Author: Ard Biesheuvel <ardb@google.com>
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * This file contains the variable definitions that will be used by the FIPS140
7*4882a593Smuzhiyun * s/w module to access the RELA sections in the ELF image. These are used to
8*4882a593Smuzhiyun * apply the relocations applied by the module loader in reverse, so that we
9*4882a593Smuzhiyun * can reconstruct the image that was used to derive the HMAC used by the
10*4882a593Smuzhiyun * integrity check.
11*4882a593Smuzhiyun *
12*4882a593Smuzhiyun * The first .long of each entry will be populated by the module loader based
13*4882a593Smuzhiyun * on the actual placement of the respective RELA section in memory. The second
14*4882a593Smuzhiyun * .long carries the RELA entry count, and is populated by the host tool that
15*4882a593Smuzhiyun * also generates the HMAC of the contents of .text and .rodata.
16*4882a593Smuzhiyun */
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun#include <linux/linkage.h>
19*4882a593Smuzhiyun#include <asm/assembler.h>
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun	.section	".init.rodata", "a"
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun	.align	2
24*4882a593Smuzhiyun	.globl	fips140_rela_text
25*4882a593Smuzhiyunfips140_rela_text:
26*4882a593Smuzhiyun	.weak	__sec_rela_text
27*4882a593Smuzhiyun	.long	__sec_rela_text - .
28*4882a593Smuzhiyun	.long	0
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun	.globl	fips140_rela_rodata
31*4882a593Smuzhiyunfips140_rela_rodata:
32*4882a593Smuzhiyun	.weak	__sec_rela_rodata
33*4882a593Smuzhiyun	.long	__sec_rela_rodata - .
34*4882a593Smuzhiyun	.long	0
35