* AES-ECB block encryption/decryption */
| 816 | * AES-ECB block encryption/decryption |
| 817 | */ |
| 818 | int 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 | /* |
no test coverage detected