mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Allow detection of CLMUL
This commit is contained in:
parent
5b685653ef
commit
8eaf20b18d
3 changed files with 17 additions and 11 deletions
|
|
@ -37,24 +37,24 @@
|
|||
#if defined(POLARSSL_HAVE_X86_64)
|
||||
|
||||
/*
|
||||
* AES-NI support detection routine, [AES-WP] figure 23
|
||||
* AES-NI support detection routine
|
||||
*/
|
||||
int aesni_supported( void )
|
||||
int aesni_supports( unsigned int what )
|
||||
{
|
||||
static int supported = -1;
|
||||
unsigned int c;
|
||||
static int done = 0;
|
||||
static unsigned int c = 0;
|
||||
|
||||
if( supported == -1 )
|
||||
if( ! done )
|
||||
{
|
||||
asm( "movl $1, %%eax \n"
|
||||
"cpuid \n"
|
||||
: "=c" (c)
|
||||
:
|
||||
: "eax", "ebx", "edx" );
|
||||
supported = ( ( c & 0x02000000 ) != 0 );
|
||||
done = 1;
|
||||
}
|
||||
|
||||
return( supported );
|
||||
return( ( c & what ) != 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue