2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
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
11 #include "internal/cryptlib.h"
12 #include <openssl/evp.h>
13 #include <openssl/objects.h>
14 #include <openssl/asn1.h>
15 #include "crypto/asn1.h"
16 #include "crypto/evp.h"
18 int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
20 if (a->ameth != NULL && a->ameth->param_encode != NULL)
21 return a->ameth->param_encode(a, pp);
22 ASN1err(ASN1_F_I2D_KEYPARAMS, ASN1_R_UNSUPPORTED_TYPE);
26 int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey)
28 return ASN1_i2d_bio_of(EVP_PKEY, i2d_KeyParams, bp, pkey);