/
crypto_internal.h
107 lines (88 loc) · 2.72 KB
/
crypto_internal.h
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
101
102
103
104
105
106
107
#ifndef _CRYPTO_INTERNAL_H_
#define _CRYPTO_INTERNAL_H_
#include <stdint.h>
#include <openssl/aes.h>
#include <openssl/rsa.h>
struct crypto_hmac_key {
size_t len;
uint8_t * key;
};
/* Diffie-Hellman group #14, from RFC 3526. */
extern uint8_t crypto_dh_group14[];
/**
* crypto_keys_lookup_RSA(key):
* Return the requested RSA key.
*/
RSA * crypto_keys_lookup_RSA(int);
/**
* crypto_keys_lookup_HMAC(key):
* Return the requested HMAC key.
*/
struct crypto_hmac_key * crypto_keys_lookup_HMAC(int);
/**
* crypto_keys_server_import_root():
* Import the public part of the server root key.
*/
int crypto_keys_server_import_root(void);
/**
* crypto_keys_subr_import_RSA_priv(key, buf, buflen):
* Import the specified RSA private key from the provided buffer.
*/
int crypto_keys_subr_import_RSA_priv(RSA **, uint8_t *, size_t);
/**
* crypto_keys_subr_import_RSA_pub(key, buf, buflen):
* Import the specified RSA public key from the provided buffer.
*/
int crypto_keys_subr_import_RSA_pub(RSA **, uint8_t *, size_t);
/**
* crypto_keys_subr_import_HMAC(key, buf, buflen):
* Import the specified HMAC key from the provided buffer.
*/
int crypto_keys_subr_import_HMAC(struct crypto_hmac_key **, uint8_t *,
size_t);
/**
* crypto_keys_subr_export_RSA_priv(key, buf, buflen):
* If buf != NULL, export the specified RSA private key. Return the key
* length in bytes.
*/
uint32_t crypto_keys_subr_export_RSA_priv(RSA *, uint8_t *, size_t);
/**
* crypto_keys_subr_export_RSA_pub(key, buf, buflen):
* If buf != NULL, export the specified RSA public key. Return the key
* length in bytes.
*/
uint32_t crypto_keys_subr_export_RSA_pub(RSA *, uint8_t *, size_t);
/**
* crypto_keys_subr_export_HMAC(key, buf, buflen):
* If buf != NULL, export the specified HMAC key. Return the key length
* in bytes.
*/
uint32_t crypto_keys_subr_export_HMAC(struct crypto_hmac_key *, uint8_t *,
size_t);
/**
* crypto_keys_subr_generate_RSA(priv, pub):
* Generate an RSA key and store the private and public parts.
*/
int crypto_keys_subr_generate_RSA(RSA **, RSA **);
/**
* crypto_keys_subr_generate_HMAC(key):
* Generate an HMAC key.
*/
int crypto_keys_subr_generate_HMAC(struct crypto_hmac_key **);
/**
* crypto_file_init_keys():
* Initialize the keys cached by crypto_file.
*/
int crypto_file_init_keys(void);
/**
* crypto_MGF1(seed, seedlen, buf, buflen):
* The MGF1 mask generation fcuntion, as specified in RFC 3447.
*/
void crypto_MGF1(uint8_t *, size_t, uint8_t *, size_t);
/**
* crypto_dh_generate_pub(pub, priv):
* Compute ${pub} equal to 2^(2^258 + ${priv}) in Diffie-Hellman group #14.
*/
int crypto_dh_generate_pub(uint8_t[ /* CRYPTO_DH_PUBLEN */ ],
const uint8_t[ /* CRYPTO_DH_PRIVLEN */ ]);
#endif /* !_CRYPTO_INTERNAL_H_ */