aboutsummaryrefslogtreecommitdiff
path: root/openssl/engines/vendor_defns/hw_ubsec.h
blob: b6619d40f2fa0575ab26fb592426eb970233d184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/******************************************************************************
 *
 *  Copyright 2000
 *  Broadcom Corporation
 *  16215 Alton Parkway
 *  PO Box 57013
 *  Irvine CA 92619-7013
 *
 *****************************************************************************/
/* 
 * Broadcom Corporation uBSec SDK 
 */
/*
 * Character device header file.
 */
/*
 * Revision History:
 *
 * October 2000 JTT Created.
 */

#define MAX_PUBLIC_KEY_BITS (1024)
#define MAX_PUBLIC_KEY_BYTES (1024/8)
#define SHA_BIT_SIZE  (160)
#define MAX_CRYPTO_KEY_LENGTH 24
#define MAX_MAC_KEY_LENGTH 64
#define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt")
#define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey")

/* Math command types. */
#define UBSEC_MATH_MODADD 0x0001
#define UBSEC_MATH_MODSUB 0x0002
#define UBSEC_MATH_MODMUL 0x0004
#define UBSEC_MATH_MODEXP 0x0008
#define UBSEC_MATH_MODREM 0x0010
#define UBSEC_MATH_MODINV 0x0020

typedef long ubsec_MathCommand_t;
typedef long ubsec_RNGCommand_t;

typedef struct ubsec_crypto_context_s {
	unsigned int	flags;
	unsigned char	crypto[MAX_CRYPTO_KEY_LENGTH];
	unsigned char 	auth[MAX_MAC_KEY_LENGTH];
} ubsec_crypto_context_t, *ubsec_crypto_context_p;

/* 
 * Predeclare the function pointer types that we dynamically load from the DSO.
 */

typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes);

typedef int t_UBSEC_ubsec_bits_to_bytes(int bits);

typedef int t_UBSEC_ubsec_open(unsigned char *device);

typedef int t_UBSEC_ubsec_close(int fd);

typedef int t_UBSEC_diffie_hellman_generate_ioctl (int fd,
	unsigned char *x, int *x_len, unsigned char *y, int *y_len, 
	unsigned char *g, int g_len, unsigned char *m, int m_len,
	unsigned char *userX, int userX_len, int random_bits);

typedef int t_UBSEC_diffie_hellman_agree_ioctl (int fd,
	unsigned char *x, int x_len, unsigned char *y, int y_len, 
	unsigned char *m, int m_len, unsigned char *k, int *k_len);

typedef int t_UBSEC_rsa_mod_exp_ioctl (int fd,
	unsigned char *x, int x_len, unsigned char *m, int m_len,
	unsigned char *e, int e_len, unsigned char *y, int *y_len);

typedef int t_UBSEC_rsa_mod_exp_crt_ioctl (int fd,
	unsigned char *x, int x_len, unsigned char *qinv, int qinv_len,
	unsigned char *edq, int edq_len, unsigned char *q, int q_len,
	unsigned char *edp, int edp_len, unsigned char *p, int p_len,
	unsigned char *y, int *y_len);

typedef int t_UBSEC_dsa_sign_ioctl (int fd,
	int hash, unsigned char *data, int data_len, 
	unsigned char *rndom, int random_len, 
	unsigned char *p, int p_len, unsigned char *q, int q_len,
	unsigned char *g, int g_len, unsigned char *key, int key_len,
	unsigned char *r, int *r_len, unsigned char *s, int *s_len);

typedef int t_UBSEC_dsa_verify_ioctl (int fd,
	int hash, unsigned char *data, int data_len,
	unsigned char *p, int p_len, unsigned char *q, int q_len,
	unsigned char *g, int g_len, unsigned char *key, int key_len,
	unsigned char *r, int r_len, unsigned char *s, int s_len,
	unsigned char *v, int *v_len);

typedef int t_UBSEC_math_accelerate_ioctl(int fd, ubsec_MathCommand_t command,
	unsigned char *ModN, int *ModN_len, unsigned char *ExpE, int *ExpE_len, 
	unsigned char *ParamA, int *ParamA_len, unsigned char *ParamB, int *ParamB_len,
	unsigned char *Result, int *Result_len);

typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command,
	unsigned char *Result, int *Result_len);

typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len);