summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2019-11-09 17:47:33 +0100
committerAndrew Bartlett <abartlet@samba.org>2019-12-10 00:30:29 +0000
commit07b4606f893fabd50c2685307d58e86f55defae5 (patch)
tree7e9927f6c4742843642b7bd7557ada4cec3ce805 /libcli
parent01f531ba6ba1306e99d2e4715dadae073eb0a8ec (diff)
downloadsamba-07b4606f893fabd50c2685307d58e86f55defae5.tar.gz
libcli/auth: test des_crypt56() and add test_gnutls to selftest
Signed-off-by: Isaac Boukris <iboukris@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/auth/tests/test_gnutls.c24
-rw-r--r--libcli/auth/wscript_build1
2 files changed, 25 insertions, 0 deletions
diff --git a/libcli/auth/tests/test_gnutls.c b/libcli/auth/tests/test_gnutls.c
index 412a454b762..7847d01a4dc 100644
--- a/libcli/auth/tests/test_gnutls.c
+++ b/libcli/auth/tests/test_gnutls.c
@@ -24,6 +24,7 @@
#include <cmocka.h>
#include "includes.h"
+#include "libcli/auth/libcli_auth.h"
#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
@@ -227,11 +228,34 @@ static void torture_gnutls_aes_128_cfb(void **state)
#endif
}
+static void torture_gnutls_des_crypt56(void **state)
+{
+ static const uint8_t key[7] = {
+ 0x69, 0x88, 0x96, 0x8E, 0xB5, 0x3A, 0x24
+ };
+ static const uint8_t clear[8] = {
+ 0x3F, 0x49, 0x5B, 0x20, 0xA7, 0x84, 0xC2, 0x34
+ };
+ static const uint8_t crypt_expected[8] = {
+ 0x54, 0x86, 0xCF, 0x51, 0x49, 0x3A, 0x53, 0x5B
+ };
+
+ uint8_t crypt[8];
+ uint8_t decrypt[8];
+
+ des_crypt56(crypt, clear, key, 1);
+ assert_memory_equal(crypt, crypt_expected, 8);
+
+ des_crypt56(decrypt, crypt, key, 0);
+ assert_memory_equal(decrypt, clear, 8);
+}
+
int main(int argc, char *argv[])
{
int rc;
const struct CMUnitTest tests[] = {
cmocka_unit_test(torture_gnutls_aes_128_cfb),
+ cmocka_unit_test(torture_gnutls_des_crypt56),
};
if (argc == 2) {
diff --git a/libcli/auth/wscript_build b/libcli/auth/wscript_build
index c99ea4464af..dc121950358 100644
--- a/libcli/auth/wscript_build
+++ b/libcli/auth/wscript_build
@@ -76,6 +76,7 @@ bld.SAMBA_BINARY('test_gnutls',
source='tests/test_gnutls.c',
deps='''
gnutls
+ LIBCLI_AUTH
cmocka
samba-util
''',