Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lsh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
LSH
lsh
Commits
43b72688
Commit
43b72688
authored
Sep 17, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support 3des-ctr.
parent
f36de37c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
4 deletions
+64
-4
ChangeLog
ChangeLog
+14
-0
src/algorithms.c
src/algorithms.c
+7
-3
src/crypto.c
src/crypto.c
+41
-0
src/crypto.h
src/crypto.h
+1
-0
src/testsuite/lsh-6-test
src/testsuite/lsh-6-test
+1
-1
No files found.
ChangeLog
View file @
43b72688
2013-09-17 Niels Möller <nisse@lysator.liu.se>
* src/testsuite/lsh-6-test (ALGORITHMS): Test both 3des-cbc and
3des-ctr.
* src/algorithms.c (all_symmetric_algorithms): Added ATOM_3DES_CTR.
(all_crypto_algorithms): Likewise.
(lookup_crypto): For parsng the -c option, make just "3des" mean
"3des-ctr" rather than "3des-cbc".
* src/crypto.c (des3_ctr_instance): New class.
(do_des3_ctr_crypt): New function.
(make_des3_ctr_instance): New function.
(crypto_des3_ctr_algorithm): New struct.
* src/crypto.h (crypto_des3_ctr_algorithm): Declare.
* src/dsa.c (do_dsa_sign): Fixed failure message.
2013-09-02 Niels Möller <nisse@lysator.liu.se>
...
...
src/algorithms.c
View file @
43b72688
...
...
@@ -47,7 +47,7 @@
struct
alist
*
all_symmetric_algorithms
()
{
return
make_alist
(
1
2
return
make_alist
(
1
3
#if WITH_ZLIB
+
1
#endif
...
...
@@ -61,6 +61,7 @@ all_symmetric_algorithms()
ATOM_AES256_CTR
,
&
crypto_aes256_ctr_algorithm
,
ATOM_SERPENT256_CBC
,
&
crypto_serpent256_cbc_algorithm
,
ATOM_3DES_CBC
,
&
crypto_des3_cbc_algorithm
,
ATOM_3DES_CTR
,
&
crypto_des3_ctr_algorithm
,
ATOM_CAST128_CBC
,
&
crypto_cast128_cbc_algorithm
,
ATOM_HMAC_SHA1
,
make_hmac_algorithm
(
&
nettle_sha1
),
...
...
@@ -105,12 +106,13 @@ default_crypto_algorithms(struct alist *algorithms)
static
struct
int_list
*
all_crypto_algorithms
(
struct
alist
*
algorithms
)
{
return
filter_algorithms_l
(
algorithms
,
1
0
,
return
filter_algorithms_l
(
algorithms
,
1
1
,
ATOM_AES128_CBC
,
ATOM_AES128_CTR
,
ATOM_AES256_CBC
,
ATOM_AES256_CTR
,
ATOM_3DES_CBC
,
ATOM_3DES_CTR
,
ATOM_TWOFISH_CBC
,
ATOM_CAST128_CBC
,
ATOM_SERPENT256_CBC
,
...
...
@@ -190,8 +192,10 @@ lookup_crypto(struct alist *algorithms, const char *name, struct crypto_algorith
atom
=
ATOM_TWOFISH_CBC
;
else
if
(
strcasecmp_list
(
name
,
"blowfish-cbc"
,
"blowfish"
,
NULL
))
atom
=
ATOM_BLOWFISH_CBC
;
else
if
(
strcasecmp_list
(
name
,
"3des-cbc"
,
"3des"
,
NULL
))
else
if
(
strcasecmp_list
(
name
,
"3des-cbc"
,
NULL
))
atom
=
ATOM_3DES_CBC
;
else
if
(
strcasecmp_list
(
name
,
"3des-ctr"
,
"3des"
,
NULL
))
atom
=
ATOM_3DES_CTR
;
else
if
(
strcasecmp_list
(
name
,
"aes128-cbc"
,
"aes-cbc"
,
NULL
))
atom
=
ATOM_AES128_CBC
;
else
if
(
strcasecmp_list
(
name
,
"aes128-ctr"
,
"aes-ctr"
,
"aes"
,
"aes128"
,
NULL
))
...
...
src/crypto.c
View file @
43b72688
...
...
@@ -276,6 +276,47 @@ struct crypto_algorithm crypto_des3_cbc_algorithm =
{
STATIC_HEADER
,
DES3_BLOCK_SIZE
,
DES3_KEY_SIZE
,
DES3_BLOCK_SIZE
,
make_des3_cbc_instance
};
/* GABA:
(class
(name des3_ctr_instance)
(super crypto_instance)
(vars
(ctx . "struct CTR_CTX(struct des3_ctx, DES_BLOCK_SIZE)")))
*/
static
void
do_des3_ctr_crypt
(
struct
crypto_instance
*
s
,
uint32_t
length
,
struct
lsh_string
*
dst
,
uint32_t
di
,
const
struct
lsh_string
*
src
,
uint32_t
si
)
{
CAST
(
des3_ctr_instance
,
self
,
s
);
lsh_string_ctr_crypt
(
dst
,
di
,
src
,
si
,
length
,
DES3_BLOCK_SIZE
,
self
->
ctx
.
ctr
,
(
nettle_crypt_func
*
)
des3_encrypt
,
&
self
->
ctx
.
ctx
);
}
static
struct
crypto_instance
*
make_des3_ctr_instance
(
struct
crypto_algorithm
*
algorithm
UNUSED
,
int
mode
UNUSED
,
const
uint8_t
*
key
,
const
uint8_t
*
iv
)
{
NEW
(
des3_ctr_instance
,
self
);
self
->
super
.
block_size
=
DES3_BLOCK_SIZE
;
self
->
super
.
crypt
=
do_des3_ctr_crypt
;
des3_set_key
(
&
self
->
ctx
.
ctx
,
key
);
CTR_SET_COUNTER
(
&
self
->
ctx
,
iv
);
return
(
&
self
->
super
);
}
struct
crypto_algorithm
crypto_des3_ctr_algorithm
=
{
STATIC_HEADER
,
DES3_BLOCK_SIZE
,
DES3_KEY_SIZE
,
DES3_BLOCK_SIZE
,
make_des3_ctr_instance
};
/* Cast-128 */
/* GABA:
...
...
src/crypto.h
View file @
43b72688
...
...
@@ -85,6 +85,7 @@ extern struct crypto_algorithm crypto_arcfour_algorithm;
extern
struct
crypto_algorithm
crypto_blowfish_cbc_algorithm
;
extern
struct
crypto_algorithm
crypto_cast128_cbc_algorithm
;
extern
struct
crypto_algorithm
crypto_des3_cbc_algorithm
;
extern
struct
crypto_algorithm
crypto_des3_ctr_algorithm
;
extern
struct
crypto_algorithm
crypto_serpent256_cbc_algorithm
;
extern
struct
crypto_algorithm
crypto_twofish256_cbc_algorithm
;
...
...
src/testsuite/lsh-6-test
View file @
43b72688
...
...
@@ -10,7 +10,7 @@ fi
OLD_FLAGS
=
"
$LSH_FLAGS
"
ALGORITHMS
=
"arcfour twofish blowfish 3des aes128-cbc aes128-ctr aes256-cbc aes256-ctr cast128 all"
ALGORITHMS
=
"arcfour twofish blowfish 3des
-cbc 3des-ctr
aes128-cbc aes128-ctr aes256-cbc aes256-ctr cast128 all"
LSHD_FLAGS
=
"
$LSHD_FLAGS
-c all"
...
...
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