Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:18:33

0001 /*
0002  * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_ENCODER_H
0011 #define OPENSSL_ENCODER_H
0012 #pragma once
0013 
0014 #include <openssl/opensslconf.h>
0015 
0016 #ifndef OPENSSL_NO_STDIO
0017 #include <stdio.h>
0018 #endif
0019 #include <stdarg.h>
0020 #include <stddef.h>
0021 #include <openssl/encodererr.h>
0022 #include <openssl/types.h>
0023 #include <openssl/core.h>
0024 
0025 #ifdef __cplusplus
0026 extern "C" {
0027 #endif
0028 
0029 OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
0030     const char *properties);
0031 int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
0032 void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
0033 
0034 const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);
0035 const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);
0036 const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *kdf);
0037 const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *kdf);
0038 int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
0039 
0040 void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
0041     void (*fn)(OSSL_ENCODER *encoder, void *arg),
0042     void *arg);
0043 int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
0044     void (*fn)(const char *name, void *data),
0045     void *data);
0046 const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
0047 int OSSL_ENCODER_get_params(OSSL_ENCODER *encoder, OSSL_PARAM params[]);
0048 
0049 const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder);
0050 OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new(void);
0051 int OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx,
0052     const OSSL_PARAM params[]);
0053 void OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx);
0054 
0055 /* Utilities that help set specific parameters */
0056 int OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx,
0057     const unsigned char *kstr, size_t klen);
0058 int OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx,
0059     pem_password_cb *cb, void *cbarg);
0060 int OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx,
0061     OSSL_PASSPHRASE_CALLBACK *cb,
0062     void *cbarg);
0063 int OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx,
0064     const UI_METHOD *ui_method,
0065     void *ui_data);
0066 int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,
0067     const char *cipher_name,
0068     const char *propquery);
0069 int OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection);
0070 int OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx,
0071     const char *output_type);
0072 int OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx,
0073     const char *output_structure);
0074 
0075 /* Utilities to add encoders */
0076 int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder);
0077 int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,
0078     OSSL_LIB_CTX *libctx, const char *propq);
0079 int OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx);
0080 
0081 typedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE;
0082 OSSL_ENCODER *
0083 OSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst);
0084 void *
0085 OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);
0086 const char *
0087 OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);
0088 const char *
0089 OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);
0090 
0091 typedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst,
0092     void *construct_data);
0093 typedef void OSSL_ENCODER_CLEANUP(void *construct_data);
0094 
0095 int OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx,
0096     OSSL_ENCODER_CONSTRUCT *construct);
0097 int OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx,
0098     void *construct_data);
0099 int OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx,
0100     OSSL_ENCODER_CLEANUP *cleanup);
0101 
0102 /* Utilities to output the object to encode */
0103 int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
0104 #ifndef OPENSSL_NO_STDIO
0105 int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
0106 #endif
0107 int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
0108     size_t *pdata_len);
0109 
0110 /*
0111  * Create the OSSL_ENCODER_CTX with an associated type.  This will perform
0112  * an implicit OSSL_ENCODER_fetch(), suitable for the object of that type.
0113  * This is more useful than calling OSSL_ENCODER_CTX_new().
0114  */
0115 OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey,
0116     int selection,
0117     const char *output_type,
0118     const char *output_struct,
0119     const char *propquery);
0120 
0121 #ifdef __cplusplus
0122 }
0123 #endif
0124 #endif