From dacabd4965bf83f2de3bb1982402b5fbedbd709b Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 13 Apr 2023 14:58:27 +0000 Subject: [PATCH] Move DSA_generate_parameters() from dsa_depr.c to dsa_gen.c Discussed with jsing --- lib/libcrypto/dsa/dsa_depr.c | 21 +-------------------- lib/libcrypto/dsa/dsa_gen.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/lib/libcrypto/dsa/dsa_depr.c b/lib/libcrypto/dsa/dsa_depr.c index b3f7ec04133..98a377e5b55 100644 --- a/lib/libcrypto/dsa/dsa_depr.c +++ b/lib/libcrypto/dsa/dsa_depr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_depr.c,v 1.11 2023/04/09 19:10:23 tb Exp $ */ +/* $OpenBSD: dsa_depr.c,v 1.12 2023/04/13 14:58:27 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -70,23 +70,4 @@ #include "bn_local.h" -DSA * -DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len, - int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *), - void *cb_arg) -{ - BN_GENCB cb; - DSA *ret; - - if ((ret = DSA_new()) == NULL) - return NULL; - - BN_GENCB_set_old(&cb, callback, cb_arg); - - if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len, - counter_ret, h_ret, &cb)) - return ret; - DSA_free(ret); - return NULL; -} #endif diff --git a/lib/libcrypto/dsa/dsa_gen.c b/lib/libcrypto/dsa/dsa_gen.c index 49b45614946..4a16278b5ab 100644 --- a/lib/libcrypto/dsa/dsa_gen.c +++ b/lib/libcrypto/dsa/dsa_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_gen.c,v 1.28 2023/03/27 10:25:02 tb Exp $ */ +/* $OpenBSD: dsa_gen.c,v 1.29 2023/04/13 14:58:27 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -355,4 +355,25 @@ err: return ok; } + +DSA * +DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len, + int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *), + void *cb_arg) +{ + BN_GENCB cb; + DSA *ret; + + if ((ret = DSA_new()) == NULL) + return NULL; + + BN_GENCB_set_old(&cb, callback, cb_arg); + + if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len, + counter_ret, h_ret, &cb)) + return ret; + DSA_free(ret); + return NULL; +} + #endif -- 2.20.1