sec_cust_struct.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _CUST_SEC_H
  2. #define _CUST_SEC_H
  3. /**************************************************************************
  4. * RSA PKCS01 CONTROL
  5. **************************************************************************/
  6. #define RSA_KEY_LEN_2048 (0)
  7. #define RSA_KEY_LEN_1024 (1)
  8. /**************************************************************************
  9. * RSA PKCS01 CHECKING
  10. **************************************************************************/
  11. #if RSA_KEY_LEN_2048
  12. #if RSA_KEY_LEN_1024
  13. #error "RSA_KEY_LEN_1024 should be disabled"
  14. #endif
  15. #endif
  16. #if RSA_KEY_LEN_1024
  17. #if RSA_KEY_LEN_2048
  18. #error "RSA_KEY_LEN_2048 should be disabled"
  19. #endif
  20. #endif
  21. /**************************************************************************
  22. * RSA PKCS01 CONFIGURATION
  23. **************************************************************************/
  24. #define RSA_KEY_MAX_LEN (128) /* bytes */
  25. #define RSA_E_KEY_LEN (5) /* bytes */
  26. #if RSA_KEY_LEN_2048
  27. #define RSA_KEY_LEN (256) /* bytes */
  28. #define HASH_LEN (32) /* bytes */
  29. #elif RSA_KEY_LEN_1024
  30. #define RSA_KEY_LEN (128) /* bytes */
  31. #define HASH_LEN (20) /* bytes */
  32. #else
  33. #error "RSA_KEY_LEN is not defined"
  34. #endif
  35. /**************************************************************************
  36. * CUSTOMER INTERFACE
  37. **************************************************************************/
  38. typedef struct _CUST_SEC_INTER {
  39. /* key to sign image patch */
  40. unsigned char key_rsa_n[RSA_KEY_MAX_LEN * 2]; /* string. number base = 16 */
  41. unsigned char key_rsa_d[RSA_KEY_MAX_LEN * 2]; /* string. number base = 16 */
  42. unsigned char key_rsa_e[RSA_E_KEY_LEN]; /* string. number base = 16 */
  43. } CUST_SEC_INTER;
  44. #endif /* _CUST_SEC_H */