X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=util.h;h=1f43c5ea5caf34dbcf9a7da2e11cab8d5464b8f6;hp=7991743be32ab70196c41015934123fd044227ce;hb=0391d9ee80a1847381ad205b8f707e43707b90b0;hpb=28db900b071a43718c4227e759fa76cb8c6359af diff --git a/util.h b/util.h index 7991743..1f43c5e 100644 --- a/util.h +++ b/util.h @@ -45,4 +45,18 @@ extern int32_t write_mpbin(MP_INT *a, uint8_t *buffer, int32_t buflen); extern struct log_if *init_log(list_t *loglist); +extern void send_nak(const struct comm_addr *dest, uint32_t our_index, + uint32_t their_index, uint32_t msgtype, + struct buffer_if *buf, const char *logwhy); + +extern int consttime_memeq(const void *s1, const void *s2, size_t n); + +#define MINMAX(ae,be,op) ({ \ + typeof((ae)) a=(ae); \ + typeof((be)) b=(be); \ + a op b ? a : b; \ + }) +#define MAX(a,b) MINMAX((a),(b),>) +#define MIN(a,b) MINMAX((a),(b),<) + #endif /* util_h */