dsa_depr.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. * This file contains deprecated function(s) that are now wrappers to the new
  11. * version(s).
  12. */
  13. /*
  14. * DSA low level APIs are deprecated for public use, but still ok for
  15. * internal use.
  16. */
  17. #include "internal/deprecated.h"
  18. #include <openssl/opensslconf.h>
  19. #include <stdio.h>
  20. #include <time.h>
  21. #include "internal/cryptlib.h"
  22. #include <openssl/evp.h>
  23. #include <openssl/bn.h>
  24. #include <openssl/dsa.h>
  25. #include <openssl/sha.h>
  26. DSA *DSA_generate_parameters(int bits,
  27. unsigned char *seed_in, int seed_len,
  28. int *counter_ret, unsigned long *h_ret,
  29. void (*callback) (int, int, void *),
  30. void *cb_arg)
  31. {
  32. BN_GENCB *cb;
  33. DSA *ret;
  34. if ((ret = DSA_new()) == NULL)
  35. return NULL;
  36. cb = BN_GENCB_new();
  37. if (cb == NULL)
  38. goto err;
  39. BN_GENCB_set_old(cb, callback, cb_arg);
  40. if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
  41. counter_ret, h_ret, cb)) {
  42. BN_GENCB_free(cb);
  43. return ret;
  44. }
  45. BN_GENCB_free(cb);
  46. err:
  47. DSA_free(ret);
  48. return NULL;
  49. }