CRYPTO_DOWN_REF(&encoder->base.refcnt, &ref, encoder->base.lock);
if (ref > 0)
return;
+ OPENSSL_free(encoder->base.name);
ossl_provider_free(encoder->base.prov);
CRYPTO_THREAD_lock_free(encoder->base.lock);
OPENSSL_free(encoder);
static const OSSL_LIB_CTX_METHOD encoder_store_method = {
+ OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY,
encoder_store_new,
encoder_store_free,
};
}
/* Create and populate a encoder method */
-static void *encoder_from_dispatch(int id, const OSSL_ALGORITHM *algodef,
- OSSL_PROVIDER *prov)
+static void *encoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
+ OSSL_PROVIDER *prov)
{
OSSL_ENCODER *encoder = NULL;
const OSSL_DISPATCH *fns = algodef->implementation;
if ((encoder = ossl_encoder_new()) == NULL)
return NULL;
encoder->base.id = id;
+ if ((encoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
+ OSSL_ENCODER_free(encoder);
+ return NULL;
+ }
encoder->base.propdef = algodef->property_definition;
+ encoder->base.description = algodef->algorithm_description;
for (; fns->function_id != 0; fns++) {
switch (fns->function_id) {
/*
* The core fetching functionality passes the names of the implementation.
* This function is responsible to getting an identity number for them,
- * then call encoder_from_dispatch() with that identity number.
+ * then call encoder_from_algorithm() with that identity number.
*/
static void *construct_encoder(const OSSL_ALGORITHM *algodef,
OSSL_PROVIDER *prov, void *data)
void *method = NULL;
if (id != 0)
- method = encoder_from_dispatch(id, algodef, prov);
+ method = encoder_from_algorithm(id, algodef, prov);
/*
* Flag to indicate that there was actual construction errors. This
* Library of basic method functions
*/
-const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder)
+const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder)
{
if (!ossl_assert(encoder != NULL)) {
ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
return encoder->base.prov;
}
-const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder)
+const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder)
{
if (!ossl_assert(encoder != NULL)) {
ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
return encoder->base.propdef;
}
-int OSSL_ENCODER_number(const OSSL_ENCODER *encoder)
+int OSSL_ENCODER_get_number(const OSSL_ENCODER *encoder)
{
if (!ossl_assert(encoder != NULL)) {
ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
return encoder->base.id;
}
+const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder)
+{
+ return encoder->base.name;
+}
+
+const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder)
+{
+ return encoder->base.description;
+}
+
int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name)
{
if (encoder->base.prov != NULL) {
if (id != 0)
method =
- encoder_from_dispatch(id, algodef, provider);
+ encoder_from_algorithm(id, algodef, provider);
if (method != NULL) {
data->user_fn(method, data->user_arg);
OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder)
{
if (encoder != NULL && encoder->gettable_params != NULL) {
- void *provctx = ossl_provider_ctx(OSSL_ENCODER_provider(encoder));
+ void *provctx = ossl_provider_ctx(OSSL_ENCODER_get0_provider(encoder));
return encoder->gettable_params(provctx);
}
const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder)
{
if (encoder != NULL && encoder->settable_ctx_params != NULL) {
- void *provctx = ossl_provider_ctx(OSSL_ENCODER_provider(encoder));
+ void *provctx = ossl_provider_ctx(OSSL_ENCODER_get0_provider(encoder));
return encoder->settable_ctx_params(provctx);
}