Path: blob/main/crypto/openssl/providers/implementations/digests/mdc2_prov.c
48383 views
/*1* Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89/*10* MDC2 low level APIs are deprecated for public use, but still ok for11* internal use.12*/13#include "internal/deprecated.h"1415#include <openssl/crypto.h>16#include <openssl/params.h>17#include <openssl/mdc2.h>18#include <openssl/core_names.h>19#include <openssl/err.h>20#include <openssl/proverr.h>21#include "prov/digestcommon.h"22#include "prov/implementations.h"2324static OSSL_FUNC_digest_set_ctx_params_fn mdc2_set_ctx_params;25static OSSL_FUNC_digest_settable_ctx_params_fn mdc2_settable_ctx_params;2627static const OSSL_PARAM known_mdc2_settable_ctx_params[] = {28OSSL_PARAM_uint(OSSL_DIGEST_PARAM_PAD_TYPE, NULL),29OSSL_PARAM_END30};3132static const OSSL_PARAM *mdc2_settable_ctx_params(ossl_unused void *ctx,33ossl_unused void *provctx)34{35return known_mdc2_settable_ctx_params;36}3738static int mdc2_set_ctx_params(void *vctx, const OSSL_PARAM params[])39{40const OSSL_PARAM *p;41MDC2_CTX *ctx = (MDC2_CTX *)vctx;4243if (ctx == NULL)44return 0;45if (ossl_param_is_empty(params))46return 1;4748p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE);49if (p != NULL && !OSSL_PARAM_get_uint(p, &ctx->pad_type)) {50ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);51return 0;52}53return 1;54}5556/* ossl_mdc2_functions */57IMPLEMENT_digest_functions_with_settable_ctx(58mdc2, MDC2_CTX, MDC2_BLOCK, MDC2_DIGEST_LENGTH, 0,59MDC2_Init, MDC2_Update, MDC2_Final,60mdc2_settable_ctx_params, mdc2_set_ctx_params)616263