Commit 31db3d61 by Farnoud Farahmand

verified hardware v2

parent e0189a90
......@@ -438,14 +438,12 @@ encrypt_cca(
TxBuffer[0]= 0x0000000000008800;
//memcpy(TxBuffer+1, h, 443*2);
for(tx_rx_c =1; tx_rx_c < 744; tx_rx_c ++) {
// initialize RxBuffer with 0's
TxBuffer[tx_rx_c] = complement & h[tx_rx_c -1];
TxBuffer[tx_rx_c] = complement & h[744 - tx_rx_c -1];
}
TxBuffer[744]= 0x0000000000008200;
for(tx_rx_c =745; tx_rx_c < 1239; tx_rx_c ++) {
// initialize RxBuffer with 0's
TxBuffer[tx_rx_c] = complement & r_pos[tx_rx_c-745];
}
......@@ -466,9 +464,9 @@ encrypt_cca(
xil_printf("\r\n Encrypt Mult Execution Time (ENC) = %d \r\n", execution_time);
#endif
for(tx_rx_c = 0; tx_rx_c < 744; tx_rx_c++) {
t[tx_rx_c] = RxBuffer[tx_rx_c+2];
}
for(tx_rx_c = 0; tx_rx_c < 743; tx_rx_c++) {
t[742-tx_rx_c] = RxBuffer[tx_rx_c+2];
}
}else{
#if ROTATION_ON
......@@ -578,14 +576,11 @@ int decrypt_cca(
TxBuffer[0]= 0x0000000000008400;
//memcpy(TxBuffer+1, h, 443*2);
for(tx_rx_c =1; tx_rx_c < 495; tx_rx_c ++) {
// initialize RxBuffer with 0's
TxBuffer[tx_rx_c] = complement & F_pos[tx_rx_c -1];
}
TxBuffer[495]= 0x0000000000009100;
for(tx_rx_c =496; tx_rx_c < 1239; tx_rx_c ++) {
// initialize RxBuffer with 0's
TxBuffer[tx_rx_c] = complement & c[tx_rx_c-496];
TxBuffer[tx_rx_c] = complement & c[1239-tx_rx_c-1];
}
#if POLY_MUL_EXE
......@@ -606,7 +601,7 @@ int decrypt_cca(
#endif
for(tx_rx_c = 0; tx_rx_c < 743; tx_rx_c++) {
m[tx_rx_c] = RxBuffer[tx_rx_c+2];
m[742-tx_rx_c] = RxBuffer[tx_rx_c+2];
}
}else{
#if ROTATION_ON
......@@ -678,7 +673,6 @@ int decrypt_cca(
TxBuffer[0]= 0x0000000000009200;
//memcpy(TxBuffer+1, h, 443*2);
for(tx_rx_c =1; tx_rx_c < 495; tx_rx_c ++) {
// initialize RxBuffer with 0's
TxBuffer[tx_rx_c] = complement & r_pos[tx_rx_c -1];
}
......@@ -700,7 +694,7 @@ int decrypt_cca(
#endif
for(tx_rx_c = 0; tx_rx_c < 743; tx_rx_c++) {
t_rec[tx_rx_c] = RxBuffer[tx_rx_c+1];
t_rec[742-tx_rx_c] = RxBuffer[tx_rx_c+1];
}
}else{
#if ROTATION_ON
......@@ -716,7 +710,6 @@ int decrypt_cca(
#if POLY_MUL_EXE
XTmrCtr_Stop(&TMRInst, 0);
// Read Timer value
execution_time = XTmrCtr_GetValue(&TMRInst, 0);
xil_printf("\r\n Decrypt Mult Execution Time (DEC2) = %d \r\n", execution_time);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment