#include <stdio.h>

#include <string.h>


static unsigned char RoundKey[];
static unsigned char Key[32];


// AES에서 열(Column)은 4로 고정
#define Num_of_Column 4
// 키에 32비트가 몇개 인지 총 32 * 4 = 128bit
#define Num_of_32bit 4
// AES 암호화를 몇 라운드 시행할지
#define Num_Round 1


// key: 2b7e151628aed2a6abf7158809cf4f3c


static void Key_Expansion(void)
{
 int i, j, x;
 unsigned char temp[4];

 // 처음 RoundKey는 처음 입력한 Key값 그대로
 for (i = 0; i < Num_of_32bit; i++)
 {
  RoundKey[(i * 4) + 0] = Key[(i * 4) + 0];
  RoundKey[(i * 4) + 1] = Key[(i * 4) + 1];
  RoundKey[(i * 4) + 2] = Key[(i * 4) + 2];
  RoundKey[(i * 4) + 3] = Key[(i * 4) + 3];
 }

 // Roundkey 1회만 생성
 for (i = 0; (i < (Num_of_Column * (Num_Round + 1))); i++)
 {
  for (j = 0; j < 4; j++)
  {
   temp[j] = RoundKey[(i - 1) * 4 + j];
  }
  
  // a0, a1, a2, a3 , a4 => a1, a2, a3, a0 순서 변경, 정해진 규칙임
  {
   x = temp[0];
   temp[0] = temp[1];
   temp[1] = temp[2];
   temp[2] = temp[3];
   temp[3] = x;
  }
 }
}






static unsigned char Key[32]; 이렇게 키길이 만들고나서


key: 2b7e151628aed2a6abf7158809cf4f3c 키값이 이러면 어떻게 배열에 어캐 저장시키냐?? { 2b, 72, 15 ...} 이런 식임???


 for (i = 0; i < Num_of_32bit; i++)
 {
  RoundKey[(i * 4) + 0] = Key[(i * 4) + 0];
  RoundKey[(i * 4) + 1] = Key[(i * 4) + 1];
  RoundKey[(i * 4) + 2] = Key[(i * 4) + 2];
  RoundKey[(i * 4) + 3] = Key[(i * 4) + 3];
 }


이렇게 복사시켜도 되는거임???