BIO *bio;
/* Index of the current decoder instance to be processed */
- size_t current_deser_inst_index;
+ size_t current_decoder_inst_index;
};
static int decoder_process(const OSSL_PARAM params[], void *arg);
|| !OSSL_PARAM_modified(¶ms[0]))
goto err;
- if ((decoder_inst->deserctx = decoder_inst->decoder->newctx(provctx))
+ if ((decoder_inst->decoderctx = decoder_inst->decoder->newctx(provctx))
== NULL)
goto err;
err:
if (decoder_inst != NULL) {
if (decoder_inst->decoder != NULL)
- decoder_inst->decoder->freectx(decoder_inst->deserctx);
+ decoder_inst->decoder->freectx(decoder_inst->decoderctx);
OSSL_DECODER_free(decoder_inst->decoder);
OPENSSL_free(decoder_inst);
}
return 0;
}
- return decoder_inst->decoder->export_object(decoder_inst->deserctx,
+ return decoder_inst->decoder->export_object(decoder_inst->decoderctx,
reference, reference_sz,
export_cb, export_cbarg);
}
{
if (decoder_inst == NULL)
return NULL;
- return decoder_inst->deserctx;
+ return decoder_inst->decoderctx;
}
static int decoder_process(const OSSL_PARAM params[], void *arg)
if (params == NULL) {
/* First iteration, where we prepare for what is to come */
- data->current_deser_inst_index =
+ data->current_decoder_inst_index =
OSSL_DECODER_CTX_num_decoders(ctx);
bio = data->bio;
decoder_inst =
sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts,
- data->current_deser_inst_index);
+ data->current_decoder_inst_index);
decoder = OSSL_DECODER_INSTANCE_decoder(decoder_inst);
if (ctx->construct != NULL
* If we have no more decoders to look through at this point,
* we failed
*/
- if (data->current_deser_inst_index == 0)
+ if (data->current_decoder_inst_index == 0)
goto end;
if ((loc = BIO_tell(bio)) < 0) {
goto end;
}
- for (i = data->current_deser_inst_index; i-- > 0;) {
- OSSL_DECODER_INSTANCE *new_deser_inst =
+ for (i = data->current_decoder_inst_index; i-- > 0;) {
+ OSSL_DECODER_INSTANCE *new_decoder_inst =
sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts, i);
- OSSL_DECODER *new_deser =
- OSSL_DECODER_INSTANCE_decoder(new_deser_inst);
+ OSSL_DECODER *new_decoder =
+ OSSL_DECODER_INSTANCE_decoder(new_decoder_inst);
/*
* If |decoder| is NULL, it means we've just started, and the caller
*/
if (decoder == NULL && ctx->start_input_type != NULL
&& strcasecmp(ctx->start_input_type,
- new_deser_inst->input_type) != 0)
+ new_decoder_inst->input_type) != 0)
continue;
/*
* value for that decoder.
*/
if (decoder != NULL
- && !OSSL_DECODER_is_a(decoder, new_deser_inst->input_type))
+ && !OSSL_DECODER_is_a(decoder, new_decoder_inst->input_type))
continue;
/*
goto end;
/* Recurse */
- new_data.current_deser_inst_index = i;
- ok = new_deser->decode(new_deser_inst->deserctx, (OSSL_CORE_BIO *)bio,
- decoder_process, &new_data,
- ossl_pw_passphrase_callback_dec,
- &new_data.ctx->pwdata);
+ new_data.current_decoder_inst_index = i;
+ ok = new_decoder->decode(new_decoder_inst->decoderctx,
+ (OSSL_CORE_BIO *)bio,
+ decoder_process, &new_data,
+ ossl_pw_passphrase_callback_dec,
+ &new_data.ctx->pwdata);
if (ok)
break;
}
OSSL_DECODER_INSTANCE *decoder_inst =
sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts, i);
- if (decoder_inst->deserctx == NULL
+ if (decoder_inst->decoderctx == NULL
|| decoder_inst->decoder->set_ctx_params == NULL)
continue;
- if (!decoder_inst->decoder->set_ctx_params(decoder_inst->deserctx, params))
+ if (!decoder_inst->decoder->set_ctx_params(decoder_inst->decoderctx,
+ params))
return 0;
}
return 1;
{
if (decoder_inst != NULL) {
if (decoder_inst->decoder->freectx != NULL)
- decoder_inst->decoder->freectx(decoder_inst->deserctx);
- decoder_inst->deserctx = NULL;
+ decoder_inst->decoder->freectx(decoder_inst->decoderctx);
+ decoder_inst->decoderctx = NULL;
OSSL_DECODER_free(decoder_inst->decoder);
decoder_inst->decoder = NULL;
OPENSSL_free(decoder_inst);
struct decoder_EVP_PKEY_data_st *data = construct_data;
OSSL_DECODER *decoder =
OSSL_DECODER_INSTANCE_decoder(decoder_inst);
- void *deserctx = OSSL_DECODER_INSTANCE_decoder_ctx(decoder_inst);
+ void *decoderctx = OSSL_DECODER_INSTANCE_decoder_ctx(decoder_inst);
size_t i, end_i;
/*
* |object_ref| points to a provider reference to an object, its exact
* No need to check for errors here, the value of
* |import_data.keydata| is as much an indicator.
*/
- (void)decoder->export_object(deserctx, object_ref, object_ref_sz,
+ (void)decoder->export_object(decoderctx,
+ object_ref, object_ref_sz,
&evp_keymgmt_util_try_import,
&import_data);
keydata = import_data.keydata;
#include "internal/passphrase.h"
#include "internal/refcount.h"
-struct ossl_serdes_base_st {
+struct ossl_endecode_base_st {
OSSL_PROVIDER *prov;
int id;
const char *propdef;
};
struct ossl_encoder_st {
- struct ossl_serdes_base_st base;
+ struct ossl_endecode_base_st base;
OSSL_FUNC_encoder_newctx_fn *newctx;
OSSL_FUNC_encoder_freectx_fn *freectx;
OSSL_FUNC_encoder_set_ctx_params_fn *set_ctx_params;
};
struct ossl_decoder_st {
- struct ossl_serdes_base_st base;
+ 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;
struct ossl_encoder_ctx_st {
OSSL_ENCODER *encoder;
- void *serctx;
+ void *encoderctx;
int selection;
};
struct ossl_decoder_instance_st {
- OSSL_DECODER *decoder; /* Never NULL */
- void *deserctx; /* Never NULL */
+ OSSL_DECODER *decoder; /* Never NULL */
+ void *decoderctx; /* Never NULL */
const char *input_type; /* Never NULL */
};
void *provctx = ossl_provider_ctx(prov);
if (OSSL_ENCODER_up_ref(encoder)) {
- ctx->serctx = encoder->newctx(provctx);
+ ctx->encoderctx = encoder->newctx(provctx);
} else {
OSSL_ENCODER_free(encoder);
OPENSSL_free(ctx);
}
if (ctx->encoder != NULL && ctx->encoder->set_ctx_params != NULL)
- return ctx->encoder->set_ctx_params(ctx->serctx, params);
+ return ctx->encoder->set_ctx_params(ctx->encoderctx, params);
return 0;
}
{
if (ctx != NULL) {
if (ctx->encoder != NULL && ctx->encoder->freectx != NULL)
- ctx->encoder->freectx(ctx->serctx);
+ ctx->encoder->freectx(ctx->encoderctx);
OSSL_ENCODER_free(ctx->encoder);
ossl_pw_clear_passphrase_data(&ctx->pwdata);
OPENSSL_free(ctx);
OSSL_ENCODER_CTX *ctx = write_data->ctx;
BIO *out = write_data->out;
- return ctx->encoder->encode_data(ctx->serctx, params, (OSSL_CORE_BIO *)out,
+ return ctx->encoder->encode_data(ctx->encoderctx, params,
+ (OSSL_CORE_BIO *)out,
ossl_pw_passphrase_callback_enc,
&ctx->pwdata);
}
&encoder_write_cb, &write_data);
}
- return ctx->encoder->encode_object(ctx->serctx, keydata,
+ return ctx->encoder->encode_object(ctx->encoderctx, keydata,
(OSSL_CORE_BIO *)out,
ossl_pw_passphrase_callback_enc,
&ctx->pwdata);
* Select the encoder in two steps. First, get the names of all of
* the encoders. Then determine which is the best one to use.
* This has to be broken because it isn't possible to fetch the
- * serialisers inside EVP_KEYMGMT_names_do_all() due to locking
- * order inversions with the store lock.
+ * encoders inside EVP_KEYMGMT_names_do_all() due to locking order
+ * inversions with the store lock.
*/
sel_data.error = 0;
sel_data.names = sk_OPENSSL_CSTRING_new_null();