File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / authusekey.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 5 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: /*
    2:  * authusekey - decode a key from ascii and use it
    3:  */
    4: #include <stdio.h>
    5: #include <ctype.h>
    6: 
    7: #include "ntp_types.h"
    8: #include "ntp_string.h"
    9: #include "ntp_stdlib.h"
   10: 
   11: /*
   12:  * Types of ascii representations for keys.  "Standard" means a 64 bit
   13:  * hex number in NBS format, i.e. with the low order bit of each byte
   14:  * a parity bit.  "NTP" means a 64 bit key in NTP format, with the
   15:  * high order bit of each byte a parity bit.  "Ascii" means a 1-to-8
   16:  * character string whose ascii representation is used as the key.
   17:  */
   18: int
   19: authusekey(
   20: 	keyid_t keyno,
   21: 	int keytype,
   22: 	const u_char *str
   23: 	)
   24: {
   25: 	const u_char *cp;
   26: 	int len;
   27: 
   28: 	cp = str;
   29: 	len = strlen((const char *)cp);
   30: 	if (len == 0)
   31: 		return 0;
   32: 
   33: 	MD5auth_setkey(keyno, keytype, str, (int)strlen((const char *)str));
   34: 	return 1;
   35: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>