authdecrypt.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* authdecrypt - routine to decrypt a packet to see if this guy knows our key.
*/
#include "ntp_stdlib.h"
/*
* For our purposes an NTP packet looks like:
*
* a variable amount of unencrypted data, multiple of 8 bytes, followed by:
* NOCRYPT_OCTETS worth of unencrypted data, followed by:
* BLOCK_OCTETS worth of ciphered checksum.
*/
#define NOCRYPT_OCTETS 4
#define BLOCK_OCTETS 8
/*
* Imported from the key data base module
*/
/*
* Stat counters, imported from data base module
*/
extern u_int32 authdecryptions;
extern u_int32 authkeyuncached;
int
int length; /* length of variable data in octets */
{
register int i;
register int longlen;
if (keyno == 0)
else {
if (keyno != cache_keyid) {
if (!authhavekey(keyno))
return 0;
}
}
/*
* Get encryption block data in host byte order and decrypt it.
*/
if (longlen & 0x1) {
}
for (i = longlen/2; i > 0; i--) {
}
/*
* Success if the encryption data is zero
*/
return 1;
return 0;
}