2
0

hw_ubsec.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /******************************************************************************
  2. *
  3. * Copyright 2000
  4. * Broadcom Corporation
  5. * 16215 Alton Parkway
  6. * PO Box 57013
  7. * Irvine CA 92619-7013
  8. *
  9. *****************************************************************************/
  10. /*
  11. * Broadcom Corporation uBSec SDK
  12. */
  13. /*
  14. * Character device header file.
  15. */
  16. /*
  17. * Revision History:
  18. *
  19. * October 2000 JTT Created.
  20. */
  21. #define MAX_PUBLIC_KEY_BITS (1024)
  22. #define MAX_PUBLIC_KEY_BYTES (1024/8)
  23. #define SHA_BIT_SIZE (160)
  24. #define MAX_CRYPTO_KEY_LENGTH 24
  25. #define MAX_MAC_KEY_LENGTH 64
  26. #define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt")
  27. #define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey")
  28. /* Math command types. */
  29. #define UBSEC_MATH_MODADD 0x0001
  30. #define UBSEC_MATH_MODSUB 0x0002
  31. #define UBSEC_MATH_MODMUL 0x0004
  32. #define UBSEC_MATH_MODEXP 0x0008
  33. #define UBSEC_MATH_MODREM 0x0010
  34. #define UBSEC_MATH_MODINV 0x0020
  35. typedef long ubsec_MathCommand_t;
  36. typedef long ubsec_RNGCommand_t;
  37. typedef struct ubsec_crypto_context_s {
  38. unsigned int flags;
  39. unsigned char crypto[MAX_CRYPTO_KEY_LENGTH];
  40. unsigned char auth[MAX_MAC_KEY_LENGTH];
  41. } ubsec_crypto_context_t, *ubsec_crypto_context_p;
  42. /*
  43. * Predeclare the function pointer types that we dynamically load from the DSO.
  44. */
  45. typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes);
  46. typedef int t_UBSEC_ubsec_bits_to_bytes(int bits);
  47. typedef int t_UBSEC_ubsec_open(unsigned char *device);
  48. typedef int t_UBSEC_ubsec_close(int fd);
  49. typedef int t_UBSEC_diffie_hellman_generate_ioctl(int fd,
  50. unsigned char *x,
  51. int *x_len,
  52. unsigned char *y,
  53. int *y_len,
  54. unsigned char *g, int g_len,
  55. unsigned char *m, int m_len,
  56. unsigned char *userX,
  57. int userX_len,
  58. int random_bits);
  59. typedef int t_UBSEC_diffie_hellman_agree_ioctl(int fd,
  60. unsigned char *x, int x_len,
  61. unsigned char *y, int y_len,
  62. unsigned char *m, int m_len,
  63. unsigned char *k, int *k_len);
  64. typedef int t_UBSEC_rsa_mod_exp_ioctl(int fd,
  65. unsigned char *x, int x_len,
  66. unsigned char *m, int m_len,
  67. unsigned char *e, int e_len,
  68. unsigned char *y, int *y_len);
  69. typedef int t_UBSEC_rsa_mod_exp_crt_ioctl(int fd,
  70. unsigned char *x, int x_len,
  71. unsigned char *qinv, int qinv_len,
  72. unsigned char *edq, int edq_len,
  73. unsigned char *q, int q_len,
  74. unsigned char *edp, int edp_len,
  75. unsigned char *p, int p_len,
  76. unsigned char *y, int *y_len);
  77. typedef int t_UBSEC_dsa_sign_ioctl(int fd,
  78. int hash, unsigned char *data,
  79. int data_len, unsigned char *rndom,
  80. int random_len, unsigned char *p,
  81. int p_len, unsigned char *q, int q_len,
  82. unsigned char *g, int g_len,
  83. unsigned char *key, int key_len,
  84. unsigned char *r, int *r_len,
  85. unsigned char *s, int *s_len);
  86. typedef int t_UBSEC_dsa_verify_ioctl(int fd,
  87. int hash, unsigned char *data,
  88. int data_len, unsigned char *p,
  89. int p_len, unsigned char *q, int q_len,
  90. unsigned char *g, int g_len,
  91. unsigned char *key, int key_len,
  92. unsigned char *r, int r_len,
  93. unsigned char *s, int s_len,
  94. unsigned char *v, int *v_len);
  95. typedef int t_UBSEC_math_accelerate_ioctl(int fd, ubsec_MathCommand_t command,
  96. unsigned char *ModN, int *ModN_len,
  97. unsigned char *ExpE, int *ExpE_len,
  98. unsigned char *ParamA,
  99. int *ParamA_len,
  100. unsigned char *ParamB,
  101. int *ParamB_len,
  102. unsigned char *Result,
  103. int *Result_len);
  104. typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command,
  105. unsigned char *Result, int *Result_len);
  106. typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len);