MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / mbedtls_aes_crypt_ecb

Function mbedtls_aes_crypt_ecb

lite/src/decryption/mbedtls/aes.cc:818–841  ·  view source on GitHub ↗

* AES-ECB block encryption/decryption */

Source from the content-addressed store, hash-verified

816 * AES-ECB block encryption/decryption
817 */
818int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode,
819 const unsigned char input[16],
820 unsigned char output[16]) {
821#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
822 if (mbedtls_aesni_has_support(MBEDTLS_AESNI_AES))
823 return (mbedtls_aesni_crypt_ecb(ctx, mode, input, output));
824#endif
825
826#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
827 if (aes_padlock_ace) {
828 if (mbedtls_padlock_xcryptecb(ctx, mode, input, output) == 0)
829 return (0);
830
831 // If padlock data misaligned, we just fall back to
832 // unaccelerated mode
833 //
834 }
835#endif
836
837 if (mode == MBEDTLS_AES_ENCRYPT)
838 return (mbedtls_internal_aes_encrypt(ctx, input, output));
839 else
840 return (mbedtls_internal_aes_decrypt(ctx, input, output));
841}
842
843#if defined(MBEDTLS_CIPHER_MODE_CBC)
844/*

Callers 5

mbedtls_aes_crypt_cbcFunction · 0.85
mbedtls_aes_crypt_cfb128Function · 0.85
mbedtls_aes_crypt_cfb8Function · 0.85
mbedtls_aes_crypt_ctrFunction · 0.85
mbedtls_aes_self_testFunction · 0.85

Calls 2

Tested by

no test coverage detected