OSSL_ENCODER_INSTANCE *prev_encoder_inst;
unsigned char *running_output;
size_t running_output_length;
+ /* Data type = the name of the first succeeding encoder implementation */
+ const char *data_type;
};
static int encoder_process(struct encoder_process_data_st *data);
OSSL_PARAM_construct_utf8_ptr(OSSL_ENCODER_PARAM_OUTPUT_STRUCTURE,
(char **)&encoder_inst->output_structure,
0);
- params[2] =
- OSSL_PARAM_construct_utf8_ptr(OSSL_ENCODER_PARAM_INPUT_TYPE,
- (char **)&encoder_inst->input_type, 0);
- params[3] = OSSL_PARAM_construct_end();
+ params[2] = OSSL_PARAM_construct_end();
if (!encoder->get_params(params)
|| !OSSL_PARAM_modified(¶ms[0]))
"(ctx %p) Added encoder instance %p (encoder %p) with:\n",
(void *)ctx, (void *)ei, (void *)ei->encoder);
BIO_printf(trc_out,
- " output type: %s, output structure: %s, input type :%s\n",
- ei->output_type, ei->output_structure, ei->input_type);
+ " output type: %s, output structure: %s\n",
+ ei->output_type, ei->output_structure);
} OSSL_TRACE_END(ENCODER);
}
return ok;
return encoder_inst->encoderctx;
}
-const char *
-OSSL_ENCODER_INSTANCE_get_input_type(OSSL_ENCODER_INSTANCE *encoder_inst)
-{
- if (encoder_inst == NULL)
- return NULL;
- return encoder_inst->input_type;
-}
-
const char *
OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst)
{
data->ctx->construct(current_encoder_inst,
data->ctx->construct_data);
+ /* Also set the data type, using the encoder implementation name */
+ data->data_type = OSSL_ENCODER_get0_name(current_encoder);
+
/* Assume that the constructor recorded an error */
if (original_data != NULL)
ok = 1;
*/
OSSL_PARAM *abstract_p = abstract;
- const char *prev_input_type =
- OSSL_ENCODER_INSTANCE_get_input_type(data->prev_encoder_inst);
const char *prev_output_structure =
OSSL_ENCODER_INSTANCE_get_output_structure(data->prev_encoder_inst);
- if (prev_input_type != NULL)
- *abstract_p++ =
- OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE,
- (char *)prev_input_type, 0);
+ *abstract_p++ =
+ OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE,
+ (char *)data->data_type, 0);
if (prev_output_structure != NULL)
*abstract_p++ =
OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_STRUCTURE,
struct ossl_encoder_instance_st {
OSSL_ENCODER *encoder; /* Never NULL */
void *encoderctx; /* Never NULL */
- const char *input_type; /* May be NULL */
const char *output_type; /* Never NULL */
const char *output_structure; /* May be NULL */
};
OSSL_ENCODER_INSTANCE,
OSSL_ENCODER_INSTANCE_get_encoder,
OSSL_ENCODER_INSTANCE_get_encoder_ctx,
-OSSL_ENCODER_INSTANCE_get_input_type,
OSSL_ENCODER_INSTANCE_get_output_type,
OSSL_ENCODER_INSTANCE_get_output_structure,
OSSL_ENCODER_CONSTRUCT,
void *
OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);
const char *
- OSSL_ENCODER_INSTANCE_get_input_type(OSSL_ENCODER_INSTANCE *encoder_inst);
- const char *
OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);
const char *
OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);
OSSL_ENCODER_INSTANCE_get_encoder_ctx() can be used to get the encoder
implementation's provider context of the encoder instance I<encoder_inst>.
-OSSL_ENCODER_INSTANCE_get_input_type() can be used to get the input type for
-the encoder implementation of the encoder instance I<encoder_inst>.
-This may be NULL.
-
-OSSL_ENCODER_INSTANCE_get_output_type() can be used to get the output type
-for the encoder implementation of the encoder instance I<encoder_inst>.
-This will never be NULL.
-
OSSL_ENCODER_INSTANCE_get_output_type() can be used to get the output type
for the encoder implementation of the encoder instance I<encoder_inst>.
This will never be NULL.
=over 4
-=item "input-type" (B<OSSL_ENCODER_PARAM_INPUT_TYPE>) <UTF8 string>
-
-This is used to specify a distinct type name for the object passed as
-I<obj_raw> to OSSL_FUNC_encoder_encode.
-
-This parameter is an optional parameter, to be used if the name of the
-implementation can be ambiguous because of aliases, and something more
-deterministic is needed.
-
=item "output-type" (B<OSSL_ENCODER_PARAM_OUTPUT_TYPE>) <UTF8 string>
This is used to specify the output type for an ENCODER implementation.
*/
#define OSSL_ENCODER_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
#define OSSL_ENCODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
-#define OSSL_ENCODER_PARAM_INPUT_TYPE "input-type"
#define OSSL_ENCODER_PARAM_OUTPUT_TYPE "output-type"
#define OSSL_ENCODER_PARAM_OUTPUT_STRUCTURE "output-structure"
/* Currently PVK only, but reusable for others as needed */
void *
OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);
const char *
-OSSL_ENCODER_INSTANCE_get_input_type(OSSL_ENCODER_INSTANCE *encoder_inst);
-const char *
OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);
const char *
OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);
static const OSSL_PARAM *key2any_gettable_params(void *provctx, int structure)
{
static const OSSL_PARAM gettables[] = {
- { OSSL_ENCODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 },
{ OSSL_ENCODER_PARAM_OUTPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 },
OSSL_PARAM_END,
};
static const OSSL_PARAM gettables_w_structure[] = {
- { OSSL_ENCODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 },
{ OSSL_ENCODER_PARAM_OUTPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 },
{ OSSL_ENCODER_PARAM_OUTPUT_STRUCTURE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 },
OSSL_PARAM_END,
return structure ? gettables_w_structure : gettables;
}
-static int key2any_get_params(OSSL_PARAM params[], const char *input_type,
- const char *output_type,
+static int key2any_get_params(OSSL_PARAM params[], const char *output_type,
const char *output_struct)
{
OSSL_PARAM *p;
- p = OSSL_PARAM_locate(params, OSSL_ENCODER_PARAM_INPUT_TYPE);
- if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, input_type))
- return 0;
-
p = OSSL_PARAM_locate(params, OSSL_ENCODER_PARAM_OUTPUT_TYPE);
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, output_type))
return 0;
static int \
impl##_to_##kind##_##output##_get_params(OSSL_PARAM params[]) \
{ \
- return key2any_get_params(params, impl##_input_type, \
- output##_output_type, \
+ return key2any_get_params(params, output##_output_type, \
kind##_output_structure); \
} \
static void * \
return gettables;
}
-static int key2text_get_params(OSSL_PARAM params[], const char *input_type)
+static int key2text_get_params(OSSL_PARAM params[])
{
OSSL_PARAM *p;
- p = OSSL_PARAM_locate(params, OSSL_ENCODER_PARAM_INPUT_TYPE);
- if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, input_type))
- return 0;
-
p = OSSL_PARAM_locate(params, OSSL_ENCODER_PARAM_OUTPUT_TYPE);
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "TEXT"))
return 0;
impl##2text_free_object; \
static OSSL_FUNC_encoder_encode_fn impl##2text_encode; \
\
- static int impl##2text_get_params(OSSL_PARAM params[]) \
- { \
- return key2text_get_params(params, impl##_input_type); \
- } \
static void *impl##2text_import_object(void *ctx, int selection, \
const OSSL_PARAM params[]) \
{ \
{ OSSL_FUNC_ENCODER_GETTABLE_PARAMS, \
(void (*)(void))key2text_gettable_params }, \
{ OSSL_FUNC_ENCODER_GET_PARAMS, \
- (void (*)(void))impl##2text_get_params }, \
+ (void (*)(void))key2text_get_params }, \
{ OSSL_FUNC_ENCODER_IMPORT_OBJECT, \
(void (*)(void))impl##2text_import_object }, \
{ OSSL_FUNC_ENCODER_FREE_OBJECT, \
OSSL_ENCODER_CTX_set_selection ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_INSTANCE_get_encoder ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_INSTANCE_get_encoder_ctx ? 3_0_0 EXIST::FUNCTION:
-OSSL_ENCODER_INSTANCE_get_input_type ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_INSTANCE_get_output_type ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_CTX_set_construct ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_CTX_set_construct_data ? 3_0_0 EXIST::FUNCTION: