diff options
Diffstat (limited to 'src/include/securerom/ROM.H')
-rw-r--r-- | src/include/securerom/ROM.H | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/include/securerom/ROM.H b/src/include/securerom/ROM.H index 315a436d0..808a87468 100644 --- a/src/include/securerom/ROM.H +++ b/src/include/securerom/ROM.H @@ -22,41 +22,36 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -/**************************************************************************** - * - ****************************************************************************/ + #ifndef ROM_H #define ROM_H -/****************************************************************************/ -#ifndef PHYPLIBFUNCTIONS -#include <hw_utils.h> -#endif -#include <sha512.h> -#include <ecverify.h> +#include <securerom/hw_utils.H> +#include <securerom/sha512.H> +#include <securerom/ecverify.H> -/****************************************************************************/ #define CONTAINER_VERSION 1 #define HEADER_VERSION 1 #define HASH_ALG_SHA512 1 #define SIG_ALG_ECDSA521 1 -#define HBI_BASE_SIGNING_KEY 0x80000000 - #define ROM_MAGIC_NUMBER 0x17082011 -typedef struct { +typedef struct +{ uint16_t version; // (1: see versions above) uint8_t hash_alg; // (1: SHA-512) uint8_t sig_alg; // (1: SHA-512/ECDSA-521) }__attribute__((packed)) ROM_version_raw; -typedef struct { +typedef struct +{ uint32_t magic_number; // (17082011) uint16_t version; // (1: see versions above) uint64_t container_size; // filled by caller uint64_t target_hrmor; // filled by caller - uint64_t stack_pointer; // filled by caller //bottom of stack -> 128k added by rom code to get real stack pointer + //bottom of stack -> 128k added by rom code to get real stack pointer + uint64_t stack_pointer; // filled by caller ecc_key_t hw_pkey_a; ecc_key_t hw_pkey_b; ecc_key_t hw_pkey_c; @@ -65,7 +60,8 @@ typedef struct { // followed by optional unprotected payload data }__attribute__((packed)) ROM_container_raw; -typedef struct { +typedef struct +{ ROM_version_raw ver_alg; uint64_t code_start_offset; uint64_t reserved; @@ -74,13 +70,16 @@ typedef struct { uint64_t payload_size; sha2_hash_t payload_hash; uint8_t ecid_count; - uint8_t ecid[ECID_SIZE]; // optional ecid place holder ecid_count * ecid_size(128 bits) + // optional ecid place holder ecid_count * ecid_size(128 bits) + uint8_t ecid[ECID_SIZE]; // followed by prefix data (sig,keys) key raw }__attribute__((packed)) ROM_prefix_header_raw; -#define PREFIX_HEADER_SIZE(_p) (sizeof(ROM_prefix_header_raw)+((_p->ecid_count-1)*ECID_SIZE)) +#define PREFIX_HEADER_SIZE(_p) (sizeof(ROM_prefix_header_raw) \ + +((_p->ecid_count-1)*ECID_SIZE)) -typedef struct { +typedef struct +{ ecc_signature_t hw_sig_a; ecc_signature_t hw_sig_b; ecc_signature_t hw_sig_c; @@ -89,7 +88,8 @@ typedef struct { ecc_key_t sw_pkey_r; }__attribute__((packed)) ROM_prefix_data_raw; -typedef struct { +typedef struct +{ ROM_version_raw ver_alg; uint64_t code_start_offset; uint64_t reserved; @@ -98,13 +98,16 @@ typedef struct { uint64_t payload_size; sha2_hash_t payload_hash; uint8_t ecid_count; - uint8_t ecid[ECID_SIZE]; // optional ecid place holder ecid_count * ecid_size(128 bits) + // optional ecid place holder ecid_count * ecid_size(128 bits) + uint8_t ecid[ECID_SIZE]; // followed by sw sig raw }__attribute__((packed)) ROM_sw_header_raw; -#define SW_HEADER_SIZE(_p) (sizeof(ROM_sw_header_raw)+((_p->ecid_count-1)*ECID_SIZE)) +#define SW_HEADER_SIZE(_p) (sizeof(ROM_sw_header_raw) \ + +((_p->ecid_count-1)*ECID_SIZE)) -typedef struct { +typedef struct +{ ecc_signature_t sw_sig_p; ecc_signature_t sw_sig_q; ecc_signature_t sw_sig_r; @@ -113,21 +116,18 @@ typedef struct { // followed by unprotected sw payload_text }__attribute__((packed)) ROM_sw_sig_raw; -/****************************************************************************/ -typedef enum { ROM_DONE, ROM_FAILED, PHYP_PARTIAL } ROM_response; +typedef enum { ROM_DONE, ROM_FAILED } ROM_response; -#ifndef PHYPLIBFUNCTIONS -typedef struct { +typedef struct +{ sha2_hash_t hw_key_hash; uint8_t my_ecid[ECID_SIZE]; uint64_t entry_point; uint64_t log; }__attribute__((packed)) ROM_hw_params; -//extern void ROM_instruction_start (void); extern void ROM_sreset (void); -extern ROM_response ROM_verify (ROM_container_raw* container, - ROM_hw_params* params); -#endif +extern "C" ROM_response ROM_verify (ROM_container_raw* container, + ROM_hw_params* params); #endif |