diff --git a/aes/aesa.c b/aes/aesa.c index 9d6078b3144241505ff1d7a9d3bcd350186674d7..ce1acad6c25a4ad4cf61d46074ac5317efd35c0a 100644 --- a/aes/aesa.c +++ b/aes/aesa.c @@ -11,8 +11,8 @@ // 128-bit encryption void aes_128_enc(uint8_t* key, uint8_t* iv, uint8_t* plaintext, uint8_t* ciphertext, uint8_t num_blocks) { - // atom_func_start(AES_128_ENC); - atom_func_start_linear(AES_128_ENC, num_blocks / 16); + atom_func_start(AES_128_ENC); + // atom_func_start_linear(AES_128_ENC, num_blocks / 16); // Reset AES Module (clears internal state memory) AESACTL0 = AESSWRST; @@ -68,8 +68,8 @@ void aes_128_enc(uint8_t* key, uint8_t* iv, uint8_t* plaintext, while (!(DMA0CTL & DMAIFG)) {} DMA0CTL &= ~DMAIFG; - // atom_func_end(AES_128_ENC); - atom_func_end_linear(AES_128_ENC, num_blocks / 16); + atom_func_end(AES_128_ENC); + // atom_func_end_linear(AES_128_ENC, num_blocks / 16); } // 128-bit decryption, old diff --git a/aes/main.c b/aes/main.c index 2ebbbced5f54b67622a6bb9e5406a53703217fdc..5d9351fba2e52a2eafa823e8f2f3eba872f6dcb3 100644 --- a/aes/main.c +++ b/aes/main.c @@ -133,8 +133,8 @@ unsigned char __attribute__((section(".persistent"))) input[4096] = unsigned char __attribute__((section(".persistent"))) output[4096]; // unsigned char __attribute__((section(".persistent"))) output2[4096]; -uint8_t __attribute__((section(".persistent"))) rd_arr[50] = {15, 5, 7, 11, 13, 5, 3, 7, 3, 5, 12, 8, 4, 6, 10, 13, 8, 4, 5, 5, 7, 4, 2, 7, 10, 14, 5, 9, 6, 8, 9, 14, 5, 12, 10, 11, 15, 4, 3, 11, 6, 2, 10, 7, 6, 10, 8, 7, 9, 11}; -uint8_t __attribute__((section(".persistent"))) rd_i = 0; +// uint8_t __attribute__((section(".persistent"))) rd_arr[50] = {15, 5, 7, 11, 13, 5, 3, 7, 3, 5, 12, 8, 4, 6, 10, 13, 8, 4, 5, 5, 7, 4, 2, 7, 10, 14, 5, 9, 6, 8, 9, 14, 5, 12, 10, 11, 15, 4, 3, 11, 6, 2, 10, 7, 6, 10, 8, 7, 9, 11}; +// uint8_t __attribute__((section(".persistent"))) rd_i = 0; // void dummy_function(uint16_t cnt) { // atom_func_start_linear(0, cnt); @@ -176,9 +176,11 @@ int main(void) { // uart_init(); // Init UART for printing // uint16_t j = 1; // For dummy function test for (;;) { + // ******* Linear adaptation test ******* // aes_128_enc(key, iv, input, output, 16 * rd_arr[rd_i]); - aes_256_enc(key, iv, input, output, 16 * rd_arr[rd_i]); - if (++rd_i == 50) rd_i = 0; + // aes_256_enc(key, iv, input, output, 16 * rd_arr[rd_i]); + // if (++rd_i == 50) rd_i = 0; + // ******* Dummy function test ******* // dummy_function(j); // if (++j == 10) { @@ -191,7 +193,7 @@ int main(void) { // aes_128_enc(key, iv, input, output, 16); // Encrypt 256B data // aes_128_enc(key, iv, input, output, 32); // Encrypt 512B data - // aes_128_enc(key, iv, input, output, 64); // Encrypt 1KB data + aes_128_enc(key, iv, input, output, 64); // Encrypt 1KB data // aes_128_enc(key, iv, input, output, 96); // Encrypt 1.5KB data // aes_128_enc(key, iv, input, output, 128); // Encrypt 2KB data // aes_128_enc(key, iv, input, output, 160); // Encrypt 2.5KB data diff --git a/lib/opta/config.h b/lib/opta/config.h index 8d21ff1680067f6141c47a849d2c85a586fbb4ea..1f9a28fffb30cf6f7492fa2434ad8f464399bd4d 100644 --- a/lib/opta/config.h +++ b/lib/opta/config.h @@ -24,11 +24,11 @@ #define COMPARATOR_DELAY __delay_cycles(280) // 35us -#define DEFAULT_HI_THRESHOLD 56 // Value from threshold table +#define DEFAULT_HI_THRESHOLD 66 // Value from threshold table #define DEFAULT_LO_THRESHOLD 95 // Value from threshold table // Should be 2V // otherwise our ADC doesn't work -#define PROFILING_THRESHOLD 21 // Index from threshold table, initial threshold +#define PROFILING_THRESHOLD 15 // Index from threshold table, initial threshold #define FIXED_THRESHOLD 35 // Used in test #define THRESHOLD_TABLE_MAX_INDEX 28 #define ADC_STEP 32 diff --git a/scripts/design_comparison/design_comparison.py b/scripts/design_comparison/design_comparison.py index 858dfdf79b1fbf5ebd22874d7095b3b01da3326e..d1b0ab7257ad4e8a09ed740585960b07832d91dc 100644 --- a/scripts/design_comparison/design_comparison.py +++ b/scripts/design_comparison/design_comparison.py @@ -317,29 +317,26 @@ def main_single(): ax1 = fig.add_subplot(gs[0, 0]) ax1.plot(t_trace, v_trace_samoyed) ax1.tick_params(direction='in', top=True, right=True) - ax1.set_title('Samoyed', fontname="Times New Roman") - ax1.set_xlabel('Time (s)', fontname="Times New Roman") - ax1.set_ylabel('Voltage (V)', fontname="Times New Roman") + ax1.xaxis.set_ticklabels([]) + ax1.set_ylabel('Samoyed\nVoltage (V)', fontname="Times New Roman") ax1.set_xlim([0, 2]) - ax1.set_ylim([1.5, 3]) + ax1.set_ylim([1.7, 3]) ax2 = fig.add_subplot(gs[1, 0]) ax2.plot(t_trace, v_trace_debs_high) ax2.tick_params(direction='in', top=True, right=True) - ax2.set_title('DEBS High', fontname="Times New Roman") - ax2.set_xlabel('Time (s)', fontname="Times New Roman") - ax2.set_ylabel('Voltage (V)', fontname="Times New Roman") + ax2.xaxis.set_ticklabels([]) + ax2.set_ylabel('DEBS High\nVoltage (V)', fontname="Times New Roman") ax2.set_xlim([0, 2]) - ax2.set_ylim([1.5, 3]) + ax2.set_ylim([1.7, 3]) ax3 = fig.add_subplot(gs[2, 0]) ax3.plot(t_trace, v_trace_repa) ax3.tick_params(direction='in', top=True, right=True) - ax3.set_title('Adaptive', fontname="Times New Roman") ax3.set_xlabel('Time (s)', fontname="Times New Roman") - ax3.set_ylabel('Voltage (V)', fontname="Times New Roman") + ax3.set_ylabel('OPTIC Oracle\nVoltage (V)', fontname="Times New Roman") ax3.set_xlim([0, 2]) - ax3.set_ylim([1.5, 3]) + ax3.set_ylim([1.7, 3]) # plt.show() plt.savefig('voltage_traces.pdf') diff --git a/scripts/design_comparison/voltage_traces.pdf b/scripts/design_comparison/voltage_traces.pdf new file mode 100644 index 0000000000000000000000000000000000000000..89b0406993f912ca98ca8daf128f6bd0d2435b31 Binary files /dev/null and b/scripts/design_comparison/voltage_traces.pdf differ