xref: /netbsd-src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa_depr.c (revision b0d1725196a7921d003d2c66a14f186abda4176b)
1c7da899bSchristos /*
2*b0d17251Schristos  * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
3a89c9211Schristos  *
4*b0d17251Schristos  * Licensed under the Apache License 2.0 (the "License").  You may not use
5c7da899bSchristos  * this file except in compliance with the License.  You can obtain a copy
6c7da899bSchristos  * in the file LICENSE in the source distribution or at
7c7da899bSchristos  * https://www.openssl.org/source/license.html
8a89c9211Schristos  */
9a89c9211Schristos 
10635165faSspz /*
11635165faSspz  * This file contains deprecated function(s) that are now wrappers to the new
12635165faSspz  * version(s).
13635165faSspz  */
14a89c9211Schristos 
15635165faSspz /*
16*b0d17251Schristos  * DSA low level APIs are deprecated for public use, but still ok for
17*b0d17251Schristos  * internal use.
18635165faSspz  */
19*b0d17251Schristos #include "internal/deprecated.h"
20a89c9211Schristos 
21c7da899bSchristos #include <openssl/opensslconf.h>
22a89c9211Schristos 
23a89c9211Schristos #include <stdio.h>
24a89c9211Schristos #include <time.h>
25c7da899bSchristos #include "internal/cryptlib.h"
26a89c9211Schristos #include <openssl/evp.h>
27a89c9211Schristos #include <openssl/bn.h>
28a89c9211Schristos #include <openssl/dsa.h>
29a89c9211Schristos #include <openssl/sha.h>
30a89c9211Schristos 
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)31a89c9211Schristos DSA *DSA_generate_parameters(int bits,
32a89c9211Schristos                              unsigned char *seed_in, int seed_len,
33a89c9211Schristos                              int *counter_ret, unsigned long *h_ret,
34a89c9211Schristos                              void (*callback) (int, int, void *),
35a89c9211Schristos                              void *cb_arg)
36a89c9211Schristos {
37c7da899bSchristos     BN_GENCB *cb;
38a89c9211Schristos     DSA *ret;
39a89c9211Schristos 
40635165faSspz     if ((ret = DSA_new()) == NULL)
41635165faSspz         return NULL;
42c7da899bSchristos     cb = BN_GENCB_new();
43c7da899bSchristos     if (cb == NULL)
44c7da899bSchristos         goto err;
45a89c9211Schristos 
46c7da899bSchristos     BN_GENCB_set_old(cb, callback, cb_arg);
47a89c9211Schristos 
48a89c9211Schristos     if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
49c7da899bSchristos                                    counter_ret, h_ret, cb)) {
50c7da899bSchristos         BN_GENCB_free(cb);
51a89c9211Schristos         return ret;
52c7da899bSchristos     }
53c7da899bSchristos     BN_GENCB_free(cb);
54c7da899bSchristos err:
55a89c9211Schristos     DSA_free(ret);
56a89c9211Schristos     return NULL;
57a89c9211Schristos }
58