aesni.h
mbedtls/config.h
mbedtls/aes.h
mbedtls/aes.h
aesni.h
mbedtls/check_config.h
mbedtls/config.h
mbedtls/platform_time.h
mbedtls/platform_util.h
limits.h
stddef.h
stdint.h
time.h
MBEDTLS_AESNI_AES
0x02000000u
MBEDTLS_AESNI_CLMUL
0x00000002u

AES-NI for hardware AES acceleration on some Intel processors.

These functions are only for internal use by other library functions; you must not call them directly.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_AESNI_H
    #defineMBEDTLS_AESNI_H

    #if!defined(MBEDTLS_CONFIG_FILE)
    #include"mbedtls/config.h"
    #else
    #includeMBEDTLS_CONFIG_FILE
    #endif

    #include"mbedtls/aes.h"

    #defineMBEDTLS_AESNI_AES0x02000000u
    #defineMBEDTLS_AESNI_CLMUL0x00000002u

    #if!defined(MBEDTLS_HAVE_X86_64)&&\
    (defined(__amd64__)||defined(__x86_64__)||\
    defined(_M_X64)||defined(_M_AMD64))&&\
    !defined(_M_ARM64EC)
    #defineMBEDTLS_HAVE_X86_64
    #endif

    #if!defined(MBEDTLS_HAVE_X86)&&\
    (defined(__i386__)||defined(_M_IX86))
    #defineMBEDTLS_HAVE_X86
    #endif

    #ifdefined(MBEDTLS_AESNI_C)&&\
    (defined(MBEDTLS_HAVE_X86_64)||defined(MBEDTLS_HAVE_X86))

    /*CanwedoAESNIwithintrinsics?
    *(Onlyimplementedwithcertaincompilers,onlyforcertaintargets.)
    *
    *NOTE:MBEDTLS_AESNI_HAVE_INTRINSICSandMBEDTLS_AESNI_HAVE_CODEareinternal
    *macrosthatmaychangeinfuturereleases.
    */
    #undefMBEDTLS_AESNI_HAVE_INTRINSICS
    #ifdefined(_MSC_VER)&&!defined(__clang__)
    /*VisualStudiosupportsAESNIintrinsicssinceVS2008SP1.Weonlysupport
    *VS2013andupforotherreasonsanyway,sononeedtochecktheversion.*/
    #defineMBEDTLS_AESNI_HAVE_INTRINSICS
    #endif
    /*GCC-likecompilers:currently,weonlysupportintrinsicsiftherequisite
    *targetflagisenabledwhenbuildingthelibrary(e.g.`gcc-mpclmul-msse2`
    *or`clang-maes-mpclmul`).*/
    #if(defined(__GNUC__)||defined(__clang__))&&defined(__AES__)&&defined(__PCLMUL__)
    #defineMBEDTLS_AESNI_HAVE_INTRINSICS
    #endif

    /*ChoosetheimplementationofAESNI,ifoneisavailable.*/
    #undefMBEDTLS_AESNI_HAVE_CODE
    /*Tominimizedisruptionwhenreleasingtheintrinsics-basedimplementation,
    *favortheassembly-basedimplementationifit'savailable.Weintendto
    *revisethisinalaterreleaseofMbedTLS3.x.Inthelongrun,wewill
    *likelyremovetheassemblyimplementation.*/
    #ifdefined(MBEDTLS_HAVE_ASM)&&\
    defined(__GNUC__)&&defined(MBEDTLS_HAVE_X86_64)
    /*CanwedoAESNIwithinlineassembly?
    *(Onlyimplementedwithgassyntax,onlyfor64-bit.)
    */
    #defineMBEDTLS_AESNI_HAVE_CODE1//viaassembly
    #elifdefined(MBEDTLS_AESNI_HAVE_INTRINSICS)
    #defineMBEDTLS_AESNI_HAVE_CODE2//viaintrinsics
    #endif

    #ifdefined(MBEDTLS_AESNI_HAVE_CODE)

    #ifdef__cplusplus
    extern"C"{
    #endif

    intmbedtls_aesni_has_support(unsignedintwhat);

    intmbedtls_aesni_crypt_ecb(mbedtls_aes_context*ctx,
    intmode,
    constunsignedcharinput[16],
    unsignedcharoutput[16]);

    voidmbedtls_aesni_gcm_mult(unsignedcharc[16],
    constunsignedchara[16],
    constunsignedcharb[16]);

    voidmbedtls_aesni_inverse_key(unsignedchar*invkey,
    constunsignedchar*fwdkey,
    intnr);

    intmbedtls_aesni_setkey_enc(unsignedchar*rk,
    constunsignedchar*key,
    size_tbits);

    #ifdef__cplusplus
    }
    #endif

    #endif/*MBEDTLS_AESNI_HAVE_CODE*/
    #endif/*MBEDTLS_AESNI_C&&(MBEDTLS_HAVE_X86_64||MBEDTLS_HAVE_X86)*/

    #endif/*MBEDTLS_AESNI_H*/