1 /******************************************************************************
9 *****************************************************************************/
11 * Broadcom Corporation uBSec SDK
14 * Character device header file.
19 * October 2000 JTT Created.
22 #define MAX_PUBLIC_KEY_BITS (1024)
23 #define MAX_PUBLIC_KEY_BYTES (1024/8)
24 #define SHA_BIT_SIZE (160)
25 #define MAX_CRYPTO_KEY_LENGTH 24
26 #define MAX_MAC_KEY_LENGTH 64
27 #define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt")
28 #define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey")
30 /* Math command types. */
31 #define UBSEC_MATH_MODADD 0x0001
32 #define UBSEC_MATH_MODSUB 0x0002
33 #define UBSEC_MATH_MODMUL 0x0004
34 #define UBSEC_MATH_MODEXP 0x0008
35 #define UBSEC_MATH_MODREM 0x0010
36 #define UBSEC_MATH_MODINV 0x0020
38 typedef long ubsec_MathCommand_t
;
39 typedef long ubsec_RNGCommand_t
;
41 typedef struct ubsec_crypto_context_s
{
43 unsigned char crypto
[MAX_CRYPTO_KEY_LENGTH
];
44 unsigned char auth
[MAX_MAC_KEY_LENGTH
];
45 } ubsec_crypto_context_t
, *ubsec_crypto_context_p
;
48 * Predeclare the function pointer types that we dynamically load from the DSO.
51 typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n
, int bytes
);
53 typedef int t_UBSEC_ubsec_bits_to_bytes(int bits
);
55 typedef int t_UBSEC_ubsec_open(unsigned char *device
);
57 typedef int t_UBSEC_ubsec_close(int fd
);
59 typedef int t_UBSEC_diffie_hellman_generate_ioctl(int fd
,
64 unsigned char *g
, int g_len
,
65 unsigned char *m
, int m_len
,
70 typedef int t_UBSEC_diffie_hellman_agree_ioctl(int fd
,
71 unsigned char *x
, int x_len
,
72 unsigned char *y
, int y_len
,
73 unsigned char *m
, int m_len
,
74 unsigned char *k
, int *k_len
);
76 typedef int t_UBSEC_rsa_mod_exp_ioctl(int fd
,
77 unsigned char *x
, int x_len
,
78 unsigned char *m
, int m_len
,
79 unsigned char *e
, int e_len
,
80 unsigned char *y
, int *y_len
);
82 typedef int t_UBSEC_rsa_mod_exp_crt_ioctl(int fd
,
83 unsigned char *x
, int x_len
,
84 unsigned char *qinv
, int qinv_len
,
85 unsigned char *edq
, int edq_len
,
86 unsigned char *q
, int q_len
,
87 unsigned char *edp
, int edp_len
,
88 unsigned char *p
, int p_len
,
89 unsigned char *y
, int *y_len
);
91 typedef int t_UBSEC_dsa_sign_ioctl(int fd
,
92 int hash
, unsigned char *data
,
93 int data_len
, unsigned char *rndom
,
94 int random_len
, unsigned char *p
,
95 int p_len
, unsigned char *q
, int q_len
,
96 unsigned char *g
, int g_len
,
97 unsigned char *key
, int key_len
,
98 unsigned char *r
, int *r_len
,
99 unsigned char *s
, int *s_len
);
101 typedef int t_UBSEC_dsa_verify_ioctl(int fd
,
102 int hash
, unsigned char *data
,
103 int data_len
, unsigned char *p
,
104 int p_len
, unsigned char *q
, int q_len
,
105 unsigned char *g
, int g_len
,
106 unsigned char *key
, int key_len
,
107 unsigned char *r
, int r_len
,
108 unsigned char *s
, int s_len
,
109 unsigned char *v
, int *v_len
);
111 typedef int t_UBSEC_math_accelerate_ioctl(int fd
, ubsec_MathCommand_t command
,
112 unsigned char *ModN
, int *ModN_len
,
113 unsigned char *ExpE
, int *ExpE_len
,
114 unsigned char *ParamA
,
116 unsigned char *ParamB
,
118 unsigned char *Result
,
121 typedef int t_UBSEC_rng_ioctl(int fd
, ubsec_RNGCommand_t command
,
122 unsigned char *Result
, int *Result_len
);
124 typedef int t_UBSEC_max_key_len_ioctl(int fd
, int *max_key_len
);