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
9408cff6
authored
Nov 20, 2019
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrected esp32 interrupts
parent
33472d31
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
templates/esp32/src/main.ino
+9
-8
No files found.
templates/esp32/src/main.ino
View file @
9408cff6
...
@@ -61,11 +61,16 @@ void setup() {
...
@@ -61,11 +61,16 @@ void setup() {
memset
(
ad
,
0
,
MAX_BYTES
);
memset
(
ad
,
0
,
MAX_BYTES
);
memset
(
m
,
0
,
MAX_BYTES
);
memset
(
m
,
0
,
MAX_BYTES
);
memset
(
c
,
0
,
MAX_BYTES
);
memset
(
c
,
0
,
MAX_BYTES
);
mlen
=
8
;
adlen
=
0
;
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
SerialOut
.
print
(
"Hello, World!"
);
SerialOut
.
print
(
"Hello, World!"
);
}
}
void
loop
()
{
void
loop
()
{
int
res
;
int
res
;
portMUX_TYPE
mux
=
portMUX_INITIALIZER_UNLOCKED
;
uint16_t
len
=
uartp_recv
(
cmdbuf
,
CMDBUF_LEN
-
1
);
uint16_t
len
=
uartp_recv
(
cmdbuf
,
CMDBUF_LEN
-
1
);
uint8_t
action
=
cmdbuf
[
0
];
uint8_t
action
=
cmdbuf
[
0
];
if
(
len
==
0
||
len
>
CMDBUF_LEN
-
1
)
if
(
len
==
0
||
len
>
CMDBUF_LEN
-
1
)
...
@@ -82,22 +87,18 @@ void loop() {
...
@@ -82,22 +87,18 @@ void loop() {
case
'p'
:
my_assert
(
l
==
CRYPTO_NPUBBYTES
);
memcpy
(
npub
,
var
,
l
);
break
;
case
'p'
:
my_assert
(
l
==
CRYPTO_NPUBBYTES
);
memcpy
(
npub
,
var
,
l
);
break
;
case
's'
:
my_assert
(
l
==
CRYPTO_NSECBYTES
);
memcpy
(
nsec
,
var
,
l
);
break
;
case
's'
:
my_assert
(
l
==
CRYPTO_NSECBYTES
);
memcpy
(
nsec
,
var
,
l
);
break
;
case
'e'
:
case
'e'
:
noInterrupts
();
portENTER_CRITICAL
(
&
mux
);
asm
(
"nop"
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
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
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
portEXIT_CRITICAL
(
&
mux
);
interrupts
();
break
;
break
;
case
'd'
:
case
'd'
:
noInterrupts
();
portENTER_CRITICAL
(
&
mux
);
asm
(
"nop"
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
res
=
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
res
=
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
portEXIT_CRITICAL
(
&
mux
);
interrupts
();
break
;
break
;
case
'M'
:
var
=
m
;
rl
=
mlen
;
break
;
case
'M'
:
var
=
m
;
rl
=
mlen
;
break
;
case
'C'
:
var
=
c
;
rl
=
clen
;
break
;
case
'C'
:
var
=
c
;
rl
=
clen
;
break
;
...
...
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