[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 149/282: tests: Added a unit test for MD4 digest generation
From: |
gnunet |
Subject: |
[gnurl] 149/282: tests: Added a unit test for MD4 digest generation |
Date: |
Wed, 01 Apr 2020 14:30:14 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit fa009cc798f736e1751e62e47e4daee149cdc812
Author: Steve Holme <address@hidden>
AuthorDate: Sun Feb 23 04:21:49 2020 +0000
tests: Added a unit test for MD4 digest generation
Closes #4970
---
tests/data/Makefile.inc | 2 +-
tests/data/test1611 | 26 ++++++++++++++++++++++
tests/unit/Makefile.inc | 5 ++++-
tests/unit/unit1611.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 4cc040772..f543f3b3c 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -183,7 +183,7 @@ test1558 test1559 test1560 test1561 test1562 test1563
test1564 test1565 \
test1590 test1591 test1592 test1593 test1594 test1595 test1596 \
\
test1600 test1601 test1602 test1603 test1604 test1605 test1606 test1607 \
-test1608 test1609 test1610 \
+test1608 test1609 test1610 test1611 \
\
test1620 test1621 \
\
diff --git a/tests/data/test1611 b/tests/data/test1611
new file mode 100644
index 000000000..151d321f4
--- /dev/null
+++ b/tests/data/test1611
@@ -0,0 +1,26 @@
+<testcase>
+<info>
+<keywords>
+unittest
+MD4
+</keywords>
+</info>
+
+#
+# Client-side
+<client>
+<server>
+none
+</server>
+<features>
+unittest
+</features>
+ <name>
+MD4 unit tests
+ </name>
+<tool>
+unit1611
+</tool>
+</client>
+
+</testcase>
diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc
index b70d32004..b8da0c20c 100644
--- a/tests/unit/Makefile.inc
+++ b/tests/unit/Makefile.inc
@@ -32,7 +32,7 @@ UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304
unit1305 unit1307 \
unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \
unit1399 \
unit1600 unit1601 unit1602 unit1603 unit1604 unit1605 unit1606 unit1607 \
- unit1608 unit1609 unit1610 \
+ unit1608 unit1609 unit1610 unit1611 \
unit1620 unit1621 \
unit1650 unit1651 unit1652 unit1653 unit1654 unit1655
@@ -123,6 +123,9 @@ unit1609_CPPFLAGS = $(AM_CPPFLAGS)
unit1610_SOURCES = unit1610.c $(UNITFILES)
unit1610_CPPFLAGS = $(AM_CPPFLAGS)
+unit1611_SOURCES = unit1611.c $(UNITFILES)
+unit1611_CPPFLAGS = $(AM_CPPFLAGS)
+
unit1620_SOURCES = unit1620.c $(UNITFILES)
unit1620_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/unit/unit1611.c b/tests/unit/unit1611.c
new file mode 100644
index 000000000..bc19f8a5c
--- /dev/null
+++ b/tests/unit/unit1611.c
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "curlcheck.h"
+
+#include "curl_md4.h"
+
+static CURLcode unit_setup(void)
+{
+ return CURLE_OK;
+}
+
+static void unit_stop(void)
+{
+
+}
+
+UNITTEST_START
+
+#ifndef CURL_DISABLE_CRYPTO_AUTH
+ const char string1[] = "1";
+ const char string2[] = "hello-you-fool";
+ unsigned char output[MD4_DIGEST_LENGTH];
+ unsigned char *testp = output;
+
+ Curl_md4it(output, (const unsigned char *) string1, strlen(string1));
+
+ verify_memory(testp,
+ "\x8b\xe1\xec\x69\x7b\x14\xad\x3a\x53\xb3\x71\x43\x61\x20\x64"
+ "\x1d", MD4_DIGEST_LENGTH);
+
+ Curl_md4it(output, (const unsigned char *) string2, strlen(string2));
+
+ verify_memory(testp,
+ "\xa7\x16\x1c\xad\x7e\xbe\xdb\xbc\xf8\xc7\x23\x10\x2d\x2c\xe2"
+ "\x0b", MD4_DIGEST_LENGTH);
+#endif
+
+
+UNITTEST_STOP
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 140/282: http2: now require nghttp2 >= 1.12.0, (continued)
- [gnurl] 140/282: http2: now require nghttp2 >= 1.12.0, gnunet, 2020/04/01
- [gnurl] 123/282: socks: make the connect phase non-blocking, gnunet, 2020/04/01
- [gnurl] 145/282: md5/sha256: Updated the functions to allow non-string data to be hashed, gnunet, 2020/04/01
- [gnurl] 153/282: ftpserver: Updated VRFY_smtp() so the response isn't necessary in the test case, gnunet, 2020/04/01
- [gnurl] 148/282: md4: Use const for the length input parameter, gnunet, 2020/04/01
- [gnurl] 152/282: ftpserver: Corrected the e-mail address regex in MAIL_smtp() and RCTP_smtp(), gnunet, 2020/04/01
- [gnurl] 155/282: url: Make the IDN conversion functions available to others, gnunet, 2020/04/01
- [gnurl] 159/282: smtp: Detect server support for the UTF-8 extension as defined in RFC-6531, gnunet, 2020/04/01
- [gnurl] 158/282: smtp: Support UTF-8 based host names in the VRFY command, gnunet, 2020/04/01
- [gnurl] 151/282: hmac: Added a unit test for the HMAC hash generation, gnunet, 2020/04/01
- [gnurl] 149/282: tests: Added a unit test for MD4 digest generation,
gnunet <=
- [gnurl] 163/282: smtp: Support the SMTPUTF8 extension for the EXPN command, gnunet, 2020/04/01
- [gnurl] 162/282: smtp: Support the SMTPUTF8 extension in the VRFY command, gnunet, 2020/04/01
- [gnurl] 164/282: smtp: Tidy up, following recent changes, to maintain the coding style, gnunet, 2020/04/01
- [gnurl] 156/282: smtp: Support UTF-8 based host names in the MAIL command, gnunet, 2020/04/01
- [gnurl] 161/282: smtp: Support the SMTPUTF8 extension in the RCPT TO command, gnunet, 2020/04/01
- [gnurl] 157/282: smtp: Support UTF-8 based host names in the RCPT TO command, gnunet, 2020/04/01
- [gnurl] 165/282: http: added 417 response treatment, gnunet, 2020/04/01
- [gnurl] 166/282: cookie: remove unnecessary check for 'out != 0', gnunet, 2020/04/01
- [gnurl] 160/282: smtp: Support the SMTPUTF8 extension in the MAIL command, gnunet, 2020/04/01
- [gnurl] 172/282: Curl_is_ASCII_name: handle a NULL argument, gnunet, 2020/04/01