X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/a93aacce200e0d68b614d8bfb05d9cbeba850b12..9a361a98e47bdade7bf107666441f41b4cb67dd9:/server/tripe.h?ds=sidebyside diff --git a/server/tripe.h b/server/tripe.h index 8cd66afa..4669711e 100644 --- a/server/tripe.h +++ b/server/tripe.h @@ -159,7 +159,7 @@ typedef struct keyset keyset; typedef struct algswitch algswitch; -typedef struct bulkcrypto { +typedef struct bulkops { const char *name; unsigned prim; int (*check)(const algswitch */*a*/, dstr */*e*/); @@ -167,21 +167,23 @@ typedef struct bulkcrypto { int (*encrypt)(keyset */*ks*/, unsigned /*ty*/, buf */*b*/, buf */*bb*/); int (*decrypt)(keyset */*ks*/, unsigned /*ty*/, buf */*b*/, buf */*bb*/, uint32 */*seq*/); -} bulkcrypto; +} bulkops; #define BCP_CIPHER 1 #define BCP_MAC 2 +#define BCP_BLKC 4 struct algswitch { const gchash *h; /* Hash function */ const gccipher *mgf; /* Mask-generation function */ - const struct bulkcrypto *bulk; /* Bulk crypto transformation */ + const bulkops *bulk; /* Bulk crypto transformation */ const gccipher *c; /* Symmetric encryption scheme */ const gcmac *m; /* Message authentication code */ + const gccipher *b; /* Block cipher */ size_t hashsz; /* Hash output size */ size_t tagsz; /* Length to truncate MAC tags */ size_t expsz; /* Size of data to process */ - size_t cksz, mksz; /* Key lengths for @c@ and @m@ */ + size_t cksz, mksz, bksz; /* Key lengths for things */ }; typedef struct kdata { @@ -208,7 +210,7 @@ typedef struct knode { #define HASH_STRING(h, s) GH_HASH((h), (s), sizeof(s)) -extern const struct bulkcrypto bulktab[]; +extern const bulkops bulktab[]; /*----- Data structures ---------------------------------------------------*/ @@ -264,11 +266,12 @@ struct keyset { unsigned long sz_exp, sz_regen; /* Data limits for the keyset */ T( unsigned seq; ) /* Sequence number for tracing */ unsigned f; /* Various useful flags */ - const bulkcrypto *bulk; /* Bulk crypto transform */ + const bulkops *bulk; /* Bulk crypto transform */ size_t tagsz; /* Length to truncate MAC tags */ struct ksdir { gcipher *c; /* Keyset cipher for encryption */ gmac *m; /* Keyset MAC for integrity */ + gcipher *b; /* Block cipher, just in case */ } in, out; uint32 oseq; /* Outbound sequence number */ seqwin iseq; /* Inbound sequence number */ @@ -573,7 +576,8 @@ extern unsigned tr_flags; /* Trace options flags */ /*----- Other macros ------------------------------------------------------*/ -#define TIMER noise_timer(RAND_GLOBAL) +#define QUICKRAND \ + do { rand_quick(RAND_GLOBAL); noise_timer(RAND_GLOBAL); } while (0) /*----- Key management ----------------------------------------------------*/ @@ -936,7 +940,7 @@ extern int c_check(buf */*b*/); * * Arguments: @dstr *d@ = where to leave the formatted message * @const char *fmt@ = pointer to format string - * @va_list ap@ = arguments in list + * @va_list *ap@ = arguments in list * * Returns: --- * @@ -961,7 +965,7 @@ extern int c_check(buf */*b*/); * * "[!]..." ... -- @dstr_putf@-like string as single token */ -extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list /*ap*/); +extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list */*ap*/); /* --- @a_format@ --- * * @@ -976,6 +980,19 @@ extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list /*ap*/); extern void EXECL_LIKE(0) a_format(dstr */*d*/, const char */*fmt*/, ...); +/* --- @a_info@ --- * + * + * Arguments: @admin *a@ = connection + * @const char *fmt@ = format string + * @...@ = other arguments + * + * Returns: --- + * + * Use: Report information to an admin client. + */ + +extern void EXECL_LIKE(0) a_info(admin */*a*/, const char */*fmt*/, ...); + /* --- @a_warn@ --- * * * Arguments: @const char *fmt@ = pointer to format string