From: Ian Jackson Date: Tue, 8 Oct 2019 14:51:41 +0000 (+0100) Subject: sigkey handling: Introduce serialt type X-Git-Tag: v0.6.0~214 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=b1093560385ebca41d6db73b1aae67bb34836f98;hp=23faf651e513eacaed168ac5093f6018e7008666;p=secnet.git sigkey handling: Introduce serialt type Signed-off-by: Ian Jackson --- diff --git a/secnet.h b/secnet.h index f7bb3e5..24894f2 100644 --- a/secnet.h +++ b/secnet.h @@ -87,6 +87,15 @@ static inline bool_t sigkeyid_equal(const struct sigkeyid *a, return !memcmp(a->b, b->b, KEYIDSZ); } +#define SERIALSZ 4 +typedef uint32_t serialt; +static inline int serial_cmp(serialt a, serialt b) { + if (a==b) return 0; + if (!a) return -1; + if (!b) return +1; + return b-a <= (serialt)0x7fffffffUL ? +1 : -1; +} + #define ASSERT(x) do { if (!(x)) { fatal("assertion failed line %d file " \ __FILE__,__LINE__); } } while(0)