Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-crypto
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-crypto
Commits
0f616348
Commit
0f616348
authored
5 years ago
by
alexander.lysikov
Browse files
Options
Downloads
Patches
Plain Diff
fixed dap_chain_str_to_hash_fast()
parent
1dfccbe8
No related branches found
No related tags found
1 merge request
!15
fixed dap_chain_str_to_hash_fast()
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/dap_enc_key.c
+1
-1
1 addition, 1 deletion
src/dap_enc_key.c
src/dap_hash.c
+8
-6
8 additions, 6 deletions
src/dap_hash.c
src/dap_sign.c
+2
-0
2 additions, 0 deletions
src/dap_sign.c
with
11 additions
and
7 deletions
src/dap_enc_key.c
+
1
−
1
View file @
0f616348
...
...
@@ -493,7 +493,7 @@ dap_enc_key_serealize_t* dap_enc_key_serealize(dap_enc_key_t * key)
dap_enc_key_t
*
dap_enc_key_deserealize
(
const
void
*
buf
,
size_t
buf_size
)
{
if
(
buf_size
!=
sizeof
(
dap_enc_key_serealize_t
))
{
log_it
(
L_ERROR
,
"Key can't be deserealize. buf_size != sizeof (dap_enc_key_serealize_t)
"
);
log_it
(
L_ERROR
,
"Key can't be deserealize. buf_size
(%d)
!= sizeof (dap_enc_key_serealize_t)
(%d)"
,
buf_size
,
sizeof
(
dap_enc_key_serealize_t
)
);
return
NULL
;
}
const
dap_enc_key_serealize_t
*
in_key
=
(
const
dap_enc_key_serealize_t
*
)
buf
;
...
...
This diff is collapsed.
Click to expand it.
src/dap_hash.c
+
8
−
6
View file @
0f616348
...
...
@@ -42,12 +42,14 @@ int dap_chain_str_to_hash_fast( const char * a_hash_str, dap_chain_hash_fast_t *
const
size_t
c_hash_str_size
=
sizeof
(
*
a_hash
)
*
2
+
1
/*trailing zero*/
+
2
/* heading 0x */
;
size_t
l_hash_str_len
=
strlen
(
a_hash_str
);
if
(
l_hash_str_len
+
1
==
c_hash_str_size
){
for
(
size_t
l_offset
=
2
;
l_offset
<
l_hash_str_len
;
l_offset
+=
2
){
if
(
(
sscanf
(
a_hash_str
+
l_offset
,
"%02hhx"
,
a_hash
->
raw
+
l_offset
/
2
-
1
)
!=
1
)
||
(
sscanf
(
a_hash_str
+
l_offset
,
"%02hhX"
,
a_hash
->
raw
+
l_offset
/
2
-
1
)
!=
1
)
)
log_it
(
L_ERROR
,
"dap_chain_str_to_hash_fast parse error: offset=%u, hash_str_len=%u, str=
\"
%2s
\"
"
,
l_offset
,
l_hash_str_len
,
a_hash_str
+
l_offset
);
return
-
10
*
((
int
)
l_offset
);
// Wrong char
for
(
size_t
l_offset
=
2
;
l_offset
<
l_hash_str_len
;
l_offset
+=
2
)
{
if
(
sscanf
(
a_hash_str
+
l_offset
,
"%02hhx"
,
a_hash
->
raw
+
l_offset
/
2
-
1
)
!=
1
)
{
if
(
sscanf
(
a_hash_str
+
l_offset
,
"%02hhX"
,
a_hash
->
raw
+
l_offset
/
2
-
1
)
!=
1
)
{
log_it
(
L_ERROR
,
"dap_chain_str_to_hash_fast parse error: offset=%u, hash_str_len=%u, str=
\"
%2s
\"
"
,
l_offset
,
l_hash_str_len
,
a_hash_str
+
l_offset
);
return
-
10
*
((
int
)
l_offset
);
// Wrong char
}
}
}
return
0
;
}
else
// Wromg string len
...
...
This diff is collapsed.
Click to expand it.
src/dap_sign.c
+
2
−
0
View file @
0f616348
...
...
@@ -40,6 +40,8 @@ static bliss_signature_t s_sign_bliss_null = {0};
// calc signature size
size_t
dap_sign_create_output_unserialized_calc_size
(
dap_enc_key_t
*
a_key
,
size_t
a_output_wish_size
)
{
if
(
!
a_key
)
return
0
;
size_t
l_sign_size
=
0
;
switch
(
a_key
->
type
){
case
DAP_ENC_KEY_TYPE_SIG_BLISS
:
l_sign_size
=
sizeof
(
s_sign_bliss_null
);
break
;
...
...
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