i2d_param.c 876 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright 2019 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/objects.h>
  13. #include <openssl/asn1.h>
  14. #include "crypto/asn1.h"
  15. #include "crypto/evp.h"
  16. int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
  17. {
  18. if (a->ameth != NULL && a->ameth->param_encode != NULL)
  19. return a->ameth->param_encode(a, pp);
  20. ASN1err(ASN1_F_I2D_KEYPARAMS, ASN1_R_UNSUPPORTED_TYPE);
  21. return -1;
  22. }
  23. int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey)
  24. {
  25. return ASN1_i2d_bio_of(EVP_PKEY, i2d_KeyParams, bp, pkey);
  26. }