Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8d7af98d
authored
Jul 16, 2019
by
Sebastian Renner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decrypt guarded by GPIO toggle
parent
23e6c280
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
templates/blackpill/Src/main.c
+13
-4
templates/f7/Src/main.c
+13
-4
No files found.
templates/blackpill/Src/main.c
View file @
8d7af98d
...
@@ -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
"
);
...
@@ -238,6 +234,19 @@ int main(void)
...
@@ -238,6 +234,19 @@ int main(void)
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
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
;
...
...
templates/f7/Src/main.c
View file @
8d7af98d
...
@@ -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
"
);
...
@@ -244,6 +240,19 @@ int main(void)
...
@@ -244,6 +240,19 @@ int main(void)
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment