Guest User

Untitled

a guest
Feb 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. #ifndef _UBOOT_SB20_S5PC210S_H
  2. #define _UBOOT_SB20_S5PC210S_H
  3.  
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8.  
  9. ////////////////////////////////////////////////////////////////////////
  10. // SecureBoot return value define
  11. #define SB_OK 0x00000000
  12. #define SB_OFF 0x80000000
  13.  
  14. //------------------------------------------------------------------------
  15. #define SB_ERROR_VALIDATE_PUBLIC_KEY_INFO 0xFFF10000
  16. #define SB_ERROR_VERIFY_PSS_RSA_SIGNATURE 0xFFF20000
  17. #define SB_ERROR_CHECK_INTEGRITY_CODE 0xFFF30000
  18.  
  19. //------------------------------------------------------------------------
  20. // added for Secure Boot 2.0
  21. #define SB_ERROR_GENERATE_PSS_RSA_SIGNATURE 0xFFF40000
  22. #define SB_ERROR_GENERATE_PUBLIC_KEY_INFO 0xFFF50000
  23. #define SB_ERROR_GENERATE_SB_CONTEXT 0xFFF60000
  24. #define SB_ERROR_ENCRYPTION 0xFFF70000
  25.  
  26. #define SB_ERROR_AES_PARM 0x0000A000
  27. #define SB_ERROR_AES_SET_ALGO 0x0000B000
  28. #define SB_ERROR_AES_ENCRYPT 0x0000C000
  29. #define SB_ERROR_AES_DECRYPT 0x0000D000
  30.  
  31. //------------------------------------------------------------------------
  32. #define SB_ERROR_HMAC_SHA1_SET_INFO 0x00000010
  33. #define SB_ERROR_HMAC_SHA1_INIT 0x00000020
  34. #define SB_ERROR_HMAC_SHA1_UPDATE 0x00000030
  35. #define SB_ERROR_HMAC_SHA1_FINAL 0x00000040
  36. #define SB_ERROR_MEM_CMP 0x00000050
  37. #define SB_ERROR_SHA1_INIT 0x00000060
  38. #define SB_ERROR_SHA1_UPDATE 0x00000070
  39. #define SB_ERROR_SHA1_FINAL 0x00000080
  40. #define SB_ERROR_VERIFY_RSA_PSS 0x00000090
  41.  
  42. ////////////////////////////////////////////////////////////////////////
  43. //-------------------------------------------
  44. #define SB20_MAX_EFUSE_DATA_LEN 20
  45.  
  46. #define SB20_MAX_RSA_KEY (2048/8)
  47. #define SB20_MAX_SIGN_LEN SB20_MAX_RSA_KEY
  48.  
  49. #define SB20_HMAC_SHA1_LEN 20
  50.  
  51. //-------------------------------------------
  52. typedef struct
  53. {
  54. int rsa_n_Len; //4
  55. unsigned char rsa_n[SB20_MAX_RSA_KEY]; //256
  56. int rsa_e_Len; //4
  57. unsigned char rsa_e[4]; //4
  58. } SB20_RSAPubKey; //268
  59.  
  60. typedef struct
  61. {
  62. int rsa_n_Len;
  63. unsigned char rsa_n[SB20_MAX_RSA_KEY];
  64. int rsa_d_Len;
  65. unsigned char rsa_d[SB20_MAX_RSA_KEY];
  66. } SB20_RSAPrivKey;
  67.  
  68. //-------------------------------------------
  69. typedef struct
  70. {
  71. SB20_RSAPubKey rsaPubKey; //268
  72. unsigned char signedData[SB20_HMAC_SHA1_LEN]; //20
  73. } SB20_PubKeyInfo; //288
  74.  
  75. //-------------------------------------------
  76. typedef struct
  77. {
  78. SB20_RSAPubKey stage2PubKey; //268
  79. int code_SignedDataLen; //4
  80. unsigned char code_SignedData[SB20_MAX_SIGN_LEN]; //256
  81. SB20_PubKeyInfo pubKeyInfo; //288
  82. unsigned char func_ptr_BaseAddr[64]; //64
  83. unsigned char reservedData[144]; //144
  84. } SB20_CONTEXT; //1024
  85.  
  86.  
  87. ////////////////////////////////////////////////////////////////////////
  88. // Verify integrity of BL2(or OS) Image.
  89. int Check_Signature (
  90. SB20_CONTEXT *sb20_Context,
  91. unsigned char *codeImage,
  92. int codeImageLen,
  93. unsigned char *signedData,
  94. int signedDataLen );
  95.  
  96. ///////////////////////////////////////////////////////////////////////////////////
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100.  
  101. #endif /* _UBOOT_SB20_S5PC210S_H */
Add Comment
Please, Sign In to add comment