Commit 8d7af98d by Sebastian Renner

Decrypt guarded by GPIO toggle

parent 23e6c280
......@@ -223,10 +223,6 @@ int main(void)
case 'S': write_variable_serial(nsec, nslen); 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':
#ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
......@@ -238,6 +234,19 @@ int main(void)
res = crypto_aead_encrypt(c, &clen, m, mlen, ad, adlen, nsec, npub, k);
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_12);
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:
continue;
......
......@@ -229,10 +229,6 @@ int main(void)
case 'S': write_variable_serial(nsec, nslen); 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':
#ifdef DEBUG
dbg_printf("m: "); for (int i = 0; i < mlen; i++) dbg_printf("%02x", m[i]); dbg_printf("\n");
......@@ -244,6 +240,19 @@ int main(void)
res = crypto_aead_encrypt(c, &clen, m, mlen, ad, adlen, nsec, npub, k);
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_7);
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:
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