summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/tests/libntp/g_authkeys.cpp
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-10-26 11:35:40 +0000
committerglebius <glebius@FreeBSD.org>2015-10-26 11:35:40 +0000
commitc62812877398840dae0ba74b03e9e6a43cc56fc5 (patch)
tree304551aa93f09787d4f56a966c6409faf1b1bcb0 /contrib/ntp/tests/libntp/g_authkeys.cpp
parent9e809ce638c9be9ffb800ced1b91c0e8997f4c9e (diff)
downloadFreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.zip
FreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.tar.gz
Upgrade NTP to 4.2.8p4.
Security: FreeBSD-SA-15:25.ntp Security: CVE-2015-7871 Security: CVE-2015-7855 Security: CVE-2015-7854 Security: CVE-2015-7853 Security: CVE-2015-7852 Security: CVE-2015-7851 Security: CVE-2015-7850 Security: CVE-2015-7849 Security: CVE-2015-7848 Security: CVE-2015-7701 Security: CVE-2015-7703 Security: CVE-2015-7704, CVE-2015-7705 Security: CVE-2015-7691, CVE-2015-7692, CVE-2015-7702
Diffstat (limited to 'contrib/ntp/tests/libntp/g_authkeys.cpp')
-rw-r--r--contrib/ntp/tests/libntp/g_authkeys.cpp100
1 files changed, 0 insertions, 100 deletions
diff --git a/contrib/ntp/tests/libntp/g_authkeys.cpp b/contrib/ntp/tests/libntp/g_authkeys.cpp
deleted file mode 100644
index 773112e..0000000
--- a/contrib/ntp/tests/libntp/g_authkeys.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* This file contains test for both libntp/authkeys.c and libntp/authusekey.c */
-
-#include "g_libntptest.h"
-
-extern "C" {
-#ifdef OPENSSL
-# include "openssl/err.h"
-# include "openssl/rand.h"
-# include "openssl/evp.h"
-#endif
-#include "ntp.h"
-#include "ntp_stdlib.h"
-};
-
-class authkeysTest : public libntptest {
-protected:
- static const int KEYTYPE = KEY_TYPE_MD5;
-
- virtual void SetUp() {
- /*
- * init_auth() is called by tests_main.cpp earlier. It
- * does not initialize global variables like
- * authnumkeys, so let's reset them to zero here.
- */
- authnumkeys = 0;
-
- /*
- * Especially, empty the key cache!
- */
- cache_keyid = 0;
- cache_type = 0;
- cache_flags = 0;
- cache_secret = NULL;
- cache_secretsize = 0;
- }
-
- void AddTrustedKey(keyid_t keyno) {
- /*
- * We need to add a MD5-key in addition to setting the
- * trust, because authhavekey() requires type != 0.
- */
- MD5auth_setkey(keyno, KEYTYPE, NULL, 0);
-
- authtrust(keyno, TRUE);
- }
-
- void AddUntrustedKey(keyid_t keyno) {
- authtrust(keyno, FALSE);
- }
-};
-
-TEST_F(authkeysTest, AddTrustedKeys) {
- const keyid_t KEYNO1 = 5;
- const keyid_t KEYNO2 = 8;
-
- AddTrustedKey(KEYNO1);
- AddTrustedKey(KEYNO2);
-
- EXPECT_TRUE(authistrusted(KEYNO1));
- EXPECT_TRUE(authistrusted(KEYNO2));
-}
-
-TEST_F(authkeysTest, AddUntrustedKey) {
- const keyid_t KEYNO = 3;
-
- AddUntrustedKey(KEYNO);
-
- EXPECT_FALSE(authistrusted(KEYNO));
-}
-
-TEST_F(authkeysTest, HaveKeyCorrect) {
- const keyid_t KEYNO = 3;
-
- AddTrustedKey(KEYNO);
-
- EXPECT_TRUE(auth_havekey(KEYNO));
- EXPECT_TRUE(authhavekey(KEYNO));
-}
-
-TEST_F(authkeysTest, HaveKeyIncorrect) {
- const keyid_t KEYNO = 2;
-
- EXPECT_FALSE(auth_havekey(KEYNO));
- EXPECT_FALSE(authhavekey(KEYNO));
-}
-
-TEST_F(authkeysTest, AddWithAuthUseKey) {
- const keyid_t KEYNO = 5;
- const char* KEY = "52a";
-
- EXPECT_TRUE(authusekey(KEYNO, KEYTYPE, (u_char*)KEY));
-}
-
-TEST_F(authkeysTest, EmptyKey) {
- const keyid_t KEYNO = 3;
- const char* KEY = "";
-
-
- EXPECT_FALSE(authusekey(KEYNO, KEYTYPE, (u_char*)KEY));
-}
OpenPOWER on IntegriCloud