| 543 | |
| 544 | #if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) |
| 545 | static void InvCipher(state_t* state, const uint8_t* RoundKey) |
| 546 | { |
| 547 | uint8_t round = 0; |
| 548 | |
| 549 | // Add the First round key to the state before starting the rounds. |
| 550 | AddRoundKey(Nr, state, RoundKey); |
| 551 | |
| 552 | // There will be Nr rounds. |
| 553 | // The first Nr-1 rounds are identical. |
| 554 | // These Nr rounds are executed in the loop below. |
| 555 | // Last one without InvMixColumn() |
| 556 | for (round = (Nr - 1); ; --round) |
| 557 | { |
| 558 | InvShiftRows(state); |
| 559 | InvSubBytes(state); |
| 560 | AddRoundKey(round, state, RoundKey); |
| 561 | if (round == 0) { |
| 562 | break; |
| 563 | } |
| 564 | InvMixColumns(state); |
| 565 | } |
| 566 | |
| 567 | } |
| 568 | #endif // #if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) |
| 569 | |
| 570 | /*****************************************************************************/ |
no test coverage detected