dsa_depr.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * 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. /*
  19. * Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
  20. * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in FIPS PUB
  21. * 180-1)
  22. */
  23. #define xxxHASH EVP_sha1()
  24. #include <openssl/opensslconf.h>
  25. #include <stdio.h>
  26. #include <time.h>
  27. #include "internal/cryptlib.h"
  28. #include <openssl/evp.h>
  29. #include <openssl/bn.h>
  30. #include <openssl/dsa.h>
  31. #include <openssl/sha.h>
  32. DSA *DSA_generate_parameters(int bits,
  33. unsigned char *seed_in, int seed_len,
  34. int *counter_ret, unsigned long *h_ret,
  35. void (*callback) (int, int, void *),
  36. void *cb_arg)
  37. {
  38. BN_GENCB *cb;
  39. DSA *ret;
  40. if ((ret = DSA_new()) == NULL)
  41. return NULL;
  42. cb = BN_GENCB_new();
  43. if (cb == NULL)
  44. goto err;
  45. BN_GENCB_set_old(cb, callback, cb_arg);
  46. if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
  47. counter_ret, h_ret, cb)) {
  48. BN_GENCB_free(cb);
  49. return ret;
  50. }
  51. BN_GENCB_free(cb);
  52. err:
  53. DSA_free(ret);
  54. return NULL;
  55. }