1 #ifndef AXTLS_OS_PORT_H
2 #define AXTLS_OS_PORT_H
7 * Trick the axtls code into building within our build environment.
13 /** All imported axTLS files are licensed using the three-clause BSD licence */
14 FILE_LICENCE ( BSD3 );
16 /** We can't actually abort, since we are effectively a kernel... */
17 #define abort() assert ( 0 )
19 /** rsa.c uses alloca() */
20 #define alloca( size ) __builtin_alloca ( size )
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.
31 get_random_nz ( rand_data, num_rand_bytes );
34 /* Expose AES_encrypt() and AES_decrypt() in aes.o */
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 );
43 void axtls_aes_encrypt ( void *ctx, uint32_t *data ) {
44 AES_encrypt ( ctx, data );
47 void axtls_aes_decrypt ( void *ctx, uint32_t *data ) {
48 AES_decrypt ( ctx, data );