dh_prn.c 770 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright 1995-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. #include <stdio.h>
  10. #include "internal/cryptlib.h"
  11. #include <openssl/evp.h>
  12. #include <openssl/dh.h>
  13. #ifndef OPENSSL_NO_STDIO
  14. int DHparams_print_fp(FILE *fp, const DH *x)
  15. {
  16. BIO *b;
  17. int ret;
  18. if ((b = BIO_new(BIO_s_file())) == NULL) {
  19. DHerr(DH_F_DHPARAMS_PRINT_FP, ERR_R_BUF_LIB);
  20. return 0;
  21. }
  22. BIO_set_fp(b, fp, BIO_NOCLOSE);
  23. ret = DHparams_print(b, x);
  24. BIO_free(b);
  25. return ret;
  26. }
  27. #endif