From a9e13a2d693cca40c1892641129558f163970a1c Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Tue, 15 Feb 2022 13:50:30 +0000 Subject: [PATCH] genprotimg: introduce macro for the control flags and sort them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a private macro for the calculation of the control flags and sort the flags by bit value. Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner --- genprotimg/src/include/pv_hdr_def.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/genprotimg/src/include/pv_hdr_def.h b/genprotimg/src/include/pv_hdr_def.h index 79d4252f..270de0d0 100644 --- a/genprotimg/src/include/pv_hdr_def.h +++ b/genprotimg/src/include/pv_hdr_def.h @@ -24,11 +24,14 @@ #define PV_MAGIC_NUMBER 0x49424d5365634578ULL #define PV_VERSION_1 0x00000100U +/* Internal helper macro */ +#define __PV_BIT(nr) (1ULL << (63 - (nr))) + /* Plaintext control flags */ -#define PV_PCF_PCKM_ECC (1ULL << 5) /* PCKMO encrypt-ECC-key functions allowed */ -#define PV_PCF_PCKMO_AES (1ULL << 6) /* PCKMO encrypt-AES-key functions allowed */ -#define PV_PCF_PCKMO_DEA_TDEA (1ULL << 7) /* PCKMO encrypt-DEA/TDEA-key functions allowed */ -#define PV_PCF_NO_DECRYPTION (1ULL << 28) /* prevent Ultravisor decryption during unpack operation */ +#define PV_PCF_NO_DECRYPTION __PV_BIT(35) /* prevent Ultravisor decryption during unpack operation */ +#define PV_PCF_PCKMO_DEA_TDEA __PV_BIT(56) /* PCKMO encrypt-DEA/TDEA-key functions allowed */ +#define PV_PCF_PCKMO_AES __PV_BIT(57) /* PCKMO encrypt-AES-key functions allowed */ +#define PV_PCF_PCKM_ECC __PV_BIT(58) /* PCKMO encrypt-ECC-key functions allowed */ /* maxima for the PV version 1 */ #define PV_V1_IPIB_MAX_SIZE PAGE_SIZE