]> git.ipfire.org Git - thirdparty/bird.git/blame - nest/password.h
Merge master into int-new
[thirdparty/bird.git] / nest / password.h
CommitLineData
1a2ded45
PM
1/*
2 * BIRD -- Password handling
3 *
5236fb03
OF
4 * (c) 1999 Pavel Machek <pavel@ucw.cz>
5 * (c) 2004 Ondrej Filip <feela@network.cz>
1a2ded45
PM
6 *
7 * Can be freely distributed and used under the terms of the GNU GPL.
8 */
9
858a7177
PM
10#ifndef PASSWORD_H
11#define PASSWORD_H
56cb3bed 12
7152e5ef 13#include "sysdep/unix/timer.h"
900d5470 14
1a2ded45 15struct password_item {
5236fb03 16 node n;
56cb3bed
PT
17 char *password; /* Key data, null terminated */
18 uint length; /* Key length, without null */
19 uint id; /* Key ID */
20 uint alg; /* MAC algorithm */
5236fb03 21 bird_clock_t accfrom, accto, genfrom, gento;
1a2ded45
PM
22};
23
24extern struct password_item *last_password_item;
900d5470 25
b21f68b4 26struct password_item *password_find(list *l, int first_fit);
de2a27e2 27struct password_item *password_find_by_id(list *l, uint id);
8465dccb 28struct password_item *password_find_by_value(list *l, char *pass, uint size);
f8fefde3
OZ
29
30static inline int password_verify(struct password_item *p1, char *p2, uint size)
31{
32 char buf[size];
33 strncpy(buf, p1->password, size);
34 return !memcmp(buf, p2, size);
35}
900d5470 36
390601f0
OZ
37uint max_mac_length(list *l);
38
858a7177 39#endif