1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (C) 2020 ARM Limited 3 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <sys/auxv.h> 7 8 #include "helper.h" 9 main(void)10int main(void) 11 { 12 struct signatures signed_vals; 13 unsigned long hwcaps; 14 size_t val; 15 16 fread(&val, sizeof(size_t), 1, stdin); 17 18 /* don't try to execute illegal (unimplemented) instructions) caller 19 * should have checked this and keep worker simple 20 */ 21 hwcaps = getauxval(AT_HWCAP); 22 23 if (hwcaps & HWCAP_PACA) { 24 signed_vals.keyia = keyia_sign(val); 25 signed_vals.keyib = keyib_sign(val); 26 signed_vals.keyda = keyda_sign(val); 27 signed_vals.keydb = keydb_sign(val); 28 } 29 signed_vals.keyg = (hwcaps & HWCAP_PACG) ? keyg_sign(val) : 0; 30 31 fwrite(&signed_vals, sizeof(struct signatures), 1, stdout); 32 33 return 0; 34 } 35