Reorganize private crypto header files
[openssl.git] / crypto / asn1 / i2d_param.c
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
10 #include <stdio.h>
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"
17
18 int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
19 {
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);
23     return -1;
24 }
25
26 int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey)
27 {
28     return ASN1_i2d_bio_of(EVP_PKEY, i2d_KeyParams, bp, pkey);
29 }
30