1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * AES-ECB unauthenticated encryption and decryption 4 * 5 * Copyright 2026 Google LLC 6 */ 7 #ifndef _CRYPTO_AES_ECB_H 8 #define _CRYPTO_AES_ECB_H 9 10 #include <crypto/aes.h> 11 12 /** 13 * aes_ecb_encrypt() - Encrypt data using AES-ECB 14 * @dst: The destination buffer. Can be in-place or out-of-place. For other 15 * overlaps the behavior is unspecified. 16 * @src: The source data 17 * @len: Number of bytes to encrypt. Must be a multiple of AES_BLOCK_SIZE. 18 * @key: The key, already prepared using aes_preparekey() or aes_prepareenckey() 19 * 20 * ECB mode is insecure by itself. This function exists only for compatibility 21 * with legacy protocols and for internal use by other modes. 22 * 23 * This supports incremental encryption, but the length of each chunk must be a 24 * multiple of AES_BLOCK_SIZE. 25 * 26 * Context: Any context. 27 */ 28 void aes_ecb_encrypt(u8 *dst, const u8 *src, size_t len, aes_encrypt_arg key); 29 30 /** 31 * aes_ecb_decrypt() - Decrypt data using AES-ECB 32 * @dst: The destination buffer. Can be in-place or out-of-place. For other 33 * overlaps the behavior is unspecified. 34 * @src: The source data 35 * @len: Number of bytes to decrypt. Must be a multiple of AES_BLOCK_SIZE. 36 * @key: The key, already prepared using aes_preparekey() 37 * 38 * ECB mode is insecure by itself. This function exists only for compatibility 39 * with legacy protocols and for internal use by other modes. 40 * 41 * This supports incremental decryption, but the length of each chunk must be a 42 * multiple of AES_BLOCK_SIZE. 43 * 44 * Context: Any context. 45 */ 46 void aes_ecb_decrypt(u8 *dst, const u8 *src, size_t len, 47 const struct aes_key *key); 48 49 #endif /* _CRYPTO_AES_ECB_H */ 50