mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 00:14:17 +01:00
Merge pull request #139 from Patater/des-faster-and-typo-fix
Make DES self-test faster, and fix a typo
This commit is contained in:
commit
8096969905
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file psa/crypto_platform.h
|
* \file psa/crypto_platform.h
|
||||||
*
|
*
|
||||||
* \brief PSA cryptography module: Mbed TLS platfom definitions
|
* \brief PSA cryptography module: Mbed TLS platform definitions
|
||||||
*
|
*
|
||||||
* \note This file may not be included directly. Applications must
|
* \note This file may not be included directly. Applications must
|
||||||
* include psa/crypto.h.
|
* include psa/crypto.h.
|
||||||
|
@ -834,16 +834,16 @@ static const unsigned char des3_test_buf[8] =
|
|||||||
|
|
||||||
static const unsigned char des3_test_ecb_dec[3][8] =
|
static const unsigned char des3_test_ecb_dec[3][8] =
|
||||||
{
|
{
|
||||||
{ 0xCD, 0xD6, 0x4F, 0x2F, 0x94, 0x27, 0xC1, 0x5D },
|
{ 0x37, 0x2B, 0x98, 0xBF, 0x52, 0x65, 0xB0, 0x59 },
|
||||||
{ 0x69, 0x96, 0xC8, 0xFA, 0x47, 0xA2, 0xAB, 0xEB },
|
{ 0xC2, 0x10, 0x19, 0x9C, 0x38, 0x5A, 0x65, 0xA1 },
|
||||||
{ 0x83, 0x25, 0x39, 0x76, 0x44, 0x09, 0x1A, 0x0A }
|
{ 0xA2, 0x70, 0x56, 0x68, 0x69, 0xE5, 0x15, 0x1D }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char des3_test_ecb_enc[3][8] =
|
static const unsigned char des3_test_ecb_enc[3][8] =
|
||||||
{
|
{
|
||||||
{ 0x6A, 0x2A, 0x19, 0xF4, 0x1E, 0xCA, 0x85, 0x4B },
|
{ 0x1C, 0xD5, 0x97, 0xEA, 0x84, 0x26, 0x73, 0xFB },
|
||||||
{ 0x03, 0xE6, 0x9F, 0x5B, 0xFA, 0x58, 0xEB, 0x42 },
|
{ 0xB3, 0x92, 0x4D, 0xF3, 0xC5, 0xB5, 0x42, 0x93 },
|
||||||
{ 0xDD, 0x17, 0xE8, 0xB8, 0xB4, 0x37, 0xD2, 0x32 }
|
{ 0xDA, 0x37, 0x64, 0x41, 0xBA, 0x6F, 0x62, 0x6F }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||||
@ -854,16 +854,16 @@ static const unsigned char des3_test_iv[8] =
|
|||||||
|
|
||||||
static const unsigned char des3_test_cbc_dec[3][8] =
|
static const unsigned char des3_test_cbc_dec[3][8] =
|
||||||
{
|
{
|
||||||
{ 0x12, 0x9F, 0x40, 0xB9, 0xD2, 0x00, 0x56, 0xB3 },
|
{ 0x58, 0xD9, 0x48, 0xEF, 0x85, 0x14, 0x65, 0x9A },
|
||||||
{ 0x47, 0x0E, 0xFC, 0x9A, 0x6B, 0x8E, 0xE3, 0x93 },
|
{ 0x5F, 0xC8, 0x78, 0xD4, 0xD7, 0x92, 0xD9, 0x54 },
|
||||||
{ 0xC5, 0xCE, 0xCF, 0x63, 0xEC, 0xEC, 0x51, 0x4C }
|
{ 0x25, 0xF9, 0x75, 0x85, 0xA8, 0x1E, 0x48, 0xBF }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char des3_test_cbc_enc[3][8] =
|
static const unsigned char des3_test_cbc_enc[3][8] =
|
||||||
{
|
{
|
||||||
{ 0x54, 0xF1, 0x5A, 0xF6, 0xEB, 0xE3, 0xA4, 0xB4 },
|
{ 0x91, 0x1C, 0x6D, 0xCF, 0x48, 0xA7, 0xC3, 0x4D },
|
||||||
{ 0x35, 0x76, 0x11, 0x56, 0x5F, 0xA1, 0x8E, 0x4D },
|
{ 0x60, 0x1A, 0x76, 0x8F, 0xA1, 0xF9, 0x66, 0xF1 },
|
||||||
{ 0xCB, 0x19, 0x1F, 0x85, 0xD1, 0xED, 0x84, 0x39 }
|
{ 0xA1, 0x50, 0x0F, 0x99, 0xB2, 0xCD, 0x64, 0x76 }
|
||||||
};
|
};
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||||
|
|
||||||
@ -928,7 +928,7 @@ int mbedtls_des_self_test( int verbose )
|
|||||||
return( 1 );
|
return( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( j = 0; j < 10000; j++ )
|
for( j = 0; j < 100; j++ )
|
||||||
{
|
{
|
||||||
if( u == 0 )
|
if( u == 0 )
|
||||||
mbedtls_des_crypt_ecb( &ctx, buf, buf );
|
mbedtls_des_crypt_ecb( &ctx, buf, buf );
|
||||||
@ -1005,7 +1005,7 @@ int mbedtls_des_self_test( int verbose )
|
|||||||
|
|
||||||
if( v == MBEDTLS_DES_DECRYPT )
|
if( v == MBEDTLS_DES_DECRYPT )
|
||||||
{
|
{
|
||||||
for( j = 0; j < 10000; j++ )
|
for( j = 0; j < 100; j++ )
|
||||||
{
|
{
|
||||||
if( u == 0 )
|
if( u == 0 )
|
||||||
mbedtls_des_crypt_cbc( &ctx, v, 8, iv, buf, buf );
|
mbedtls_des_crypt_cbc( &ctx, v, 8, iv, buf, buf );
|
||||||
@ -1015,7 +1015,7 @@ int mbedtls_des_self_test( int verbose )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( j = 0; j < 10000; j++ )
|
for( j = 0; j < 100; j++ )
|
||||||
{
|
{
|
||||||
unsigned char tmp[8];
|
unsigned char tmp[8];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user