dh_prn.c 897 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright 1995-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. * DH low level APIs are deprecated for public use, but still ok for
  11. * internal use.
  12. */
  13. #include "internal/deprecated.h"
  14. #include <stdio.h>
  15. #include "internal/cryptlib.h"
  16. #include <openssl/evp.h>
  17. #include <openssl/dh.h>
  18. #ifndef OPENSSL_NO_STDIO
  19. int DHparams_print_fp(FILE *fp, const DH *x)
  20. {
  21. BIO *b;
  22. int ret;
  23. if ((b = BIO_new(BIO_s_file())) == NULL) {
  24. DHerr(DH_F_DHPARAMS_PRINT_FP, ERR_R_BUF_LIB);
  25. return 0;
  26. }
  27. BIO_set_fp(b, fp, BIO_NOCLOSE);
  28. ret = DHparams_print(b, x);
  29. BIO_free(b);
  30. return ret;
  31. }
  32. #endif