Browse Source

[crypto] Remove AXTLS headers

Remove AXTLS headers now that no AXTLS code remains, with many thanks
to the AXTLS project for use of their cryptography code over the past
several years.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
657dd5f76d

+ 0
- 99
src/crypto/axtls/bigint.h View File

@@ -1,99 +0,0 @@
1
-/*
2
- * Copyright (c) 2007, Cameron Rich
3
- *
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are met:
8
- *
9
- * * Redistributions of source code must retain the above copyright notice,
10
- *   this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright notice,
12
- *   this list of conditions and the following disclaimer in the documentation
13
- *   and/or other materials provided with the distribution.
14
- * * Neither the name of the axTLS project nor the names of its contributors
15
- *   may be used to endorse or promote products derived from this software
16
- *   without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
-#ifndef BIGINT_HEADER
32
-#define BIGINT_HEADER
33
-
34
-#include "crypto.h"
35
-
36
-BI_CTX *bi_initialize(void);
37
-void bi_terminate(BI_CTX *ctx);
38
-void bi_permanent(bigint *bi);
39
-void bi_depermanent(bigint *bi);
40
-void bi_clear_cache(BI_CTX *ctx);
41
-void bi_free(BI_CTX *ctx, bigint *bi);
42
-bigint *bi_copy(bigint *bi);
43
-bigint *bi_clone(BI_CTX *ctx, const bigint *bi);
44
-void bi_export(BI_CTX *ctx, bigint *bi, uint8_t *data, int size);
45
-bigint *bi_import(BI_CTX *ctx, const uint8_t *data, int len);
46
-bigint *int_to_bi(BI_CTX *ctx, comp i);
47
-
48
-/* the functions that actually do something interesting */
49
-bigint *bi_add(BI_CTX *ctx, bigint *bia, bigint *bib);
50
-bigint *bi_subtract(BI_CTX *ctx, bigint *bia, 
51
-        bigint *bib, int *is_negative);
52
-bigint *bi_divide(BI_CTX *ctx, bigint *bia, bigint *bim, int is_mod);
53
-bigint *bi_multiply(BI_CTX *ctx, bigint *bia, bigint *bib);
54
-bigint *bi_mod_power(BI_CTX *ctx, bigint *bi, bigint *biexp);
55
-bigint *bi_mod_power2(BI_CTX *ctx, bigint *bi, bigint *bim, bigint *biexp);
56
-int bi_compare(bigint *bia, bigint *bib);
57
-void bi_set_mod(BI_CTX *ctx, bigint *bim, int mod_offset);
58
-void bi_free_mod(BI_CTX *ctx, int mod_offset);
59
-
60
-#ifdef CONFIG_SSL_FULL_MODE
61
-void bi_print(const char *label, bigint *bi);
62
-bigint *bi_str_import(BI_CTX *ctx, const char *data);
63
-#endif
64
-
65
-/**
66
- * @def bi_mod
67
- * Find the residue of B. bi_set_mod() must be called before hand.
68
- */
69
-#define bi_mod(A, B)      bi_divide(A, B, ctx->bi_mod[ctx->mod_offset], 1)
70
-
71
-/**
72
- * bi_residue() is technically the same as bi_mod(), but it uses the
73
- * appropriate reduction technique (which is bi_mod() when doing classical
74
- * reduction).
75
- */
76
-#if defined(CONFIG_BIGINT_MONTGOMERY)
77
-#define bi_residue(A, B)         bi_mont(A, B)
78
-bigint *bi_mont(BI_CTX *ctx, bigint *bixy);
79
-#elif defined(CONFIG_BIGINT_BARRETT)
80
-#define bi_residue(A, B)         bi_barrett(A, B)
81
-bigint *bi_barrett(BI_CTX *ctx, bigint *bi);
82
-#else /* if defined(CONFIG_BIGINT_CLASSICAL) */
83
-#define bi_residue(A, B)         bi_mod(A, B)
84
-#endif
85
-
86
-#ifdef CONFIG_BIGINT_SQUARE
87
-bigint *bi_square(BI_CTX *ctx, bigint *bi);
88
-#else
89
-#define bi_square(A, B)     bi_multiply(A, bi_copy(B), B)
90
-#endif
91
-
92
-#ifdef CONFIG_BIGINT_CRT
93
-bigint *bi_crt(BI_CTX *ctx, bigint *bi,
94
-        bigint *dP, bigint *dQ,
95
-        bigint *p, bigint *q,
96
-        bigint *qInv);
97
-#endif
98
-
99
-#endif

+ 0
- 131
src/crypto/axtls/bigint_impl.h View File

@@ -1,131 +0,0 @@
1
-/*
2
- * Copyright (c) 2007, Cameron Rich
3
- *
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are met:
8
- *
9
- * * Redistributions of source code must retain the above copyright notice,
10
- *   this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright notice,
12
- *   this list of conditions and the following disclaimer in the documentation
13
- *   and/or other materials provided with the distribution.
14
- * * Neither the name of the axTLS project nor the names of its contributors
15
- *   may be used to endorse or promote products derived from this software
16
- *   without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
-#ifndef BIGINT_IMPL_HEADER
32
-#define BIGINT_IMPL_HEADER
33
-
34
-/* Maintain a number of precomputed variables when doing reduction */
35
-#define BIGINT_M_OFFSET     0    /**< Normal modulo offset. */
36
-#ifdef CONFIG_BIGINT_CRT
37
-#define BIGINT_P_OFFSET     1    /**< p modulo offset. */
38
-#define BIGINT_Q_OFFSET     2    /**< q module offset. */
39
-#define BIGINT_NUM_MODS     3    /**< The number of modulus constants used. */
40
-#else
41
-#define BIGINT_NUM_MODS     1    
42
-#endif
43
-
44
-/* Architecture specific functions for big ints */
45
-#if defined(CONFIG_INTEGER_8BIT)
46
-#define COMP_RADIX          256U       /**< Max component + 1 */
47
-#define COMP_MAX            0xFFFFU/**< (Max dbl comp -1) */
48
-#define COMP_BIT_SIZE       8   /**< Number of bits in a component. */
49
-#define COMP_BYTE_SIZE      1   /**< Number of bytes in a component. */
50
-#define COMP_NUM_NIBBLES    2   /**< Used For diagnostics only. */
51
-typedef uint8_t comp;	        /**< A single precision component. */
52
-typedef uint16_t long_comp;     /**< A double precision component. */
53
-typedef int16_t slong_comp;     /**< A signed double precision component. */
54
-#elif defined(CONFIG_INTEGER_16BIT)
55
-#define COMP_RADIX          65536U       /**< Max component + 1 */
56
-#define COMP_MAX            0xFFFFFFFFU/**< (Max dbl comp -1) */
57
-#define COMP_BIT_SIZE       16  /**< Number of bits in a component. */
58
-#define COMP_BYTE_SIZE      2   /**< Number of bytes in a component. */
59
-#define COMP_NUM_NIBBLES    4   /**< Used For diagnostics only. */
60
-typedef uint16_t comp;	        /**< A single precision component. */
61
-typedef uint32_t long_comp;     /**< A double precision component. */
62
-typedef int32_t slong_comp;     /**< A signed double precision component. */
63
-#else /* regular 32 bit */
64
-#ifdef WIN32
65
-#define COMP_RADIX          4294967296i64         
66
-#define COMP_MAX            0xFFFFFFFFFFFFFFFFui64
67
-#else
68
-#define COMP_RADIX          4294967296ULL         /**< Max component + 1 */
69
-#define COMP_MAX            0xFFFFFFFFFFFFFFFFULL/**< (Max dbl comp -1) */
70
-#endif
71
-#define COMP_BIT_SIZE       32  /**< Number of bits in a component. */
72
-#define COMP_BYTE_SIZE      4   /**< Number of bytes in a component. */
73
-#define COMP_NUM_NIBBLES    8   /**< Used For diagnostics only. */
74
-typedef uint32_t comp;	        /**< A single precision component. */
75
-typedef uint64_t long_comp;     /**< A double precision component. */
76
-typedef int64_t slong_comp;     /**< A signed double precision component. */
77
-#endif
78
-
79
-/**
80
- * @struct  _bigint
81
- * @brief A big integer basic object
82
- */
83
-struct _bigint
84
-{
85
-    struct _bigint* next;       /**< The next bigint in the cache. */
86
-    short size;                 /**< The number of components in this bigint. */
87
-    short max_comps;            /**< The heapsize allocated for this bigint */
88
-    int refs;                   /**< An internal reference count. */
89
-    comp* comps;                /**< A ptr to the actual component data */
90
-};
91
-
92
-typedef struct _bigint bigint;  /**< An alias for _bigint */
93
-
94
-/**
95
- * Maintains the state of the cache, and a number of variables used in 
96
- * reduction.
97
- */
98
-typedef struct /**< A big integer "session" context. */
99
-{
100
-    bigint *active_list;                    /**< Bigints currently used. */
101
-    bigint *free_list;                      /**< Bigints not used. */
102
-    bigint *bi_radix;                       /**< The radix used. */
103
-    bigint *bi_mod[BIGINT_NUM_MODS];        /**< modulus */
104
-
105
-#if defined(CONFIG_BIGINT_MONTGOMERY)
106
-    bigint *bi_RR_mod_m[BIGINT_NUM_MODS];   /**< R^2 mod m */
107
-    bigint *bi_R_mod_m[BIGINT_NUM_MODS];    /**< R mod m */
108
-    comp N0_dash[BIGINT_NUM_MODS];
109
-#elif defined(CONFIG_BIGINT_BARRETT)
110
-    bigint *bi_mu[BIGINT_NUM_MODS];         /**< Storage for mu */
111
-#endif
112
-    bigint *bi_normalised_mod[BIGINT_NUM_MODS]; /**< Normalised mod storage. */
113
-    bigint **g;                 /**< Used by sliding-window. */
114
-    int window;                 /**< The size of the sliding window */
115
-    int active_count;           /**< Number of active bigints. */
116
-    int free_count;             /**< Number of free bigints. */
117
-
118
-#ifdef CONFIG_BIGINT_MONTGOMERY
119
-    uint8_t use_classical;      /**< Use classical reduction. */
120
-#endif
121
-    uint8_t mod_offset;         /**< The mod offset we are using */
122
-} BI_CTX;
123
-
124
-#ifndef WIN32
125
-#define max(a,b) ((a)>(b)?(a):(b))  /**< Find the maximum of 2 numbers. */
126
-#define min(a,b) ((a)<(b)?(a):(b))  /**< Find the minimum of 2 numbers. */
127
-#endif
128
-
129
-#define PERMANENT           0x7FFF55AA  /**< A magic number for permanents. */
130
-
131
-#endif

+ 0
- 13
src/crypto/axtls/config.h View File

@@ -1,13 +0,0 @@
1
-#ifndef AXTLS_CONFIG_H
2
-#define AXTLS_CONFIG_H
3
-
4
-/**
5
- * @file config.h
6
- *
7
- * Trick the axtls code into building within our build environment.
8
- */
9
-
10
-#define CONFIG_SSL_ENABLE_CLIENT 1
11
-#define CONFIG_BIGINT_CLASSICAL 1
12
-
13
-#endif

+ 0
- 229
src/crypto/axtls/crypto.h View File

@@ -1,229 +0,0 @@
1
-/*
2
- * Copyright (c) 2007, Cameron Rich
3
- *
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are met:
8
- *
9
- * * Redistributions of source code must retain the above copyright notice,
10
- *   this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright notice,
12
- *   this list of conditions and the following disclaimer in the documentation
13
- *   and/or other materials provided with the distribution.
14
- * * Neither the name of the axTLS project nor the names of its contributors
15
- *   may be used to endorse or promote products derived from this software
16
- *   without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
-/**
32
- * @file crypto.h
33
- */
34
-
35
-#ifndef HEADER_CRYPTO_H
36
-#define HEADER_CRYPTO_H
37
-
38
-#ifdef __cplusplus
39
-extern "C" {
40
-#endif
41
-
42
-#include "config.h"
43
-#include "bigint_impl.h"
44
-#include "bigint.h"
45
-
46
-#ifndef STDCALL
47
-#define STDCALL
48
-#endif
49
-#ifndef EXP_FUNC
50
-#define EXP_FUNC
51
-#endif
52
-
53
-
54
-/* enable features based on a 'super-set' capbaility. */
55
-#if defined(CONFIG_SSL_FULL_MODE)
56
-#define CONFIG_SSL_ENABLE_CLIENT
57
-#define CONFIG_SSL_CERT_VERIFICATION
58
-#elif defined(CONFIG_SSL_ENABLE_CLIENT)
59
-#define CONFIG_SSL_CERT_VERIFICATION
60
-#endif
61
-
62
-/**************************************************************************
63
- * AES declarations 
64
- **************************************************************************/
65
-
66
-#define AES_MAXROUNDS			14
67
-#define AES_BLOCKSIZE           16
68
-#define AES_IV_SIZE             16
69
-
70
-typedef struct aes_key_st 
71
-{
72
-    uint16_t rounds;
73
-    uint16_t key_size;
74
-    uint32_t ks[(AES_MAXROUNDS+1)*8];
75
-    uint8_t iv[AES_IV_SIZE];
76
-} AES_CTX;
77
-
78
-typedef enum
79
-{
80
-    AES_MODE_128,
81
-    AES_MODE_256
82
-} AES_MODE;
83
-
84
-void AES_set_key(AES_CTX *ctx, const uint8_t *key, 
85
-        const uint8_t *iv, AES_MODE mode);
86
-void AES_cbc_encrypt(AES_CTX *ctx, const uint8_t *msg, 
87
-        uint8_t *out, int length);
88
-void AES_cbc_decrypt(AES_CTX *ks, const uint8_t *in, uint8_t *out, int length);
89
-void AES_convert_key(AES_CTX *ctx);
90
-
91
-/**************************************************************************
92
- * RC4 declarations 
93
- **************************************************************************/
94
-
95
-typedef struct 
96
-{
97
-    uint8_t x, y, m[256];
98
-} RC4_CTX;
99
-
100
-void RC4_setup(RC4_CTX *s, const uint8_t *key, int length);
101
-void RC4_crypt(RC4_CTX *s, const uint8_t *msg, uint8_t *data, int length);
102
-
103
-/**************************************************************************
104
- * SHA1 declarations 
105
- **************************************************************************/
106
-
107
-#define SHA1_SIZE   20
108
-
109
-/*
110
- *  This structure will hold context information for the SHA-1
111
- *  hashing operation
112
- */
113
-typedef struct 
114
-{
115
-    uint32_t Intermediate_Hash[SHA1_SIZE/4]; /* Message Digest */
116
-    uint32_t Length_Low;            /* Message length in bits */
117
-    uint32_t Length_High;           /* Message length in bits */
118
-    uint16_t Message_Block_Index;   /* Index into message block array   */
119
-    uint8_t Message_Block[64];      /* 512-bit message blocks */
120
-} SHA1_CTX;
121
-
122
-void SHA1_Init(SHA1_CTX *);
123
-void SHA1_Update(SHA1_CTX *, const uint8_t * msg, int len);
124
-void SHA1_Final(uint8_t *digest, SHA1_CTX *);
125
-
126
-/**************************************************************************
127
- * MD2 declarations
128
- **************************************************************************/
129
-
130
-#define MD2_SIZE 16
131
-
132
-typedef struct
133
-{
134
-    unsigned char cksum[16];    /* checksum of the data block */
135
-    unsigned char state[48];    /* intermediate digest state */
136
-    unsigned char buffer[16];   /* data block being processed */
137
-    int left;                   /* amount of data in buffer */
138
-} MD2_CTX;
139
-
140
-EXP_FUNC void STDCALL MD2_Init(MD2_CTX *ctx);
141
-EXP_FUNC void STDCALL MD2_Update(MD2_CTX *ctx, const uint8_t *input, int ilen);
142
-EXP_FUNC void STDCALL MD2_Final(uint8_t *digest, MD2_CTX *ctx);
143
-
144
-/**************************************************************************
145
- * MD5 declarations
146
- **************************************************************************/
147
-
148
-#define MD5_SIZE    16
149
-
150
-typedef struct 
151
-{
152
-  uint32_t state[4];        /* state (ABCD) */
153
-  uint32_t count[2];        /* number of bits, modulo 2^64 (lsb first) */
154
-  uint8_t buffer[64];       /* input buffer */
155
-} MD5_CTX;
156
-
157
-EXP_FUNC void STDCALL MD5_Init(MD5_CTX *);
158
-EXP_FUNC void STDCALL MD5_Update(MD5_CTX *, const uint8_t *msg, int len);
159
-EXP_FUNC void STDCALL MD5_Final(uint8_t *digest, MD5_CTX *);
160
-
161
-/**************************************************************************
162
- * HMAC declarations 
163
- **************************************************************************/
164
-void hmac_md5(const uint8_t *msg, int length, const uint8_t *key, 
165
-        int key_len, uint8_t *digest);
166
-void hmac_sha1(const uint8_t *msg, int length, const uint8_t *key, 
167
-        int key_len, uint8_t *digest);
168
-
169
-/**************************************************************************
170
- * RSA declarations 
171
- **************************************************************************/
172
-
173
-typedef struct 
174
-{
175
-    bigint *m;              /* modulus */
176
-    bigint *e;              /* public exponent */
177
-    bigint *d;              /* private exponent */
178
-#ifdef CONFIG_BIGINT_CRT
179
-    bigint *p;              /* p as in m = pq */
180
-    bigint *q;              /* q as in m = pq */
181
-    bigint *dP;             /* d mod (p-1) */
182
-    bigint *dQ;             /* d mod (q-1) */
183
-    bigint *qInv;           /* q^-1 mod p */
184
-#endif
185
-    int num_octets;
186
-    BI_CTX *bi_ctx;
187
-} RSA_CTX;
188
-
189
-void RSA_priv_key_new(RSA_CTX **rsa_ctx, 
190
-        const uint8_t *modulus, int mod_len,
191
-        const uint8_t *pub_exp, int pub_len,
192
-        const uint8_t *priv_exp, int priv_len
193
-#ifdef CONFIG_BIGINT_CRT
194
-      , const uint8_t *p, int p_len,
195
-        const uint8_t *q, int q_len,
196
-        const uint8_t *dP, int dP_len,
197
-        const uint8_t *dQ, int dQ_len,
198
-        const uint8_t *qInv, int qInv_len
199
-#endif
200
-        );
201
-void RSA_pub_key_new(RSA_CTX **rsa_ctx, 
202
-        const uint8_t *modulus, int mod_len,
203
-        const uint8_t *pub_exp, int pub_len);
204
-void RSA_free(RSA_CTX *ctx);
205
-int RSA_decrypt(const RSA_CTX *ctx, const uint8_t *in_data, uint8_t *out_data,
206
-        int is_decryption);
207
-bigint *RSA_private(const RSA_CTX *c, bigint *bi_msg);
208
-#if defined(CONFIG_SSL_CERT_VERIFICATION) || defined(CONFIG_SSL_GENERATE_X509_CERT)
209
-bigint *RSA_sign_verify(BI_CTX *ctx, const uint8_t *sig, int sig_len,
210
-        bigint *modulus, bigint *pub_exp);
211
-bigint *RSA_public(const RSA_CTX * c, bigint *bi_msg);
212
-int RSA_encrypt(const RSA_CTX *ctx, const uint8_t *in_data, uint16_t in_len, 
213
-        uint8_t *out_data, int is_signing);
214
-void RSA_print(const RSA_CTX *ctx);
215
-#endif
216
-
217
-/**************************************************************************
218
- * RNG declarations
219
- **************************************************************************/
220
-EXP_FUNC void STDCALL RNG_initialize(const uint8_t *seed_buf, int size);
221
-EXP_FUNC void STDCALL RNG_terminate(void);
222
-EXP_FUNC void STDCALL get_random(int num_rand_bytes, uint8_t *rand_data);
223
-void get_random_NZ(int num_rand_bytes, uint8_t *rand_data);
224
-
225
-#ifdef __cplusplus
226
-}
227
-#endif
228
-
229
-#endif 

+ 0
- 54
src/crypto/axtls/os_port.h View File

@@ -1,54 +0,0 @@
1
-#ifndef AXTLS_OS_PORT_H
2
-#define AXTLS_OS_PORT_H
3
-
4
-/**
5
- * @file os_port.h
6
- *
7
- * Trick the axtls code into building within our build environment.
8
- */
9
-
10
-#include <stdint.h>
11
-#include <byteswap.h>
12
-
13
-/** All imported axTLS files are licensed using the three-clause BSD licence */
14
-FILE_LICENCE ( BSD3 );
15
-
16
-/** We can't actually abort, since we are effectively a kernel... */
17
-#define abort() assert ( 0 )
18
-
19
-/** rsa.c uses alloca() */
20
-#define alloca( size ) __builtin_alloca ( size )
21
-
22
-#include <ipxe/random_nz.h>
23
-static inline void get_random_NZ ( int num_rand_bytes, uint8_t *rand_data ) {
24
-	/* AXTLS does not check for failures when generating random
25
-	 * data.  Rely on the fact that get_random_nz() does not
26
-	 * request prediction resistance (and so cannot introduce new
27
-	 * failures) and therefore any potential failure must already
28
-	 * have been encountered by e.g. tls_generate_random(), which
29
-	 * does check for failures.
30
-	 */
31
-	get_random_nz ( rand_data, num_rand_bytes );
32
-}
33
-
34
-/* Expose AES_encrypt() and AES_decrypt() in aes.o */
35
-#define aes 1
36
-#if OBJECT
37
-
38
-struct aes_key_st;
39
-
40
-static void AES_encrypt ( const struct aes_key_st *ctx, uint32_t *data );
41
-static void AES_decrypt ( const struct aes_key_st *ctx, uint32_t *data );
42
-
43
-void axtls_aes_encrypt ( void *ctx, uint32_t *data ) {
44
-	AES_encrypt ( ctx, data );
45
-}
46
-
47
-void axtls_aes_decrypt ( void *ctx, uint32_t *data ) {
48
-	AES_decrypt ( ctx, data );
49
-}
50
-
51
-#endif
52
-#undef aes
53
-
54
-#endif 

Loading…
Cancel
Save