| 341 | |
| 342 | |
| 343 | void cAESCFBDecryptor::ProcessData(Byte * a_DecryptedOut, const Byte * a_EncryptedIn, size_t a_Length) |
| 344 | { |
| 345 | ASSERT(IsValid()); // Must Init() first |
| 346 | |
| 347 | // PolarSSL doesn't support AES-CFB8, need to implement it manually: |
| 348 | for (size_t i = 0; i < a_Length; i++) |
| 349 | { |
| 350 | Byte Buffer[sizeof(m_IV)]; |
| 351 | aes_crypt_ecb(&m_Aes, AES_ENCRYPT, m_IV, Buffer); |
| 352 | for (size_t idx = 0; idx < sizeof(m_IV) - 1; idx++) |
| 353 | { |
| 354 | m_IV[idx] = m_IV[idx + 1]; |
| 355 | } |
| 356 | m_IV[sizeof(m_IV) - 1] = a_EncryptedIn[i]; |
| 357 | a_DecryptedOut[i] = a_EncryptedIn[i] ^ Buffer[0]; |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | |
| 362 |
no outgoing calls
no test coverage detected