random: Remove DRBG constants from the public API.
authorWerner Koch <wk@gnupg.org>
Thu, 18 Feb 2016 14:31:36 +0000 (15:31 +0100)
committerWerner Koch <wk@gnupg.org>
Thu, 18 Feb 2016 14:31:36 +0000 (15:31 +0100)
* src/gcrypt.h.in (GCRY_DRBG_): Remove all new flags to ...
* random/drbg.c: here.

Signed-off-by: Werner Koch <wk@gnupg.org>
random/drbg.c
src/gcrypt.h.in

index 752eb65..871e4e5 100644 (file)
 #include "rand-internal.h"
 #include "../cipher/bithelp.h"
 
+
+\f
+/******************************************************************
+ * Constants
+ ******************************************************************/
+
+/*
+ * DRBG flags bitmasks
+ *
+ * 31 (B) 28      19         (A)         0
+ *  +-+-+-+--------+---+-----------+-----+
+ *  |~|~|u|~~~~~~~~| 3 |     2     |  1  |
+ *  +-+-+-+--------+- -+-----------+-----+
+ * ctl flg|        |drbg use selection flags
+ *
+ */
+
+/* Internal state control flags (B) */
+#define GCRY_DRBG_PREDICTION_RESIST    ((u_int32_t)1<<28)
+
+/* CTR type modifiers (A.1)*/
+#define GCRY_DRBG_CTRAES               ((u_int32_t)1<<0)
+#define GCRY_DRBG_CTRSERPENT           ((u_int32_t)1<<1)
+#define GCRY_DRBG_CTRTWOFISH           ((u_int32_t)1<<2)
+#define GCRY_DRBG_CTR_MASK     (GCRY_DRBG_CTRAES | GCRY_DRBG_CTRSERPENT | GCRY_DRBG_CTRTWOFISH)
+
+/* HASH type modifiers (A.2)*/
+#define GCRY_DRBG_HASHSHA1             ((u_int32_t)1<<4)
+#define GCRY_DRBG_HASHSHA224           ((u_int32_t)1<<5)
+#define GCRY_DRBG_HASHSHA256           ((u_int32_t)1<<6)
+#define GCRY_DRBG_HASHSHA384           ((u_int32_t)1<<7)
+#define GCRY_DRBG_HASHSHA512           ((u_int32_t)1<<8)
+#define GCRY_DRBG_HASH_MASK            (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HASHSHA224 | \
+                                GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HASHSHA384 | \
+                                GCRY_DRBG_HASHSHA512)
+/* type modifiers (A.3)*/
+#define GCRY_DRBG_HMAC         ((u_int32_t)1<<12)
+#define GCRY_DRBG_SYM128               ((u_int32_t)1<<13)
+#define GCRY_DRBG_SYM192               ((u_int32_t)1<<14)
+#define GCRY_DRBG_SYM256               ((u_int32_t)1<<15)
+#define GCRY_DRBG_TYPE_MASK            (GCRY_DRBG_HMAC | GCRY_DRBG_SYM128 | GCRY_DRBG_SYM192 | \
+                                GCRY_DRBG_SYM256)
+#define GCRY_DRBG_CIPHER_MASK (GCRY_DRBG_CTR_MASK | GCRY_DRBG_HASH_MASK | GCRY_DRBG_TYPE_MASK)
+
+#define GCRY_DRBG_PR_CTRAES128   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128)
+#define GCRY_DRBG_PR_CTRAES192   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192)
+#define GCRY_DRBG_PR_CTRAES256   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256)
+#define GCRY_DRBG_NOPR_CTRAES128 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128)
+#define GCRY_DRBG_NOPR_CTRAES192 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192)
+#define GCRY_DRBG_NOPR_CTRAES256 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256)
+#define GCRY_DRBG_PR_HASHSHA1    (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1)
+#define GCRY_DRBG_PR_HASHSHA256  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256)
+#define GCRY_DRBG_PR_HASHSHA384  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384)
+#define GCRY_DRBG_PR_HASHSHA512  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512)
+#define GCRY_DRBG_NOPR_HASHSHA1  (GCRY_DRBG_HASHSHA1)
+#define GCRY_DRBG_NOPR_HASHSHA256 (GCRY_DRBG_HASHSHA256)
+#define GCRY_DRBG_NOPR_HASHSHA384 (GCRY_DRBG_HASHSHA384)
+#define GCRY_DRBG_NOPR_HASHSHA512 (GCRY_DRBG_HASHSHA512)
+#define GCRY_DRBG_PR_HMACSHA1    (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_PR_HMACSHA256  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_PR_HMACSHA384  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_PR_HMACSHA512  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_NOPR_HMACSHA1  (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_NOPR_HMACSHA256 (GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_NOPR_HMACSHA384 (GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC)
+#define GCRY_DRBG_NOPR_HMACSHA512 (GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC)
+
+
+\f
 /******************************************************************
  * Common data structures
  ******************************************************************/
index f1f1391..23b0969 100644 (file)
@@ -1770,66 +1770,6 @@ static inline void gcry_randomize_drbg(void *outbuf, size_t outlen,
   gcry_randomize(&genbuf, 0, level);
 }
 
-/*
- * DRBG flags bitmasks
- *
- * 31 (B) 28      19         (A)         0
- *  +-+-+-+--------+---+-----------+-----+
- *  |~|~|u|~~~~~~~~| 3 |     2     |  1  |
- *  +-+-+-+--------+- -+-----------+-----+
- * ctl flg|        |drbg use selection flags
- *
- */
-
-/* internal state control flags (B) */
-#define GCRY_DRBG_PREDICTION_RESIST    ((u_int32_t)1<<28)
-
-/* CTR type modifiers (A.1)*/
-#define GCRY_DRBG_CTRAES               ((u_int32_t)1<<0)
-#define GCRY_DRBG_CTRSERPENT           ((u_int32_t)1<<1)
-#define GCRY_DRBG_CTRTWOFISH           ((u_int32_t)1<<2)
-#define GCRY_DRBG_CTR_MASK     (GCRY_DRBG_CTRAES | GCRY_DRBG_CTRSERPENT | GCRY_DRBG_CTRTWOFISH)
-
-/* HASH type modifiers (A.2)*/
-#define GCRY_DRBG_HASHSHA1             ((u_int32_t)1<<4)
-#define GCRY_DRBG_HASHSHA224           ((u_int32_t)1<<5)
-#define GCRY_DRBG_HASHSHA256           ((u_int32_t)1<<6)
-#define GCRY_DRBG_HASHSHA384           ((u_int32_t)1<<7)
-#define GCRY_DRBG_HASHSHA512           ((u_int32_t)1<<8)
-#define GCRY_DRBG_HASH_MASK            (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HASHSHA224 | \
-                                GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HASHSHA384 | \
-                                GCRY_DRBG_HASHSHA512)
-/* type modifiers (A.3)*/
-#define GCRY_DRBG_HMAC         ((u_int32_t)1<<12)
-#define GCRY_DRBG_SYM128               ((u_int32_t)1<<13)
-#define GCRY_DRBG_SYM192               ((u_int32_t)1<<14)
-#define GCRY_DRBG_SYM256               ((u_int32_t)1<<15)
-#define GCRY_DRBG_TYPE_MASK            (GCRY_DRBG_HMAC | GCRY_DRBG_SYM128 | GCRY_DRBG_SYM192 | \
-                                GCRY_DRBG_SYM256)
-#define GCRY_DRBG_CIPHER_MASK (GCRY_DRBG_CTR_MASK | GCRY_DRBG_HASH_MASK | GCRY_DRBG_TYPE_MASK)
-
-#define GCRY_DRBG_PR_CTRAES128   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128)
-#define GCRY_DRBG_PR_CTRAES192   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192)
-#define GCRY_DRBG_PR_CTRAES256   (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256)
-#define GCRY_DRBG_NOPR_CTRAES128 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128)
-#define GCRY_DRBG_NOPR_CTRAES192 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192)
-#define GCRY_DRBG_NOPR_CTRAES256 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256)
-#define GCRY_DRBG_PR_HASHSHA1    (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1)
-#define GCRY_DRBG_PR_HASHSHA256  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256)
-#define GCRY_DRBG_PR_HASHSHA384  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384)
-#define GCRY_DRBG_PR_HASHSHA512  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512)
-#define GCRY_DRBG_NOPR_HASHSHA1  (GCRY_DRBG_HASHSHA1)
-#define GCRY_DRBG_NOPR_HASHSHA256 (GCRY_DRBG_HASHSHA256)
-#define GCRY_DRBG_NOPR_HASHSHA384 (GCRY_DRBG_HASHSHA384)
-#define GCRY_DRBG_NOPR_HASHSHA512 (GCRY_DRBG_HASHSHA512)
-#define GCRY_DRBG_PR_HMACSHA1    (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_PR_HMACSHA256  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_PR_HMACSHA384  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_PR_HMACSHA512  (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_NOPR_HMACSHA1  (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_NOPR_HMACSHA256 (GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_NOPR_HMACSHA384 (GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC)
-#define GCRY_DRBG_NOPR_HMACSHA512 (GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC)
 
 #if 0 /* (Keep Emacsens' auto-indent happy.) */
 {