Update copyright year
[openssl.git] / crypto / dsa / dsa_depr.c
1 /*
2  * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 /*
11  * This file contains deprecated function(s) that are now wrappers to the new
12  * version(s).
13  */
14
15 /*
16  * DSA low level APIs are deprecated for public use, but still ok for
17  * internal use.
18  */
19 #include "internal/deprecated.h"
20
21 /*
22  * Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
23  * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in FIPS PUB
24  * 180-1)
25  */
26 #define xxxHASH    EVP_sha1()
27
28 #include <openssl/opensslconf.h>
29
30 #include <stdio.h>
31 #include <time.h>
32 #include "internal/cryptlib.h"
33 #include <openssl/evp.h>
34 #include <openssl/bn.h>
35 #include <openssl/dsa.h>
36 #include <openssl/sha.h>
37
38 DSA *DSA_generate_parameters(int bits,
39                              unsigned char *seed_in, int seed_len,
40                              int *counter_ret, unsigned long *h_ret,
41                              void (*callback) (int, int, void *),
42                              void *cb_arg)
43 {
44     BN_GENCB *cb;
45     DSA *ret;
46
47     if ((ret = DSA_new()) == NULL)
48         return NULL;
49     cb = BN_GENCB_new();
50     if (cb == NULL)
51         goto err;
52
53     BN_GENCB_set_old(cb, callback, cb_arg);
54
55     if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
56                                    counter_ret, h_ret, cb)) {
57         BN_GENCB_free(cb);
58         return ret;
59     }
60     BN_GENCB_free(cb);
61 err:
62     DSA_free(ret);
63     return NULL;
64 }