Commit 8d7af98d by Sebastian Renner

Decrypt guarded by GPIO toggle

parent 23e6c280
...@@ -223,10 +223,6 @@ int main(void) ...@@ -223,10 +223,6 @@ int main(void)
case 'S': write_variable_serial(nsec, nslen); break; case 'S': write_variable_serial(nsec, nslen); break;
case 'P': write_variable_serial(npub, nplen); break; case 'P': write_variable_serial(npub, nplen); break;
case 'd':
res = crypto_aead_decrypt(m, &mlen, nsec, c, clen, ad, adlen, npub, k);
break;
case 'e': case 'e':
#ifdef DEBUG #ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n"); dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
...@@ -239,6 +235,19 @@ int main(void) ...@@ -239,6 +235,19 @@ int main(void)
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12); LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
break; break;
case 'd':
#ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
dbg_printf("a: "); for (int i = 0; i < adlen; i++) dbg_printf("%02x", ad[i]); dbg_printf("\n");
dbg_printf("p: "); for (int i = 0; i < nplen; i++) dbg_printf("%02x", npub[i]); dbg_printf("\n");
dbg_printf("k: "); for (int i = 0; i < klen; i++) dbg_printf("%02x", k[i]); dbg_printf("\n");
#endif
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
res = crypto_aead_decrypt(m, &mlen, nsec, c, clen, ad, adlen, npub, k);
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
break;
default: default:
continue; continue;
......
...@@ -229,10 +229,6 @@ int main(void) ...@@ -229,10 +229,6 @@ int main(void)
case 'S': write_variable_serial(nsec, nslen); break; case 'S': write_variable_serial(nsec, nslen); break;
case 'P': write_variable_serial(npub, nplen); break; case 'P': write_variable_serial(npub, nplen); break;
case 'd':
res = crypto_aead_decrypt(m, &mlen, nsec, c, clen, ad, adlen, npub, k);
break;
case 'e': case 'e':
#ifdef DEBUG #ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n"); dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
...@@ -245,6 +241,19 @@ int main(void) ...@@ -245,6 +241,19 @@ int main(void)
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_7); LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_7);
break; break;
case 'd':
#ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
dbg_printf("a: "); for (int i = 0; i < adlen; i++) dbg_printf("%02x", ad[i]); dbg_printf("\n");
dbg_printf("p: "); for (int i = 0; i < nplen; i++) dbg_printf("%02x", npub[i]); dbg_printf("\n");
dbg_printf("k: "); for (int i = 0; i < klen; i++) dbg_printf("%02x", k[i]); dbg_printf("\n");
#endif
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
res = crypto_aead_decrypt(m, &mlen, nsec, c, clen, ad, adlen, npub, k);
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
break;
default: default:
continue; continue;
......
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 sign in to comment