tests: Add test case for bug #147
Signed-off-by: Alan Dunn <amdunn@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
3d9b1693eb
Коммит
577840d7f7
@ -766,6 +766,37 @@ static void torture_pki_duplicate_key_ecdsa(void **state)
|
||||
ssh_string_free_char(b64_key);
|
||||
ssh_string_free_char(b64_key_gen);
|
||||
}
|
||||
|
||||
/* Test case for bug #147: Private ECDSA key duplication did not carry
|
||||
* over parts of the key that then caused subsequent key demotion to
|
||||
* fail.
|
||||
*/
|
||||
static void torture_pki_ecdsa_duplicate_then_demote(void **state)
|
||||
{
|
||||
ssh_key pubkey;
|
||||
ssh_key privkey;
|
||||
ssh_key privkey_dup;
|
||||
int rc;
|
||||
|
||||
(void) state;
|
||||
|
||||
rc = ssh_pki_import_privkey_file(LIBSSH_ECDSA_TESTKEY,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&privkey);
|
||||
assert_true(rc == 0);
|
||||
|
||||
privkey_dup = ssh_key_dup(privkey);
|
||||
assert_true(privkey_dup != NULL);
|
||||
|
||||
rc = ssh_pki_export_privkey_to_pubkey(privkey_dup, &pubkey);
|
||||
assert_true(rc == 0);
|
||||
|
||||
ssh_key_free(pubkey);
|
||||
ssh_key_free(privkey);
|
||||
ssh_key_free(privkey_dup);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void torture_pki_generate_key_rsa(void **state)
|
||||
@ -1109,6 +1140,9 @@ int torture_run_tests(void) {
|
||||
unit_test_setup_teardown(torture_pki_publickey_from_privatekey_ECDSA,
|
||||
setup_ecdsa_key,
|
||||
teardown),
|
||||
unit_test_setup_teardown(torture_pki_ecdsa_duplicate_then_demote,
|
||||
setup_ecdsa_key,
|
||||
teardown),
|
||||
#endif
|
||||
/* public key */
|
||||
unit_test_setup_teardown(torture_pki_publickey_dsa_base64,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user