mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-01-06 11:41:12 +03:00
The Great Renaming
A simple execution of tmp/invoke-rename.pl
This commit is contained in:
@@ -27,13 +27,13 @@
|
||||
* Contact: seznec(at)irisa_dot_fr - orocheco(at)irisa_dot_fr
|
||||
*/
|
||||
|
||||
#if !defined(POLARSSL_CONFIG_FILE)
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include POLARSSL_CONFIG_FILE
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_HAVEGE_C)
|
||||
#if defined(MBEDTLS_HAVEGE_C)
|
||||
|
||||
#include "mbedtls/havege.h"
|
||||
#include "mbedtls/timing.h"
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <string.h>
|
||||
|
||||
/* Implementation that should never be optimized out by the compiler */
|
||||
static void polarssl_zeroize( void *v, size_t n ) {
|
||||
static void mbedtls_zeroize( void *v, size_t n ) {
|
||||
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static void polarssl_zeroize( void *v, size_t n ) {
|
||||
PTX = (PT1 >> 18) & 7; \
|
||||
PT1 &= 0x1FFF; \
|
||||
PT2 &= 0x1FFF; \
|
||||
CLK = (int) hardclock(); \
|
||||
CLK = (int) mbedtls_timing_hardclock(); \
|
||||
\
|
||||
i = 0; \
|
||||
A = &WALK[PT1 ]; RES[i++] ^= *A; \
|
||||
@@ -105,7 +105,7 @@ static void polarssl_zeroize( void *v, size_t n ) {
|
||||
\
|
||||
IN = (*A >> (5)) ^ (*A << (27)) ^ CLK; \
|
||||
*A = (*B >> (6)) ^ (*B << (26)) ^ CLK; \
|
||||
*B = IN; CLK = (int) hardclock(); \
|
||||
*B = IN; CLK = (int) mbedtls_timing_hardclock(); \
|
||||
*C = (*C >> (7)) ^ (*C << (25)) ^ CLK; \
|
||||
*D = (*D >> (8)) ^ (*D << (24)) ^ CLK; \
|
||||
\
|
||||
@@ -156,12 +156,12 @@ static void polarssl_zeroize( void *v, size_t n ) {
|
||||
PT1 ^= (PT2 ^ 0x10) & 0x10; \
|
||||
\
|
||||
for( n++, i = 0; i < 16; i++ ) \
|
||||
hs->pool[n % COLLECT_SIZE] ^= RES[i];
|
||||
hs->pool[n % MBEDTLS_HAVEGE_COLLECT_SIZE] ^= RES[i];
|
||||
|
||||
/*
|
||||
* Entropy gathering function
|
||||
*/
|
||||
static void havege_fill( havege_state *hs )
|
||||
static void havege_fill( mbedtls_havege_state *hs )
|
||||
{
|
||||
int i, n = 0;
|
||||
int U1, U2, *A, *B, *C, *D;
|
||||
@@ -177,7 +177,7 @@ static void havege_fill( havege_state *hs )
|
||||
|
||||
memset( RES, 0, sizeof( RES ) );
|
||||
|
||||
while( n < COLLECT_SIZE * 4 )
|
||||
while( n < MBEDTLS_HAVEGE_COLLECT_SIZE * 4 )
|
||||
{
|
||||
ONE_ITERATION
|
||||
ONE_ITERATION
|
||||
@@ -189,35 +189,35 @@ static void havege_fill( havege_state *hs )
|
||||
hs->PT2 = PT2;
|
||||
|
||||
hs->offset[0] = 0;
|
||||
hs->offset[1] = COLLECT_SIZE / 2;
|
||||
hs->offset[1] = MBEDTLS_HAVEGE_COLLECT_SIZE / 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* HAVEGE initialization
|
||||
*/
|
||||
void havege_init( havege_state *hs )
|
||||
void mbedtls_havege_init( mbedtls_havege_state *hs )
|
||||
{
|
||||
memset( hs, 0, sizeof( havege_state ) );
|
||||
memset( hs, 0, sizeof( mbedtls_havege_state ) );
|
||||
|
||||
havege_fill( hs );
|
||||
}
|
||||
|
||||
void havege_free( havege_state *hs )
|
||||
void mbedtls_havege_free( mbedtls_havege_state *hs )
|
||||
{
|
||||
if( hs == NULL )
|
||||
return;
|
||||
|
||||
polarssl_zeroize( hs, sizeof( havege_state ) );
|
||||
mbedtls_zeroize( hs, sizeof( mbedtls_havege_state ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* HAVEGE rand function
|
||||
*/
|
||||
int havege_random( void *p_rng, unsigned char *buf, size_t len )
|
||||
int mbedtls_havege_random( void *p_rng, unsigned char *buf, size_t len )
|
||||
{
|
||||
int val;
|
||||
size_t use_len;
|
||||
havege_state *hs = (havege_state *) p_rng;
|
||||
mbedtls_havege_state *hs = (mbedtls_havege_state *) p_rng;
|
||||
unsigned char *p = buf;
|
||||
|
||||
while( len > 0 )
|
||||
@@ -226,7 +226,7 @@ int havege_random( void *p_rng, unsigned char *buf, size_t len )
|
||||
if( use_len > sizeof(int) )
|
||||
use_len = sizeof(int);
|
||||
|
||||
if( hs->offset[1] >= COLLECT_SIZE )
|
||||
if( hs->offset[1] >= MBEDTLS_HAVEGE_COLLECT_SIZE )
|
||||
havege_fill( hs );
|
||||
|
||||
val = hs->pool[hs->offset[0]++];
|
||||
@@ -241,4 +241,4 @@ int havege_random( void *p_rng, unsigned char *buf, size_t len )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif /* POLARSSL_HAVEGE_C */
|
||||
#endif /* MBEDTLS_HAVEGE_C */
|
||||
|
||||
Reference in New Issue
Block a user