chiark / gitweb /
Use new Catacomb `rand_quick' to gather entropy from other fast sources.
[tripe] / server / tripe.h
index 8cd66aface1ad69bc84d5e96416ea3d6c2010b99..a967ae6d778b56d93d2c0f23c86ea62089d5107a 100644 (file)
@@ -171,6 +171,7 @@ typedef struct bulkcrypto {
 
 #define BCP_CIPHER 1
 #define BCP_MAC 2
+#define BCP_BLKC 4
 
 struct algswitch {
   const gchash *h;                     /* Hash function */
@@ -178,10 +179,11 @@ struct algswitch {
   const struct bulkcrypto *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 {
@@ -269,6 +271,7 @@ struct keyset {
   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@ --- *
  *