(mbedtls) Use arc4_alt.h

This commit is contained in:
twinaphex 2018-08-04 20:54:11 +02:00
parent ad87ec871d
commit 3019748b17
39 changed files with 39 additions and 156 deletions

View File

@ -39,10 +39,7 @@
#if !defined(MBEDTLS_BLOWFISH_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)

View File

@ -48,10 +48,7 @@
#if !defined(MBEDTLS_CAMELLIA_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)

5
deps/mbedtls/ccm.c vendored
View File

@ -49,10 +49,7 @@
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#define CCM_ENCRYPT 0
#define CCM_DECRYPT 1

View File

@ -60,10 +60,7 @@
#define MBEDTLS_CIPHER_MODE_STREAM
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
static int supported_init = 0;

5
deps/mbedtls/cmac.c vendored
View File

@ -65,10 +65,7 @@
#endif /* MBEDTLS_SELF_TEST */
#endif /* MBEDTLS_PLATFORM_C */
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Multiplication by u in the Galois field of GF(2^n)

View File

@ -49,10 +49,7 @@
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* CTR_DRBG context initialization

5
deps/mbedtls/des.c vendored
View File

@ -48,10 +48,7 @@
#if !defined(MBEDTLS_DES_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)

5
deps/mbedtls/dhm.c vendored
View File

@ -57,10 +57,7 @@
#define mbedtls_free free
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* helper to validate the mbedtls_mpi size and import it

5
deps/mbedtls/ecp.c vendored
View File

@ -72,10 +72,7 @@
#define inline __inline
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#if defined(MBEDTLS_SELF_TEST)
/*

View File

@ -59,10 +59,7 @@
#include "mbedtls/havege.h"
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#define ENTROPY_MAX_LOOP 256 /**< Maximum amount to loop before error */

5
deps/mbedtls/gcm.c vendored
View File

@ -77,10 +77,7 @@
}
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Initialize a context

View File

@ -39,10 +39,7 @@
#include <string.h>
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/* ------------------------------------------------------------------------
* On average, one iteration accesses two 8-word blocks in the havege WALK

View File

@ -50,10 +50,7 @@
#endif /* MBEDTLS_SELF_TEST */
#endif /* MBEDTLS_PLATFORM_C */
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* HMAC_DRBG context initialization

5
deps/mbedtls/md.c vendored
View File

@ -48,10 +48,7 @@
#include <stdio.h>
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Reminder: update profiles in x509_crt.c when adding a new hash!

5
deps/mbedtls/md2.c vendored
View File

@ -48,10 +48,7 @@
#if !defined(MBEDTLS_MD2_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
static const unsigned char PI_SUBST[256] =
{

5
deps/mbedtls/md4.c vendored
View File

@ -48,10 +48,7 @@
#if !defined(MBEDTLS_MD4_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (little endian)

5
deps/mbedtls/md5.c vendored
View File

@ -47,10 +47,7 @@
#if !defined(MBEDTLS_MD5_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (little endian)

View File

@ -42,10 +42,7 @@
#include "mbedtls/threading.h"
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#define MAGIC1 0xFF00AA55
#define MAGIC2 0xEE119966

5
deps/mbedtls/pem.c vendored
View File

@ -45,10 +45,7 @@
#endif
#if defined(MBEDTLS_PEM_PARSE_C)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
void mbedtls_pem_init( mbedtls_pem_context *ctx )
{

5
deps/mbedtls/pk.c vendored
View File

@ -43,10 +43,7 @@
#include <limits.h>
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Initialise a mbedtls_pk_context

View File

@ -53,10 +53,7 @@
#include <limits.h>
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#endif
#if defined(MBEDTLS_RSA_C)

View File

@ -47,10 +47,7 @@
#include "mbedtls/des.h"
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
static int pkcs12_parse_pbe_params( mbedtls_asn1_buf *params,
mbedtls_asn1_buf *salt, int *iterations )

View File

@ -61,10 +61,7 @@
#endif
#if defined(MBEDTLS_FS_IO)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Load all data from a file into a given buffer.

View File

@ -69,10 +69,7 @@
}
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx )
{

5
deps/mbedtls/rsa.c vendored
View File

@ -66,10 +66,7 @@
#define mbedtls_free free
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Initialize an RSA context

5
deps/mbedtls/sha1.c vendored
View File

@ -47,10 +47,7 @@
#if !defined(MBEDTLS_SHA1_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)

View File

@ -50,10 +50,7 @@
#if !defined(MBEDTLS_SHA256_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)

View File

@ -56,10 +56,7 @@
#if !defined(MBEDTLS_SHA512_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 64-bit integer manipulation macros (big endian)

View File

@ -48,10 +48,7 @@
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#endif
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)

View File

@ -43,10 +43,7 @@
#include <string.h>
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* If DTLS is in use, then at least one of SHA-1, SHA-256, SHA-512 is

View File

@ -50,10 +50,7 @@
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
#endif
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)

View File

@ -39,10 +39,7 @@
#include <string.h>
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Initialze context

View File

@ -53,10 +53,7 @@
#include "mbedtls/oid.h"
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/* Length of the "epoch" field in the record header */
static inline size_t ssl_ep_len( const mbedtls_ssl_context *ssl )

View File

@ -66,10 +66,7 @@
#include <stdio.h>
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Version ::= INTEGER { v1(0), v2(1) }

View File

@ -75,10 +75,7 @@
#endif /* !_WIN32 || EFIX64 || EFI32 */
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Default profile

View File

@ -60,10 +60,7 @@
#include <stdio.h>
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* Version ::= INTEGER { v1(0) }

View File

@ -44,10 +44,7 @@
#include "mbedtls/pem.h"
#endif /* MBEDTLS_PEM_WRITE_C */
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
void mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx )
{

View File

@ -43,10 +43,7 @@
#include "mbedtls/pem.h"
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx )
{

5
deps/mbedtls/xtea.c vendored
View File

@ -42,10 +42,7 @@
#if !defined(MBEDTLS_XTEA_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
#include "arc4_alt.h"
/*
* 32-bit integer manipulation macros (big endian)