dsa_depr.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2002-2016 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. * Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
  15. * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in FIPS PUB
  16. * 180-1)
  17. */
  18. #define xxxHASH EVP_sha1()
  19. #include <openssl/opensslconf.h>
  20. #if OPENSSL_API_0_9_8
  21. NON_EMPTY_TRANSLATION_UNIT
  22. #else
  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. DSA *DSA_generate_parameters(int bits,
  31. unsigned char *seed_in, int seed_len,
  32. int *counter_ret, unsigned long *h_ret,
  33. void (*callback) (int, int, void *),
  34. void *cb_arg)
  35. {
  36. BN_GENCB *cb;
  37. DSA *ret;
  38. if ((ret = DSA_new()) == NULL)
  39. return NULL;
  40. cb = BN_GENCB_new();
  41. if (cb == NULL)
  42. goto err;
  43. BN_GENCB_set_old(cb, callback, cb_arg);
  44. if (DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
  45. counter_ret, h_ret, cb)) {
  46. BN_GENCB_free(cb);
  47. return ret;
  48. }
  49. BN_GENCB_free(cb);
  50. err:
  51. DSA_free(ret);
  52. return NULL;
  53. }
  54. #endif