From dfac2b13d0068b2b1b420d77e9771a49964b81c1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 18 Feb 2016 17:51:34 +0100 Subject: 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) : 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 --- src/global.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/global.c') 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; -- cgit v1.2.1