Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
18
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
6d5a3b7f
Commit
6d5a3b7f
authored
4 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[!] Crystal Dilithium signature check fixed
parent
b1e0a61a
No related branches found
No related tags found
No related merge requests found
Pipeline
#6933
passed with stage
Stage: analyze
in 14 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
dap-sdk/crypto/src/dap_enc_dilithium.c
+3
-2
3 additions, 2 deletions
dap-sdk/crypto/src/dap_enc_dilithium.c
dap-sdk/crypto/src/sig_dilithium/dilithium_sign.c
+8
-7
8 additions, 7 deletions
dap-sdk/crypto/src/sig_dilithium/dilithium_sign.c
with
12 additions
and
10 deletions
CMakeLists.txt
+
1
−
1
View file @
6d5a3b7f
...
...
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-10
0
"
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-10
1
"
)
add_definitions
(
"-DCELLFRAME_SDK_VERSION=
\"
${
CELLFRAME_SDK_NATIVE_VERSION
}
\"
"
)
set
(
DAPSDK_MODULES
""
)
...
...
This diff is collapsed.
Click to expand it.
dap-sdk/crypto/src/dap_enc_dilithium.c
+
3
−
2
View file @
6d5a3b7f
...
...
@@ -84,8 +84,9 @@ size_t dap_enc_sig_dilithium_verify_sign(struct dap_enc_key * key, const void *
log_it
(
L_ERROR
,
"bad signature size"
);
return
0
;
}
return
(
dilithium_crypto_sign_open
(
(
unsigned
char
*
)
msg
,
msg_size
,
(
dilithium_signature_t
*
)
signature
,
key
->
pub_key_data
));
int
l_ret
=
dilithium_crypto_sign_open
(
(
unsigned
char
*
)
msg
,
msg_size
,
(
dilithium_signature_t
*
)
signature
,
key
->
pub_key_data
);
log_it
(
L_WARNING
,
"Wrong signature, can't open with code %d"
,
l_ret
);
return
l_ret
>
0
?
l_ret
:
0
;
}
void
dap_enc_sig_dilithium_key_delete
(
struct
dap_enc_key
*
key
)
...
...
This diff is collapsed.
Click to expand it.
dap-sdk/crypto/src/sig_dilithium/dilithium_sign.c
+
8
−
7
View file @
6d5a3b7f
...
...
@@ -318,17 +318,18 @@ int dilithium_crypto_sign( dilithium_signature_t *sig, const unsigned char *m, u
/*************************************************/
int
dilithium_crypto_sign_open
(
unsigned
char
*
m
,
unsigned
long
long
mlen
,
dilithium_signature_t
*
sig
,
const
dilithium_public_key_t
*
public_key
)
{
assert
(
public_key
->
kind
==
sig
->
kind
);
if
(
public_key
->
kind
!=
sig
->
kind
)
return
-
1
;
dilithium_param_t
*
p
=
malloc
(
sizeof
(
dilithium_param_t
));
if
(
!
dilithium_params_init
(
p
,
public_key
->
kind
))
{
free
(
p
);
return
-
1
;
return
-
2
;
}
if
(
sig
->
sig_len
<
p
->
CRYPTO_BYTES
)
{
free
(
p
);
return
-
1
;
return
-
3
;
}
unsigned
long
long
i
;
...
...
@@ -340,18 +341,18 @@ int dilithium_crypto_sign_open( unsigned char *m, unsigned long long mlen, dilit
if
((
sig
->
sig_len
-
p
->
CRYPTO_BYTES
)
!=
mlen
)
{
free
(
p
);
return
-
1
;
return
-
4
;
}
dilithium_unpack_pk
(
rho
,
&
t1
,
public_key
->
data
,
p
);
if
(
dilithium_unpack_sig
(
&
z
,
&
h
,
&
c
,
sig
->
sig_data
,
p
))
{
free
(
p
);
return
-
1
;
return
-
5
;
}
if
(
polyvecl_chknorm
(
&
z
,
GAMMA1
-
p
->
PARAM_BETA
,
p
))
{
free
(
p
);
return
-
1
;
return
-
6
;
}
unsigned
char
*
tmp_m
=
malloc
(
CRHBYTES
+
mlen
);
...
...
@@ -388,7 +389,7 @@ int dilithium_crypto_sign_open( unsigned char *m, unsigned long long mlen, dilit
for
(
i
=
0
;
i
<
NN
;
++
i
)
if
(
c
.
coeffs
[
i
]
!=
cp
.
coeffs
[
i
])
{
free
(
p
);
return
-
1
;
return
-
7
;
}
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment