summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libntp/authkeys.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
committerroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
commit118e757284cbb8fc4f43a713e892b41504b50a5f (patch)
tree528d12dda44ebdc3ffcc38050f159ac553a69c17 /contrib/ntp/libntp/authkeys.c
parenta85d9ae25e8e8696677bc30feb6eaf7fc150e529 (diff)
downloadFreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.zip
FreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.tar.gz
Virgin import of ntpd 4.2.0
Diffstat (limited to 'contrib/ntp/libntp/authkeys.c')
-rw-r--r--contrib/ntp/libntp/authkeys.c77
1 files changed, 2 insertions, 75 deletions
diff --git a/contrib/ntp/libntp/authkeys.c b/contrib/ntp/libntp/authkeys.c
index f35d91c..1c95444 100644
--- a/contrib/ntp/libntp/authkeys.c
+++ b/contrib/ntp/libntp/authkeys.c
@@ -23,9 +23,6 @@ struct savekey {
struct savekey *next;
union {
long bogon; /* Make sure nonempty */
-#ifdef DES
- u_int32 DES_key[2]; /* DES key */
-#endif
u_char MD5_key[32]; /* MD5 key */
} k;
keyid_t keyid; /* key identifier */
@@ -35,7 +32,6 @@ struct savekey {
};
#define KEY_TRUSTED 0x001 /* this key is trusted */
-#define KEY_DES 0x100 /* this is a DES type key */
#define KEY_MD5 0x200 /* this is a MD5 type key */
/*
@@ -168,12 +164,6 @@ authhavekey(
cache_keylen = sk->keylen;
return (1);
}
-#ifdef DES
- if (sk->flags & KEY_DES) {
- cache_key = (u_char *)sk->k.DES_key;
- return (1);
- }
-#endif
return (0);
}
@@ -308,60 +298,6 @@ authistrusted(
}
-
-#ifdef DES
-/*
- * DESauth_setkey - set a key into the key array
- */
-void
-DESauth_setkey(
- keyid_t keyno,
- const u_int32 *key
- )
-{
- struct savekey *sk;
-
- /*
- * See if we already have the key. If so just stick in the
- * new value.
- */
- sk = key_hash[KEYHASH(keyno)];
- while (sk != 0) {
- if (keyno == sk->keyid) {
- sk->k.DES_key[0] = key[0];
- sk->k.DES_key[1] = key[1];
- sk->flags |= KEY_DES;
- if (cache_keyid == keyno)
- cache_flags = 0;
- cache_keyid = 0;
- return;
- }
- sk = sk->next;
- }
-
- /*
- * Need to allocate new structure. Do it.
- */
- if (authnumfreekeys == 0) {
- if (auth_moremem() == 0)
- return;
- }
- sk = authfreekeys;
- authfreekeys = sk->next;
- authnumfreekeys--;
-
- sk->k.DES_key[0] = key[0];
- sk->k.DES_key[1] = key[1];
- sk->keyid = keyno;
- sk->flags = KEY_DES;
- sk->lifetime = 0;
- sk->next = key_hash[KEYHASH(keyno)];
- key_hash[KEYHASH(keyno)] = sk;
- authnumkeys++;
- return;
-}
-#endif
-
void
MD5auth_setkey(
keyid_t keyno,
@@ -438,9 +374,10 @@ auth_delkeys(void)
*/
while (sk != 0 && sk->keyid <= NTP_MAXKEY) {
/*
- * Don't loose info which keys are trusted.
+ * Don't lose info as to which keys are trusted.
*/
if (sk->flags & KEY_TRUSTED) {
+ skp = &(sk->next);
memset(&sk->k, 0, sizeof(sk->k));
sk->lifetime = 0;
sk->keylen = 0;
@@ -512,11 +449,6 @@ authencrypt(
if (!authhavekey(keyno))
return (0);
-#ifdef DES
- if (cache_flags & KEY_DES)
- return (DESauthencrypt(cache_key, pkt, length));
-#endif
-
if (cache_flags & KEY_MD5)
return (MD5authencrypt(cache_key, pkt, length));
@@ -549,11 +481,6 @@ authdecrypt(
if (!authhavekey(keyno) || size < 4)
return (0);
-#ifdef DES
- if (cache_flags & KEY_DES)
- return (DESauthdecrypt(cache_key, pkt, length, size));
-#endif
-
if (cache_flags & KEY_MD5)
return (MD5authdecrypt(cache_key, pkt, length, size));
OpenPOWER on IntegriCloud