typedef's for RAND_DRBG methods
authorBenjamin Kaduk <bkaduk@akamai.com>
Wed, 19 Jul 2017 22:32:08 +0000 (17:32 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 20 Jul 2017 17:12:36 +0000 (12:12 -0500)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3971)

crypto/rand/rand_lcl.h
include/internal/rand.h

index 0c1aa72779f6c4afa41346b8ab83d39c5988fa49..de1f2cd4e6f796bb902e6ca5fd96b9c994041722 100644 (file)
@@ -71,16 +71,13 @@ struct drbg_ctx_st {
     DRBG_CTR_CTX ctr;
 
     /* entropy gathering function */
-    size_t (*get_entropy)(DRBG_CTX *ctx, unsigned char **pout,
-            int entropy, size_t min_len, size_t max_len);
+    RAND_DRBG_get_entropy_fn get_entropy;
     /* Indicates we have finished with entropy buffer */
-    void (*cleanup_entropy)(DRBG_CTX *ctx, unsigned char *out, size_t olen);
-
+    RAND_DRBG_cleanup_entropy_fn cleanup_entropy;
     /* nonce gathering function */
-    size_t (*get_nonce)(DRBG_CTX *ctx, unsigned char **pout,
-            int entropy, size_t min_len, size_t max_len);
+    RAND_DRBG_get_nonce_fn get_nonce;
     /* Indicates we have finished with nonce buffer */
-    void (*cleanup_nonce)(DRBG_CTX *ctx, unsigned char *out, size_t olen);
+    RAND_DRBG_cleanup_nonce_fn cleanup_nonce;
 };
 
 
index 0d386f6ee843d5c01ff16dcc86cd606146f6dcfb..07568ea8b81e42d01d51c8f3513faf405b573ff6 100644 (file)
@@ -26,14 +26,22 @@ int RAND_DRBG_generate(DRBG_CTX *dctx, unsigned char *out, size_t outlen,
                        const unsigned char *adin, size_t adinlen);
 void RAND_DRBG_free(DRBG_CTX *dctx);
 
+typedef size_t (*RAND_DRBG_get_entropy_fn)(DRBG_CTX *ctx, unsigned char **pout,
+                                           int entropy, size_t min_len,
+                                           size_t max_len);
+typedef void (*RAND_DRBG_cleanup_entropy_fn)(DRBG_CTX *ctx, unsigned char *out,
+                                             size_t olen);
+typedef size_t (*RAND_DRBG_get_nonce_fn)(DRBG_CTX *ctx, unsigned char **pout,
+                                         int entropy, size_t min_len,
+                                         size_t max_len);
+typedef void (*RAND_DRBG_cleanup_nonce_fn)(DRBG_CTX *ctx, unsigned char *out,
+                                           size_t olen);
+
 int RAND_DRBG_set_callbacks(DRBG_CTX *dctx,
-    size_t (*get_entropy)(DRBG_CTX *ctx, unsigned char **pout,
-                          int entropy, size_t min_len, size_t max_len),
-    void (*cleanup_entropy)(DRBG_CTX *ctx, unsigned char *out, size_t olen),
-    size_t (*get_nonce)(DRBG_CTX *ctx, unsigned char **pout,
-                        int entropy, size_t min_len, size_t max_len),
-    void (*cleanup_nonce)(DRBG_CTX *ctx, unsigned char *out, size_t olen)
-    );
+                            RAND_DRBG_get_entropy_fn get_entropy,
+                            RAND_DRBG_cleanup_entropy_fn cleanup_entropy,
+                            RAND_DRBG_get_nonce_fn get_nonce,
+                            RAND_DRBG_cleanup_nonce_fn cleanup_nonce);
 
 int RAND_DRBG_set_reseed_interval(DRBG_CTX *dctx, int interval);