summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-06-02 06:32:00 +0200
committerPauli <pauli@openssl.org>2021-06-05 20:30:47 +1000
commit73c02a6201d08afb4ad5055fc3906e1d4504b578 (patch)
treed9fce0ced39e25691a79fa14ac2440f07e935d48 /crypto
parent6462a4f0508e451f0411e88b2f465f27f1db6cc7 (diff)
ENCODER: Drop OSSL_ENCODER_PARAM_INPUT_TYPE
This was a poor substitute for using the name of the decoder implementation, and since there is functionality to get the latter now, this parameter can be dropped. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15570)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/encode_decode/encoder_lib.c31
-rw-r--r--crypto/encode_decode/encoder_local.h1
2 files changed, 11 insertions, 21 deletions
diff --git a/crypto/encode_decode/encoder_lib.c b/crypto/encode_decode/encoder_lib.c
index 4481773610..d90ce72528 100644
--- a/crypto/encode_decode/encoder_lib.c
+++ b/crypto/encode_decode/encoder_lib.c
@@ -36,6 +36,8 @@ struct encoder_process_data_st {
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);
@@ -207,10 +209,7 @@ static OSSL_ENCODER_INSTANCE *ossl_encoder_instance_new(OSSL_ENCODER *encoder,
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(&params[0]))
@@ -260,8 +259,8 @@ static int ossl_encoder_ctx_add_encoder_inst(OSSL_ENCODER_CTX *ctx,
"(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;
@@ -363,14 +362,6 @@ OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst)
}
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)
{
if (encoder_inst == NULL)
@@ -566,6 +557,9 @@ static int encoder_process(struct encoder_process_data_st *data)
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;
@@ -586,15 +580,12 @@ static int encoder_process(struct encoder_process_data_st *data)
*/
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,
diff --git a/crypto/encode_decode/encoder_local.h b/crypto/encode_decode/encoder_local.h
index 0678fc2014..44bd39b757 100644
--- a/crypto/encode_decode/encoder_local.h
+++ b/crypto/encode_decode/encoder_local.h
@@ -59,7 +59,6 @@ struct ossl_decoder_st {
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 */
};