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
16
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
a8e48bb0
Commit
a8e48bb0
authored
4 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[*] BF fixed
parent
210ae7b9
No related branches found
No related tags found
2 merge requests
!251
Master
,
!250
Master
Pipeline
#5632
passed with stage
in 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
dap-sdk/crypto/src/dap_enc_bf.c
+5
-2
5 additions, 2 deletions
dap-sdk/crypto/src/dap_enc_bf.c
with
6 additions
and
3 deletions
CMakeLists.txt
+
1
−
1
View file @
a8e48bb0
...
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
...
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
cmake_minimum_required
(
VERSION 2.8
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-
9
"
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-
10
"
)
add_definitions
(
"-DCELLFRAME_SDK_VERSION=
\"
${
CELLFRAME_SDK_NATIVE_VERSION
}
\"
"
)
add_definitions
(
"-DCELLFRAME_SDK_VERSION=
\"
${
CELLFRAME_SDK_NATIVE_VERSION
}
\"
"
)
set
(
DAPSDK_MODULES
""
)
set
(
DAPSDK_MODULES
""
)
...
...
This diff is collapsed.
Click to expand it.
dap-sdk/crypto/src/dap_enc_bf.c
+
5
−
2
View file @
a8e48bb0
...
@@ -114,8 +114,11 @@ size_t dap_enc_bf_cbc_decrypt_fast(struct dap_enc_key *a_key, const void * a_in,
...
@@ -114,8 +114,11 @@ size_t dap_enc_bf_cbc_decrypt_fast(struct dap_enc_key *a_key, const void * a_in,
a_key
->
priv_key_data
,
iv
,
BF_DECRYPT
);
a_key
->
priv_key_data
,
iv
,
BF_DECRYPT
);
int
bf_cbc_padding_length
=
*
(
uint8_t
*
)(
a_out
+
a_in_size
-
BLOWFISH_BLOCK_SIZE
-
1
);
int
bf_cbc_padding_length
=
*
(
uint8_t
*
)(
a_out
+
a_in_size
-
BLOWFISH_BLOCK_SIZE
-
1
);
size_t
a_out_size
=
*
(
uint32_t
*
)(
a_out
+
a_in_size
-
BLOWFISH_BLOCK_SIZE
-
1
-
bf_cbc_padding_length
-
4
);
size_t
a_out_size
=
*
(
uint32_t
*
)(
a_out
+
a_in_size
-
BLOWFISH_BLOCK_SIZE
-
1
-
bf_cbc_padding_length
-
4
);
if
(
a_out_size
>
a_in_size
+
BLOWFISH_BLOCK_SIZE
)
{
log_it
(
L_WARNING
,
"blowfish_cbc decryption out size %d too big"
,
a_out_size
);
return
a_in_size
+
BLOWFISH_BLOCK_SIZE
;
}
return
a_out_size
;
return
a_out_size
;
}
}
...
@@ -126,7 +129,7 @@ size_t dap_enc_bf_cbc_encrypt_fast(struct dap_enc_key * a_key, const void * a_in
...
@@ -126,7 +129,7 @@ size_t dap_enc_bf_cbc_encrypt_fast(struct dap_enc_key * a_key, const void * a_in
//generate iv and put it in *a_out first bytes
//generate iv and put it in *a_out first bytes
size_t
a_out_size
=
(
a_in_size
+
4
+
1
+
BLOWFISH_BLOCK_SIZE
-
1
)
/
BLOWFISH_BLOCK_SIZE
*
BLOWFISH_BLOCK_SIZE
+
BLOWFISH_BLOCK_SIZE
;
size_t
a_out_size
=
(
a_in_size
+
4
+
1
+
BLOWFISH_BLOCK_SIZE
-
1
)
/
BLOWFISH_BLOCK_SIZE
*
BLOWFISH_BLOCK_SIZE
+
BLOWFISH_BLOCK_SIZE
;
if
(
a_out_size
>
buf_out_size
)
{
if
(
a_out_size
>
buf_out_size
)
{
log_it
(
L_ERROR
,
"blowfish_cbc fast_encryption too small buf_out_size
"
);
log_it
(
L_ERROR
,
"blowfish_cbc fast_encryption too small buf_out_size
, %d < %d"
,
buf_out_size
,
a_out_size
);
return
0
;
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