OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
hw_ubsec.h
Go to the documentation of this file.
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 
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")
29 
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
37 
38 typedef long ubsec_MathCommand_t;
39 typedef long ubsec_RNGCommand_t;
40 
41 typedef struct ubsec_crypto_context_s {
42  unsigned int flags;
43  unsigned char crypto[MAX_CRYPTO_KEY_LENGTH];
44  unsigned char auth[MAX_MAC_KEY_LENGTH];
46 
47 /*
48  * Predeclare the function pointer types that we dynamically load from the DSO.
49  */
50 
51 typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes);
52 
54 
55 typedef int t_UBSEC_ubsec_open(unsigned char *device);
56 
57 typedef int t_UBSEC_ubsec_close(int fd);
58 
60  unsigned char *x, int *x_len, unsigned char *y, int *y_len,
61  unsigned char *g, int g_len, unsigned char *m, int m_len,
62  unsigned char *userX, int userX_len, int random_bits);
63 
65  unsigned char *x, int x_len, unsigned char *y, int y_len,
66  unsigned char *m, int m_len, unsigned char *k, int *k_len);
67 
68 typedef int t_UBSEC_rsa_mod_exp_ioctl (int fd,
69  unsigned char *x, int x_len, unsigned char *m, int m_len,
70  unsigned char *e, int e_len, unsigned char *y, int *y_len);
71 
72 typedef int t_UBSEC_rsa_mod_exp_crt_ioctl (int fd,
73  unsigned char *x, int x_len, unsigned char *qinv, int qinv_len,
74  unsigned char *edq, int edq_len, unsigned char *q, int q_len,
75  unsigned char *edp, int edp_len, unsigned char *p, int p_len,
76  unsigned char *y, int *y_len);
77 
78 typedef int t_UBSEC_dsa_sign_ioctl (int fd,
79  int hash, unsigned char *data, int data_len,
80  unsigned char *rndom, int random_len,
81  unsigned char *p, int p_len, unsigned char *q, int q_len,
82  unsigned char *g, int g_len, unsigned char *key, int key_len,
83  unsigned char *r, int *r_len, unsigned char *s, int *s_len);
84 
85 typedef int t_UBSEC_dsa_verify_ioctl (int fd,
86  int hash, unsigned char *data, int data_len,
87  unsigned char *p, int p_len, unsigned char *q, int q_len,
88  unsigned char *g, int g_len, unsigned char *key, int key_len,
89  unsigned char *r, int r_len, unsigned char *s, int s_len,
90  unsigned char *v, int *v_len);
91 
93  unsigned char *ModN, int *ModN_len, unsigned char *ExpE, int *ExpE_len,
94  unsigned char *ParamA, int *ParamA_len, unsigned char *ParamB, int *ParamB_len,
95  unsigned char *Result, int *Result_len);
96 
97 typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command,
98  unsigned char *Result, int *Result_len);
99 
100 typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len);