Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
9a14e981
Commit
9a14e981
authored
Feb 20, 2018
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CBC and CFB tests to use aes256_ctx, not the deprecated aes_ctx.
parent
23ef6e35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
ChangeLog
ChangeLog
+3
-3
testsuite/cbc-test.c
testsuite/cbc-test.c
+5
-5
testsuite/cfb-test.c
testsuite/cfb-test.c
+10
-10
No files found.
ChangeLog
View file @
9a14e981
2018-02-20 Niels Möller <nisse@lysator.liu.se>
*
examples/rsa-session.h (struct rsa_session
): Use struct
*
testsuite/cbc-test.c (test_cbc_bulk
): Use struct
aes256_ctx, instead of the deprecated struct aes_ctx.
* testsuite/cfb-test.c (test_cfb_bulk): Likewise.
* examples/rsa-session.h (struct rsa_session): Likewise.
* examples/rsa-encrypt.c (rsa_session_set_encrypt_key)
(process_file): Use aes256_* functions.
* examples/rsa-decrypt.c (rsa_session_set_decrypt_key)
(process_file): Likewise.
2018-02-19 Niels Möller <nisse@lysator.liu.se>
* nettle-internal.h: Include sha3.h, needed for the definition of
...
...
testsuite/cbc-test.c
View file @
9a14e981
...
...
@@ -22,7 +22,7 @@ test_cbc_bulk(void)
const
uint8_t
*
start_iv
=
H
(
"11adbff119749103 207619cfa0e8d13a"
);
const
uint8_t
*
end_iv
=
H
(
"c7a42a569b421224 d0c23e52f46f97f5"
);
struct
CBC_CTX
(
struct
aes_ctx
,
AES_BLOCK_SIZE
)
aes
;
struct
CBC_CTX
(
struct
aes
256
_ctx
,
AES_BLOCK_SIZE
)
aes
;
knuth_lfib_init
(
&
random
,
CBC_BULK_DATA
);
knuth_lfib_random
(
&
random
,
CBC_BULK_DATA
,
clear
);
...
...
@@ -30,10 +30,10 @@ test_cbc_bulk(void)
/* Byte that should not be overwritten */
cipher
[
CBC_BULK_DATA
]
=
17
;
aes_set_encrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_encrypt_key
(
&
aes
.
ctx
,
key
);
CBC_SET_IV
(
&
aes
,
start_iv
);
CBC_ENCRYPT
(
&
aes
,
aes_encrypt
,
CBC_BULK_DATA
,
cipher
,
clear
);
CBC_ENCRYPT
(
&
aes
,
aes
256
_encrypt
,
CBC_BULK_DATA
,
cipher
,
clear
);
ASSERT
(
cipher
[
CBC_BULK_DATA
]
==
17
);
...
...
@@ -47,9 +47,9 @@ test_cbc_bulk(void)
ASSERT
(
MEMEQ
(
AES_BLOCK_SIZE
,
aes
.
iv
,
end_iv
));
/* Decrypt, in place */
aes_set_decrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_decrypt_key
(
&
aes
.
ctx
,
key
);
CBC_SET_IV
(
&
aes
,
start_iv
);
CBC_DECRYPT
(
&
aes
,
aes_decrypt
,
CBC_BULK_DATA
,
cipher
,
cipher
);
CBC_DECRYPT
(
&
aes
,
aes
256
_decrypt
,
CBC_BULK_DATA
,
cipher
,
cipher
);
ASSERT
(
cipher
[
CBC_BULK_DATA
]
==
17
);
...
...
testsuite/cfb-test.c
View file @
9a14e981
...
...
@@ -23,7 +23,7 @@ test_cfb_bulk(void)
const
uint8_t
*
start_iv
=
H
(
"11adbff119749103 207619cfa0e8d13a"
);
const
uint8_t
*
end_iv
=
H
(
"1fd0a9189b8480b7 b06a2b36ef5943ba"
);
struct
CFB_CTX
(
struct
aes_ctx
,
AES_BLOCK_SIZE
)
aes
;
struct
CFB_CTX
(
struct
aes
256
_ctx
,
AES_BLOCK_SIZE
)
aes
;
knuth_lfib_init
(
&
random
,
CFB_BULK_DATA
);
knuth_lfib_random
(
&
random
,
CFB_BULK_DATA
,
clear
);
...
...
@@ -31,10 +31,10 @@ test_cfb_bulk(void)
/* Byte that should not be overwritten */
cipher
[
CFB_BULK_DATA
]
=
17
;
aes_set_encrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_encrypt_key
(
&
aes
.
ctx
,
key
);
CFB_SET_IV
(
&
aes
,
start_iv
);
CFB_ENCRYPT
(
&
aes
,
aes_encrypt
,
CFB_BULK_DATA
,
cipher
,
clear
);
CFB_ENCRYPT
(
&
aes
,
aes
256
_encrypt
,
CFB_BULK_DATA
,
cipher
,
clear
);
ASSERT
(
cipher
[
CFB_BULK_DATA
]
==
17
);
...
...
@@ -48,9 +48,9 @@ test_cfb_bulk(void)
ASSERT
(
MEMEQ
(
AES_BLOCK_SIZE
,
aes
.
iv
,
end_iv
));
/* Decrypt, in place */
aes_set_encrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_encrypt_key
(
&
aes
.
ctx
,
key
);
CFB_SET_IV
(
&
aes
,
start_iv
);
CFB_DECRYPT
(
&
aes
,
aes_encrypt
,
CFB_BULK_DATA
,
cipher
,
cipher
);
CFB_DECRYPT
(
&
aes
,
aes
256
_encrypt
,
CFB_BULK_DATA
,
cipher
,
cipher
);
ASSERT
(
cipher
[
CFB_BULK_DATA
]
==
17
);
...
...
@@ -80,7 +80,7 @@ test_cfb8_bulk(void)
const
uint8_t
*
start_iv
=
H
(
"11adbff119749103 207619cfa0e8d13a"
);
const
uint8_t
*
end_iv
=
H
(
"f84bfd48206f5803 6ef86f4e69e9aec0"
);
struct
CFB8_CTX
(
struct
aes_ctx
,
AES_BLOCK_SIZE
)
aes
;
struct
CFB8_CTX
(
struct
aes
256
_ctx
,
AES_BLOCK_SIZE
)
aes
;
knuth_lfib_init
(
&
random
,
CFB8_BULK_DATA
);
knuth_lfib_random
(
&
random
,
CFB8_BULK_DATA
,
clear
);
...
...
@@ -88,10 +88,10 @@ test_cfb8_bulk(void)
/* Byte that should not be overwritten */
cipher
[
CFB8_BULK_DATA
]
=
17
;
aes_set_encrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_encrypt_key
(
&
aes
.
ctx
,
key
);
CFB8_SET_IV
(
&
aes
,
start_iv
);
CFB8_ENCRYPT
(
&
aes
,
aes_encrypt
,
CFB8_BULK_DATA
,
cipher
,
clear
);
CFB8_ENCRYPT
(
&
aes
,
aes
256
_encrypt
,
CFB8_BULK_DATA
,
cipher
,
clear
);
ASSERT
(
cipher
[
CFB8_BULK_DATA
]
==
17
);
...
...
@@ -105,9 +105,9 @@ test_cfb8_bulk(void)
ASSERT
(
MEMEQ
(
AES_BLOCK_SIZE
,
aes
.
iv
,
end_iv
));
/* Decrypt, in place */
aes_set_encrypt_key
(
&
aes
.
ctx
,
32
,
key
);
aes
256
_set_encrypt_key
(
&
aes
.
ctx
,
key
);
CFB8_SET_IV
(
&
aes
,
start_iv
);
CFB8_DECRYPT
(
&
aes
,
aes_encrypt
,
CFB8_BULK_DATA
,
cipher
,
cipher
);
CFB8_DECRYPT
(
&
aes
,
aes
256
_encrypt
,
CFB8_BULK_DATA
,
cipher
,
cipher
);
ASSERT
(
cipher
[
CFB8_BULK_DATA
]
==
17
);
...
...
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