mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Do work on curl/mbedtls/zstd
This change fixes stderr to be unbuffered. Added hardware AES on ARM64 to help safeguard against timing attacks. The curl.com command will be somewhat more pleasant to use.
This commit is contained in:
parent
a186143f62
commit
0d3c1c8b1a
37 changed files with 1565 additions and 290 deletions
41
third_party/mbedtls/sha256.c
vendored
41
third_party/mbedtls/sha256.c
vendored
|
@ -172,26 +172,23 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
|||
SHA256_VALIDATE_RET( ctx != NULL );
|
||||
SHA256_VALIDATE_RET( (const unsigned char *)data != NULL );
|
||||
|
||||
if( !IsTiny() || X86_NEED( SHA ) )
|
||||
if( X86_HAVE( SHA ) &&
|
||||
X86_HAVE( SSE2 ) &&
|
||||
X86_HAVE( SSSE3 ) )
|
||||
{
|
||||
if( X86_HAVE( SHA ) &&
|
||||
X86_HAVE( SSE2 ) &&
|
||||
X86_HAVE( SSSE3 ) )
|
||||
{
|
||||
if( IsAsan() )
|
||||
__asan_verify( data, 64 );
|
||||
sha256_transform_ni( ctx->state, data, 1 );
|
||||
return( 0 );
|
||||
}
|
||||
if( X86_HAVE( BMI2 ) &&
|
||||
X86_HAVE( AVX ) &&
|
||||
X86_HAVE( AVX2 ) )
|
||||
{
|
||||
if( IsAsan() )
|
||||
__asan_verify( data, 64 );
|
||||
sha256_transform_rorx( ctx->state, data, 1 );
|
||||
return( 0 );
|
||||
}
|
||||
if( IsAsan() )
|
||||
__asan_verify( data, 64 );
|
||||
sha256_transform_ni( ctx->state, data, 1 );
|
||||
return( 0 );
|
||||
}
|
||||
if( X86_HAVE( BMI2 ) &&
|
||||
X86_HAVE( AVX ) &&
|
||||
X86_HAVE( AVX2 ) )
|
||||
{
|
||||
if( IsAsan() )
|
||||
__asan_verify( data, 64 );
|
||||
sha256_transform_rorx( ctx->state, data, 1 );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
for( i = 0; i < 8; i++ )
|
||||
|
@ -311,8 +308,7 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
|||
|
||||
if( ilen >= 64 )
|
||||
{
|
||||
if( !IsTiny() &&
|
||||
X86_HAVE( SHA ) &&
|
||||
if( X86_HAVE( SHA ) &&
|
||||
X86_HAVE( SSE2 ) &&
|
||||
X86_HAVE( SSSE3 ) )
|
||||
{
|
||||
|
@ -322,8 +318,7 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
|||
input += ROUNDDOWN( ilen, 64 );
|
||||
ilen -= ROUNDDOWN( ilen, 64 );
|
||||
}
|
||||
else if( !IsTiny() &&
|
||||
X86_HAVE( BMI ) &&
|
||||
else if( X86_HAVE( BMI ) &&
|
||||
X86_HAVE( BMI2 ) &&
|
||||
X86_HAVE( AVX2 ) )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue