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

Function mbedtls_aes_crypt_cfb8

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

* AES-CFB8 buffer encryption/decryption */

Source from the content-addressed store, hash-verified

936 * AES-CFB8 buffer encryption/decryption
937 */
938int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx, int mode, size_t length,
939 unsigned char iv[16], const unsigned char *input,
940 unsigned char *output) {
941 unsigned char c;
942 unsigned char ov[17];
943
944 while (length--) {
945 memcpy(ov, iv, 16);
946 mbedtls_aes_crypt_ecb(ctx, MBEDTLS_AES_ENCRYPT, iv, iv);
947
948 if (mode == MBEDTLS_AES_DECRYPT) ov[16] = *input;
949
950 c = *output++ = (unsigned char)(iv[0] ^ *input++);
951
952 if (mode == MBEDTLS_AES_ENCRYPT) ov[16] = c;
953
954 memcpy(iv, ov + 1, 16);
955 }
956
957 return (0);
958}
959#endif /*MBEDTLS_CIPHER_MODE_CFB */
960
961#if defined(MBEDTLS_CIPHER_MODE_CTR)

Callers

nothing calls this directly

Calls 1

mbedtls_aes_crypt_ecbFunction · 0.85

Tested by

no test coverage detected