1275970Scy/* 2275970Scy * authusekey - decode a key from ascii and use it 3275970Scy */ 4275970Scy#include <config.h> 5275970Scy#include <stdio.h> 6275970Scy#include <ctype.h> 7275970Scy 8275970Scy#include "ntp_types.h" 9275970Scy#include "ntp_string.h" 10275970Scy#include "ntp_stdlib.h" 11275970Scy 12275970Scy/* 13275970Scy * Types of ascii representations for keys. "Standard" means a 64 bit 14275970Scy * hex number in NBS format, i.e. with the low order bit of each byte 15275970Scy * a parity bit. "NTP" means a 64 bit key in NTP format, with the 16275970Scy * high order bit of each byte a parity bit. "Ascii" means a 1-to-8 17275970Scy * character string whose ascii representation is used as the key. 18275970Scy */ 19275970Scyint 20275970Scyauthusekey( 21275970Scy keyid_t keyno, 22275970Scy int keytype, 23275970Scy const u_char *str 24275970Scy ) 25275970Scy{ 26275970Scy size_t len; 27275970Scy 28275970Scy len = strlen((const char *)str); 29275970Scy if (0 == len) 30275970Scy return 0; 31275970Scy 32275970Scy MD5auth_setkey(keyno, keytype, str, len, NULL); 33275970Scy return 1; 34275970Scy} 35275970Scy