Line 41... |
Line 41... |
int main(){
|
int main(){
|
avs_aes_handle context;
|
avs_aes_handle context;
|
int i=0;
|
int i=0;
|
|
|
unsigned int result[4];
|
unsigned int result[4];
|
unsigned int Userkey[8] = {
|
unsigned int Userkey[] = {
|
0x11111111,0x22222222,0x33333333,0x44444444,
|
0x11111111, 0x22222222,
|
0x55555555,0x66666666,0x77777777,0x88888888};
|
0x33333333, 0x44444444,
|
unsigned int Payload[4] = {
|
0x55555555, 0x66666666,
|
0xAA555555,0xBB666666,0xCC777777,0xDD888888};
|
0x77777777, 0x88888888
|
|
};
|
|
unsigned int Payload[] = {
|
|
0xAA555555, 0xBB666666,
|
|
0xCC777777, 0xDD888888
|
|
};
|
|
|
// START AES-Operations
|
// START AES-Operations
|
printf("AES-Test\n");
|
printf("AES-Test\n");
|
avs_aes_init(&context);
|
avs_aes_init(&context);
|
avs_aes_setKey(&context,&Userkey);
|
avs_aes_setKey(&context, &Userkey);
|
avs_aes_setPayload(&context,&Payload);
|
avs_aes_setPayload(&context, &Payload);
|
avs_aes_encrypt(&context);
|
avs_aes_encrypt(&context);
|
|
|
while(avs_aes_isBusy(&context)){
|
while(avs_aes_isBusy(&context)){
|
printf("not ready\n");
|
printf("not ready\n");
|
}
|
}
|
printf("receiving 729cd44f 32a48d85 b8188185 c579ae49\n");
|
printf("receiving 729cd44f 32a48d85 b8188185 c579ae49\n");
|
memcpy(result,context.result,4*sizeof(unsigned int));
|
memcpy(result, context.result, sizeof(result));
|
for(i=0; i<4 ; i++){
|
for(i=0; i<4 ; i++){
|
printf("received 0x%X \n",result[i]);
|
printf("received 0x%X \n",result[i]);
|
}
|
}
|
|
|
// Decrypt same payload -
|
// Decrypt same payload -
|
avs_aes_decrypt(&context);
|
avs_aes_decrypt(&context);
|
while(avs_aes_isBusy(&context)){
|
while(avs_aes_isBusy(&context)){
|
printf("not ready\n");
|
printf("not ready\n");
|
}
|
}
|
printf("receiving 9c7076af ac2e5716 6681d3ac 014f64c0 \n");
|
printf("receiving 9c7076af ac2e5716 6681d3ac 014f64c0 \n");
|
memcpy(result,context.result,4*sizeof(unsigned int));
|
memcpy(result, context.result, sizeof(result));
|
for(i=0; i<4 ; i++){
|
for(i=0; i<4 ; i++){
|
printf("received 0x%X \n",result[i]);
|
printf("received 0x%X \n",result[i]);
|
}
|
}
|
// Change payload ...
|
// Change payload ...
|
Payload[3] = 0x11111111;
|
Payload[3] = 0x11111111;
|
Payload[2] = 0xAAAAAAAA;
|
Payload[2] = 0xAAAAAAAA;
|
Payload[1] = 0xCCCCCCCC;
|
Payload[1] = 0xCCCCCCCC;
|
Payload[0] = 0x00000000;
|
Payload[0] = 0x00000000;
|
//new encryption
|
//new encryption
|
avs_aes_setPayload(&context,&Payload);
|
avs_aes_setPayload(&context, &Payload);
|
avs_aes_encrypt(&context);
|
avs_aes_encrypt(&context);
|
while(avs_aes_isBusy(&context)){
|
while(avs_aes_isBusy(&context)){
|
printf("not ready\n");
|
printf("not ready\n");
|
}
|
}
|
memcpy(result,context.result,4*sizeof(unsigned int));
|
memcpy(result, context.result, sizeof(result));
|
for(i=0; i<4 ; i++){
|
for(i=0; i<4 ; i++){
|
printf("received 0x%X \n",result[i]);
|
printf("received 0x%X \n",result[i]);
|
}
|
}
|
//new decryption
|
//new decryption
|
avs_aes_decrypt(&context);
|
avs_aes_decrypt(&context);
|
Line 100... |
Line 104... |
for(i=0; i<4 ; i++){
|
for(i=0; i<4 ; i++){
|
printf("received 0x%X \n",result[i]);
|
printf("received 0x%X \n",result[i]);
|
}
|
}
|
printf("Done \n");
|
printf("Done \n");
|
|
|
|
|
return 0;
|
return 0;
|
|
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|