MCPcopy Create free account
hub / github.com/S3N4T0R-0X0/PixelCode-Attack / Cipher

Function Cipher

payload.cpp:519–542  ·  view source on GitHub ↗

Cipher is the main function that encrypts the PlainText.

Source from the content-addressed store, hash-verified

517
518// Cipher is the main function that encrypts the PlainText.
519static void Cipher(state_t* state, const uint8_t* RoundKey)
520{
521 uint8_t round = 0;
522
523 // Add the First round key to the state before starting the rounds.
524 AddRoundKey(0, state, RoundKey);
525
526 // There will be Nr rounds.
527 // The first Nr-1 rounds are identical.
528 // These Nr rounds are executed in the loop below.
529 // Last one without MixColumns()
530 for (round = 1; ; ++round)
531 {
532 SubBytes(state);
533 ShiftRows(state);
534 if (round == Nr) {
535 break;
536 }
537 MixColumns(state);
538 AddRoundKey(round, state, RoundKey);
539 }
540 // Add round key to last round
541 AddRoundKey(Nr, state, RoundKey);
542}
543
544#if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1)
545static void InvCipher(state_t* state, const uint8_t* RoundKey)

Callers 3

AES_ECB_encryptFunction · 0.85
AES_CBC_encrypt_bufferFunction · 0.85
AES_CTR_xcrypt_bufferFunction · 0.85

Calls 4

AddRoundKeyFunction · 0.85
SubBytesFunction · 0.85
ShiftRowsFunction · 0.85
MixColumnsFunction · 0.85

Tested by

no test coverage detected