#include <openssl/core_dispatch.h>
#include <openssl/types.h>
#include <openssl/safestack.h>
#include <openssl/encoder.h>
#include <openssl/decoder.h>
#include "crypto/decoder.h"
#include "internal/cryptlib.h"
#include "internal/passphrase.h"
#include "internal/property.h"
#include "internal/refcount.h"
struct ossl_endecode_base_st {
OSSL_PROVIDER *prov;
int id;
char *name;
const OSSL_ALGORITHM *algodef;
OSSL_PROPERTY_LIST *parsed_propdef;
CRYPTO_REF_COUNT refcnt;
};
struct ossl_encoder_st {
struct ossl_endecode_base_st base;
OSSL_FUNC_encoder_newctx_fn *newctx;
OSSL_FUNC_encoder_freectx_fn *freectx;
OSSL_FUNC_encoder_get_params_fn *get_params;
OSSL_FUNC_encoder_gettable_params_fn *gettable_params;
OSSL_FUNC_encoder_set_ctx_params_fn *set_ctx_params;
OSSL_FUNC_encoder_settable_ctx_params_fn *settable_ctx_params;
OSSL_FUNC_encoder_does_selection_fn *does_selection;
OSSL_FUNC_encoder_encode_fn *encode;
OSSL_FUNC_encoder_import_object_fn *import_object;
OSSL_FUNC_encoder_free_object_fn *free_object;
};
struct ossl_decoder_st {
struct ossl_endecode_base_st base;
OSSL_FUNC_decoder_newctx_fn *newctx;
OSSL_FUNC_decoder_freectx_fn *freectx;
OSSL_FUNC_decoder_get_params_fn *get_params;
OSSL_FUNC_decoder_gettable_params_fn *gettable_params;
OSSL_FUNC_decoder_set_ctx_params_fn *set_ctx_params;
OSSL_FUNC_decoder_settable_ctx_params_fn *settable_ctx_params;
OSSL_FUNC_decoder_does_selection_fn *does_selection;
OSSL_FUNC_decoder_decode_fn *decode;
OSSL_FUNC_decoder_export_object_fn *export_object;
};
struct ossl_encoder_instance_st {
OSSL_ENCODER *encoder;
void *encoderctx;
const char *output_type;
const char *output_structure;
};
DEFINE_STACK_OF(OSSL_ENCODER_INSTANCE)
void ossl_encoder_instance_free(OSSL_ENCODER_INSTANCE *encoder_inst);
struct ossl_encoder_ctx_st {
int selection;
const char *output_type;
const char *output_structure;
STACK_OF(OSSL_ENCODER_INSTANCE) *encoder_insts;
OSSL_ENCODER_CONSTRUCT *construct;
OSSL_ENCODER_CLEANUP *cleanup;
void *construct_data;
struct ossl_passphrase_data_st pwdata;
};
struct ossl_decoder_instance_st {
OSSL_DECODER *decoder;
void *decoderctx;
const char *input_type;
const char *input_structure;
int input_type_id;
int order;
int score;
unsigned int flag_input_structure_was_set : 1;
};
DEFINE_STACK_OF(OSSL_DECODER_INSTANCE)
struct ossl_decoder_ctx_st {
const char *start_input_type;
const char *input_structure;
int selection;
STACK_OF(OSSL_DECODER_INSTANCE) *decoder_insts;
OSSL_DECODER_CONSTRUCT *construct;
OSSL_DECODER_CLEANUP *cleanup;
void *construct_data;
struct ossl_passphrase_data_st pwdata;
int harderr;
};
const OSSL_PROPERTY_LIST *
ossl_decoder_parsed_properties(const OSSL_DECODER *decoder);
const OSSL_PROPERTY_LIST *
ossl_encoder_parsed_properties(const OSSL_ENCODER *encoder);
int ossl_decoder_fast_is_a(OSSL_DECODER *decoder,
const char *name, int *id_cache);