Skip to content

Commit 6514182

Browse files
committed
test cases for encrypt
1 parent 4ae5fb9 commit 6514182

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/unit/test/sansio/handshake/handshake_csha2p_hash_password.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,37 @@ BOOST_AUTO_TEST_CASE(empty_password)
4343

4444
BOOST_AUTO_TEST_SUITE_END()
4545

46+
BOOST_AUTO_TEST_SUITE(test_handshake_csha2p_encrypt_password)
47+
48+
/**
49+
encrypt password success
50+
success
51+
success password is 20 bytes
52+
success password is > 20 bytes
53+
success password is max length
54+
success password is > max length but key is longer than default max length
55+
password is > 512 (small buffer)
56+
digest is > 512 (small buffer)
57+
error creating buffer (mock)
58+
error loading key
59+
buffer is empty
60+
key is malformed
61+
TODO: should we fuzz this function?
62+
key is not RSA
63+
key is smaller than what we expect?
64+
determining the size of the hash
65+
failure (EVP_PKEY_get_size < 0: mock)
66+
not available (EVP_PKEY_get_size = 0: mock)
67+
error creating ctx (mock)
68+
error setting RSA padding (mock)
69+
encrypting
70+
the returned size is < buffer
71+
the returned size is == buffer
72+
the returned size is > buffer (mock)
73+
encryption fails (probably merge with the one below)
74+
password is too big for encryption (with 2 sizes)
75+
*/
76+
77+
BOOST_AUTO_TEST_SUITE_END()
78+
4679
} // namespace

0 commit comments

Comments
 (0)