From: Johannes Maximilian Kuehn Date: Fri, 5 Sep 2008 00:08:08 +0000 (+0000) Subject: kod_management.h, main.c, kod_management.c: X-Git-Tag: NTP_4_2_5P142~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bedade77b850ac43dcaedeef1aaa20d49c251920;p=thirdparty%2Fntp.git kod_management.h, main.c, kod_management.c: Fixes networking.h: fixes + broadcast mode crypto.h: BitKeeper file /pogo/users/kuehn/rsync_repo/ntp-dev/gsoc_sntp/crypto.h crypto.c: BitKeeper file /pogo/users/kuehn/rsync_repo/ntp-dev/gsoc_sntp/crypto.c networking.c: Fixes Broadcast mode sntp-opts.def: Added new options, removed host list bk: 48c07868HN5rhS7s4nhzvoR89eynGg --- diff --git a/gsoc_sntp/crypto.c b/gsoc_sntp/crypto.c new file mode 100644 index 000000000..9fba3de87 --- /dev/null +++ b/gsoc_sntp/crypto.c @@ -0,0 +1,97 @@ +#include "crypto.h" + +int key_cnt = 0; + +int +auth_md5 ( + void *pkt_data, + int mac_size, + char *cmp_key, + int cmp_size + ) +{ + register int a; + MD5Context ctx; + char digest[16]; + + MD5Init(&ctx); + unsigned char *digest_data = (unsigned char *) malloc(sizeof(char) * (LEN_PKT_NOMAC + cmp_size)); + + for(a=0; akey_id, act->type, act->key_seq); + +#ifdef DEBUG + printf("auth_init: key_id %i type %c with key %s\n", act->key_id, act->type, act->key_seq); +#endif + + if(line_cnt == 0) { + keys = act; + prev = act; + } + else { + prev->next = act; + prev = act; + } + + line_cnt++; + } + + fclose(keyf); + + key_cnt = line_cnt; + + return line_cnt; +} + + + + + + + } + + rewind(keyf); + + + diff --git a/gsoc_sntp/crypto.h b/gsoc_sntp/crypto.h new file mode 100644 index 000000000..126071893 --- /dev/null +++ b/gsoc_sntp/crypto.h @@ -0,0 +1,19 @@ +#ifndef CRYPTO_H +#define CRYPTO_H + +#include +#include + +/* #include "sntp-opts.h" */ + +int auth_md5(void *pkt_data, int mac_size, char *cmp_key, int cmp_size); +int auth_init(char *keyfile, struct key *keys); + +struct key { + unsigned int key_id; + char type; + char key_seq[16]; + struct key *next; +}; + +#endif