summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-02-18 17:51:34 +0100
committerWerner Koch <wk@gnupg.org>2016-02-19 14:35:29 +0100
commitdfac2b13d0068b2b1b420d77e9771a49964b81c1 (patch)
tree8e21474b236fc9219450aefb643d6d9116787b1a /src/global.c
parent4e134b6e77f558730ec1eceb6b816b0bcfd845e9 (diff)
downloadlibgcrypt-dfac2b13d0068b2b1b420d77e9771a49964b81c1.tar.gz
random: Remove the new API introduced by the new DRBG.
* src/gcrypt.h.in (struct gcry_drbg_gen): Move to random/drbg.c. (struct gcry_drbg_string): Ditto. (gcry_drbg_string_fill): Ditto. (gcry_randomize_drbg): Remove. * random/drbg.c (parse_flag_string): New. (_gcry_drbg_reinit): Change the way the arguments are passed. * src/global.c (_gcry_vcontrol) <GCRYCTL_DRBG_REINIT>: Change calling convention. -- It does not make sense to extend the API for a somewhat questionable feature. For GCRYCTL_DRBG_REINIT we change to use a string with flags and libgcrypt's native buffer data structure. NB: GCRYCTL_DRBG_REINIT has not been tested! Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/global.c b/src/global.c
index e14d8c44..ffba3254 100644
--- a/src/global.c
+++ b/src/global.c
@@ -657,10 +657,13 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
case GCRYCTL_DRBG_REINIT:
{
- u32 flags = va_arg (arg_ptr, u32);
- struct gcry_drbg_string *pers = va_arg (arg_ptr,
- struct gcry_drbg_string *);
- rc = _gcry_drbg_reinit(flags, pers);
+ const char *flagstr = va_arg (arg_ptr, const char *);
+ gcry_buffer_t *pers = va_arg (arg_ptr, gcry_buffer_t *);
+ int npers = va_arg (arg_ptr, int);
+ if (va_arg (arg_ptr, void *) || npers < 0)
+ rc = GPG_ERR_INV_ARG;
+ else
+ rc = _gcry_drbg_reinit (flagstr, pers, npers);
}
break;