mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 20:45:41 +01:00
Remove individual copies of mbedtls_zeroize()
This commit removes all the static occurrencies of the function mbedtls_zeroize() in each of the individual .c modules. Instead the function has been moved to utils.h that is included in each of the modules.
This commit is contained in:
parent
d0d7bf614e
commit
e32df087fb
@ -36,6 +36,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mbedtls/aes.h"
|
#include "mbedtls/aes.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
#if defined(MBEDTLS_PADLOCK_C)
|
#if defined(MBEDTLS_PADLOCK_C)
|
||||||
#include "mbedtls/padlock.h"
|
#include "mbedtls/padlock.h"
|
||||||
#endif
|
#endif
|
||||||
@ -54,11 +55,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_AES_ALT)
|
#if !defined(MBEDTLS_AES_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_ARC4_C)
|
#if defined(MBEDTLS_ARC4_C)
|
||||||
|
|
||||||
#include "mbedtls/arc4.h"
|
#include "mbedtls/arc4.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -47,11 +48,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_ARC4_ALT)
|
#if !defined(MBEDTLS_ARC4_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbedtls_arc4_init( mbedtls_arc4_context *ctx )
|
void mbedtls_arc4_init( mbedtls_arc4_context *ctx )
|
||||||
{
|
{
|
||||||
memset( ctx, 0, sizeof( mbedtls_arc4_context ) );
|
memset( ctx, 0, sizeof( mbedtls_arc4_context ) );
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||||
|
|
||||||
#include "mbedtls/asn1.h"
|
#include "mbedtls/asn1.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -43,11 +44,6 @@
|
|||||||
#define mbedtls_free free
|
#define mbedtls_free free
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ASN.1 DER decoding routines
|
* ASN.1 DER decoding routines
|
||||||
*/
|
*/
|
||||||
|
@ -34,16 +34,12 @@
|
|||||||
#if defined(MBEDTLS_BLOWFISH_C)
|
#if defined(MBEDTLS_BLOWFISH_C)
|
||||||
|
|
||||||
#include "mbedtls/blowfish.h"
|
#include "mbedtls/blowfish.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(MBEDTLS_BLOWFISH_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_CAMELLIA_C)
|
#if defined(MBEDTLS_CAMELLIA_C)
|
||||||
|
|
||||||
#include "mbedtls/camellia.h"
|
#include "mbedtls/camellia.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -48,11 +49,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_CAMELLIA_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#if defined(MBEDTLS_CCM_C)
|
#if defined(MBEDTLS_CCM_C)
|
||||||
|
|
||||||
#include "mbedtls/ccm.h"
|
#include "mbedtls/ccm.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -51,11 +52,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_CCM_ALT)
|
#if !defined(MBEDTLS_CCM_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CCM_ENCRYPT 0
|
#define CCM_ENCRYPT 0
|
||||||
#define CCM_DECRYPT 1
|
#define CCM_DECRYPT 1
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/cipher.h"
|
#include "mbedtls/cipher.h"
|
||||||
#include "mbedtls/cipher_internal.h"
|
#include "mbedtls/cipher_internal.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -60,11 +61,6 @@
|
|||||||
#define MBEDTLS_CIPHER_MODE_STREAM
|
#define MBEDTLS_CIPHER_MODE_STREAM
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int supported_init = 0;
|
static int supported_init = 0;
|
||||||
|
|
||||||
const int *mbedtls_cipher_list( void )
|
const int *mbedtls_cipher_list( void )
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#if defined(MBEDTLS_CMAC_C)
|
#if defined(MBEDTLS_CMAC_C)
|
||||||
|
|
||||||
#include "mbedtls/cmac.h"
|
#include "mbedtls/cmac.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -67,11 +68,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_CMAC_ALT) || defined(MBEDTLS_SELF_TEST)
|
#if !defined(MBEDTLS_CMAC_ALT) || defined(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 = (unsigned char*)v; while( n-- ) *p++ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Multiplication by u in the Galois field of GF(2^n)
|
* Multiplication by u in the Galois field of GF(2^n)
|
||||||
*
|
*
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
|
||||||
#include "mbedtls/ctr_drbg.h"
|
#include "mbedtls/ctr_drbg.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -49,11 +50,6 @@
|
|||||||
#endif /* MBEDTLS_PLATFORM_C */
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CTR_DRBG context initialization
|
* CTR_DRBG context initialization
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_DES_C)
|
#if defined(MBEDTLS_DES_C)
|
||||||
|
|
||||||
#include "mbedtls/des.h"
|
#include "mbedtls/des.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -48,11 +49,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_DES_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#if defined(MBEDTLS_DHM_C)
|
#if defined(MBEDTLS_DHM_C)
|
||||||
|
|
||||||
#include "mbedtls/dhm.h"
|
#include "mbedtls/dhm.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -58,10 +59,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBEDTLS_DHM_ALT)
|
#if !defined(MBEDTLS_DHM_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* helper to validate the mbedtls_mpi size and import it
|
* helper to validate the mbedtls_mpi size and import it
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/ecp.h"
|
#include "mbedtls/ecp.h"
|
||||||
#include "mbedtls/threading.h"
|
#include "mbedtls/threading.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -73,11 +74,6 @@
|
|||||||
#define inline __inline
|
#define inline __inline
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST)
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
/*
|
/*
|
||||||
* Counts of point addition and doubling, and field multiplications.
|
* Counts of point addition and doubling, and field multiplications.
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/entropy.h"
|
#include "mbedtls/entropy.h"
|
||||||
#include "mbedtls/entropy_poll.h"
|
#include "mbedtls/entropy_poll.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -59,11 +60,6 @@
|
|||||||
#include "mbedtls/havege.h"
|
#include "mbedtls/havege.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ENTROPY_MAX_LOOP 256 /**< Maximum amount to loop before error */
|
#define ENTROPY_MAX_LOOP 256 /**< Maximum amount to loop before error */
|
||||||
|
|
||||||
void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
|
void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#if defined(MBEDTLS_GCM_C)
|
#if defined(MBEDTLS_GCM_C)
|
||||||
|
|
||||||
#include "mbedtls/gcm.h"
|
#include "mbedtls/gcm.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -80,11 +81,6 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize a context
|
* Initialize a context
|
||||||
*/
|
*/
|
||||||
|
@ -36,14 +36,10 @@
|
|||||||
|
|
||||||
#include "mbedtls/havege.h"
|
#include "mbedtls/havege.h"
|
||||||
#include "mbedtls/timing.h"
|
#include "mbedtls/timing.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* On average, one iteration accesses two 8-word blocks in the havege WALK
|
* On average, one iteration accesses two 8-word blocks in the havege WALK
|
||||||
* table, and generates 16 words in the RES array.
|
* table, and generates 16 words in the RES array.
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_HMAC_DRBG_C)
|
#if defined(MBEDTLS_HMAC_DRBG_C)
|
||||||
|
|
||||||
#include "mbedtls/hmac_drbg.h"
|
#include "mbedtls/hmac_drbg.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -50,11 +51,6 @@
|
|||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
#endif /* MBEDTLS_PLATFORM_C */
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HMAC_DRBG context initialization
|
* HMAC_DRBG context initialization
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/md.h"
|
#include "mbedtls/md.h"
|
||||||
#include "mbedtls/md_internal.h"
|
#include "mbedtls/md_internal.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
@ -48,11 +49,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reminder: update profiles in x509_crt.c when adding a new hash!
|
* Reminder: update profiles in x509_crt.c when adding a new hash!
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_MD2_C)
|
#if defined(MBEDTLS_MD2_C)
|
||||||
|
|
||||||
#include "mbedtls/md2.h"
|
#include "mbedtls/md2.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -48,11 +49,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_MD2_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char PI_SUBST[256] =
|
static const unsigned char PI_SUBST[256] =
|
||||||
{
|
{
|
||||||
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36,
|
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36,
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_MD4_C)
|
#if defined(MBEDTLS_MD4_C)
|
||||||
|
|
||||||
#include "mbedtls/md4.h"
|
#include "mbedtls/md4.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -48,11 +49,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_MD4_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_MD5_C)
|
#if defined(MBEDTLS_MD5_C)
|
||||||
|
|
||||||
#include "mbedtls/md5.h"
|
#include "mbedtls/md5.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -47,11 +48,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_MD5_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
/* No need for the header guard as MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
/* No need for the header guard as MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||||
is dependent upon MBEDTLS_PLATFORM_C */
|
is dependent upon MBEDTLS_PLATFORM_C */
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -42,11 +43,6 @@
|
|||||||
#include "mbedtls/threading.h"
|
#include "mbedtls/threading.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAGIC1 0xFF00AA55
|
#define MAGIC1 0xFF00AA55
|
||||||
#define MAGIC2 0xEE119966
|
#define MAGIC2 0xEE119966
|
||||||
#define MAX_BT 20
|
#define MAX_BT 20
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "mbedtls/aes.h"
|
#include "mbedtls/aes.h"
|
||||||
#include "mbedtls/md5.h"
|
#include "mbedtls/md5.h"
|
||||||
#include "mbedtls/cipher.h"
|
#include "mbedtls/cipher.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -45,11 +46,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbedtls_pem_init( mbedtls_pem_context *ctx )
|
void mbedtls_pem_init( mbedtls_pem_context *ctx )
|
||||||
{
|
{
|
||||||
memset( ctx, 0, sizeof( mbedtls_pem_context ) );
|
memset( ctx, 0, sizeof( mbedtls_pem_context ) );
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "mbedtls/pk.h"
|
#include "mbedtls/pk.h"
|
||||||
#include "mbedtls/pk_internal.h"
|
#include "mbedtls/pk_internal.h"
|
||||||
|
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_RSA_C)
|
#if defined(MBEDTLS_RSA_C)
|
||||||
#include "mbedtls/rsa.h"
|
#include "mbedtls/rsa.h"
|
||||||
#endif
|
#endif
|
||||||
@ -42,11 +44,6 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
#include <stdint.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise a mbedtls_pk_context
|
* Initialise a mbedtls_pk_context
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,10 @@
|
|||||||
#include "mbedtls/ecdsa.h"
|
#include "mbedtls/ecdsa.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
@ -52,13 +56,6 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
#include <stdint.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;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_RSA_C)
|
#if defined(MBEDTLS_RSA_C)
|
||||||
static int rsa_can_do( mbedtls_pk_type_t type )
|
static int rsa_can_do( mbedtls_pk_type_t type )
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "mbedtls/pkcs12.h"
|
#include "mbedtls/pkcs12.h"
|
||||||
#include "mbedtls/asn1.h"
|
#include "mbedtls/asn1.h"
|
||||||
#include "mbedtls/cipher.h"
|
#include "mbedtls/cipher.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -47,11 +48,6 @@
|
|||||||
#include "mbedtls/des.h"
|
#include "mbedtls/des.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pkcs12_parse_pbe_params( mbedtls_asn1_buf *params,
|
static int pkcs12_parse_pbe_params( mbedtls_asn1_buf *params,
|
||||||
mbedtls_asn1_buf *salt, int *iterations )
|
mbedtls_asn1_buf *salt, int *iterations )
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "mbedtls/pk.h"
|
#include "mbedtls/pk.h"
|
||||||
#include "mbedtls/asn1.h"
|
#include "mbedtls/asn1.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -60,14 +61,6 @@
|
|||||||
#define mbedtls_free free
|
#define mbedtls_free free
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_FS_IO) || \
|
|
||||||
defined(MBEDTLS_PKCS12_C) || defined(MBEDTLS_PKCS5_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;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_FS_IO)
|
#if defined(MBEDTLS_FS_IO)
|
||||||
/*
|
/*
|
||||||
* Load all data from a file into a given buffer.
|
* Load all data from a file into a given buffer.
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#if defined(MBEDTLS_RIPEMD160_C)
|
#if defined(MBEDTLS_RIPEMD160_C)
|
||||||
|
|
||||||
#include "mbedtls/ripemd160.h"
|
#include "mbedtls/ripemd160.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -71,11 +72,6 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx )
|
void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx )
|
||||||
{
|
{
|
||||||
memset( ctx, 0, sizeof( mbedtls_ripemd160_context ) );
|
memset( ctx, 0, sizeof( mbedtls_ripemd160_context ) );
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "mbedtls/rsa.h"
|
#include "mbedtls/rsa.h"
|
||||||
#include "mbedtls/rsa_internal.h"
|
#include "mbedtls/rsa_internal.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -70,11 +71,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_RSA_ALT)
|
#if !defined(MBEDTLS_RSA_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_PKCS1_V15)
|
#if defined(MBEDTLS_PKCS1_V15)
|
||||||
/* constant-time buffer comparison */
|
/* constant-time buffer comparison */
|
||||||
static inline int mbedtls_safer_memcmp( const void *a, const void *b, size_t n )
|
static inline int mbedtls_safer_memcmp( const void *a, const void *b, size_t n )
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_SHA1_C)
|
#if defined(MBEDTLS_SHA1_C)
|
||||||
|
|
||||||
#include "mbedtls/sha1.h"
|
#include "mbedtls/sha1.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -47,11 +48,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_SHA1_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_SHA256_C)
|
#if defined(MBEDTLS_SHA256_C)
|
||||||
|
|
||||||
#include "mbedtls/sha256.h"
|
#include "mbedtls/sha256.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -50,11 +51,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_SHA256_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#if defined(MBEDTLS_SHA512_C)
|
#if defined(MBEDTLS_SHA512_C)
|
||||||
|
|
||||||
#include "mbedtls/sha512.h"
|
#include "mbedtls/sha512.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||||
#define UL64(x) x##ui64
|
#define UL64(x) x##ui64
|
||||||
@ -56,11 +57,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_SHA512_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 64-bit integer manipulation macros (big endian)
|
* 64-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -48,10 +48,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
/* Implementation that should never be optimized out by the compiler */
|
#include "mbedtls/utils.h"
|
||||||
static void mbedtls_zeroize( void *v, size_t n ) {
|
|
||||||
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||||
|
@ -40,14 +40,10 @@
|
|||||||
|
|
||||||
#include "mbedtls/ssl_cookie.h"
|
#include "mbedtls/ssl_cookie.h"
|
||||||
#include "mbedtls/ssl_internal.h"
|
#include "mbedtls/ssl_internal.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If DTLS is in use, then at least one of SHA-1, SHA-256, SHA-512 is
|
* If DTLS is in use, then at least one of SHA-1, SHA-256, SHA-512 is
|
||||||
* available. Try SHA-256 first, 512 wastes resources since we need to stay
|
* available. Try SHA-256 first, 512 wastes resources since we need to stay
|
||||||
|
@ -50,10 +50,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
/* Implementation that should never be optimized out by the compiler */
|
#include "mbedtls/utils.h"
|
||||||
static void mbedtls_zeroize( void *v, size_t n ) {
|
|
||||||
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
|
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
|
||||||
|
@ -36,14 +36,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mbedtls/ssl_ticket.h"
|
#include "mbedtls/ssl_ticket.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialze context
|
* Initialze context
|
||||||
*/
|
*/
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "mbedtls/debug.h"
|
#include "mbedtls/debug.h"
|
||||||
#include "mbedtls/ssl.h"
|
#include "mbedtls/ssl.h"
|
||||||
#include "mbedtls/ssl_internal.h"
|
#include "mbedtls/ssl_internal.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -53,11 +54,6 @@
|
|||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Length of the "epoch" field in the record header */
|
/* Length of the "epoch" field in the record header */
|
||||||
static inline size_t ssl_ep_len( const mbedtls_ssl_context *ssl )
|
static inline size_t ssl_ep_len( const mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/x509_crl.h"
|
#include "mbedtls/x509_crl.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -66,11 +67,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version ::= INTEGER { v1(0), v2(1) }
|
* Version ::= INTEGER { v1(0), v2(1) }
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/x509_crt.h"
|
#include "mbedtls/x509_crt.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -90,11 +91,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
#define X509_MAX_VERIFY_CHAIN_SIZE ( MBEDTLS_X509_MAX_INTERMEDIATE_CA + 2 )
|
#define X509_MAX_VERIFY_CHAIN_SIZE ( MBEDTLS_X509_MAX_INTERMEDIATE_CA + 2 )
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default profile
|
* Default profile
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "mbedtls/x509_csr.h"
|
#include "mbedtls/x509_csr.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -60,11 +61,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version ::= INTEGER { v1(0) }
|
* Version ::= INTEGER { v1(0) }
|
||||||
*/
|
*/
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
#include "mbedtls/asn1write.h"
|
#include "mbedtls/asn1write.h"
|
||||||
#include "mbedtls/sha1.h"
|
#include "mbedtls/sha1.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -44,11 +45,6 @@
|
|||||||
#include "mbedtls/pem.h"
|
#include "mbedtls/pem.h"
|
||||||
#endif /* MBEDTLS_PEM_WRITE_C */
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx )
|
void mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx )
|
||||||
{
|
{
|
||||||
memset( ctx, 0, sizeof( mbedtls_x509write_cert ) );
|
memset( ctx, 0, sizeof( mbedtls_x509write_cert ) );
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "mbedtls/x509_csr.h"
|
#include "mbedtls/x509_csr.h"
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
#include "mbedtls/asn1write.h"
|
#include "mbedtls/asn1write.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -43,11 +44,6 @@
|
|||||||
#include "mbedtls/pem.h"
|
#include "mbedtls/pem.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx )
|
void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx )
|
||||||
{
|
{
|
||||||
memset( ctx, 0, sizeof( mbedtls_x509write_csr ) );
|
memset( ctx, 0, sizeof( mbedtls_x509write_csr ) );
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#if defined(MBEDTLS_XTEA_C)
|
#if defined(MBEDTLS_XTEA_C)
|
||||||
|
|
||||||
#include "mbedtls/xtea.h"
|
#include "mbedtls/xtea.h"
|
||||||
|
#include "mbedtls/utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -42,11 +43,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_XTEA_ALT)
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user