1 /* 2 * Copyright 2002-2021 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 #include <openssl/opensslconf.h> 22 23 #include <stdio.h> 24 #include <time.h> 25 #include "internal/cryptlib.h" 26 #include <openssl/evp.h> 27 #include <openssl/bn.h> 28 #include <openssl/dsa.h> 29 #include <openssl/sha.h> 30 31 DSA *DSA_generate_parameters(int bits, 32 unsigned char *seed_in, int seed_len, 33 int *counter_ret, unsigned long *h_ret, 34 void (*callback) (int, int, void *), 35 void *cb_arg) 36 { 37 BN_GENCB *cb; 38 DSA *ret; 39 40 if ((ret = DSA_new()) == NULL) 41 return NULL; 42 cb = BN_GENCB_new(); 43 if (cb == NULL) 44 goto err; 45 46 BN_GENCB_set_old(cb, callback, cb_arg); 47 48 if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len, 49 counter_ret, h_ret, cb)) { 50 BN_GENCB_free(cb); 51 return ret; 52 } 53 BN_GENCB_free(cb); 54 err: 55 DSA_free(ret); 56 return NULL; 57 } 58