]>
Commit | Line | Data |
---|---|---|
d5e5e2ff | 1 | /* |
a28d06f3 | 2 | * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. |
d5e5e2ff SL |
3 | * |
4 | * Licensed under the Apache License 2.0 (the "License"). You may not use | |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
8 | */ | |
9 | ||
33ee9ae0 P |
10 | /* |
11 | * MDC2 low level APIs are deprecated for public use, but still ok for | |
12 | * internal use. | |
13 | */ | |
14 | #include "internal/deprecated.h" | |
15 | ||
d5e5e2ff SL |
16 | #include <openssl/crypto.h> |
17 | #include <openssl/params.h> | |
18 | #include <openssl/mdc2.h> | |
19 | #include <openssl/core_names.h> | |
c85d5e02 | 20 | #include <openssl/err.h> |
2741128e | 21 | #include <openssl/proverr.h> |
7c214f10 | 22 | #include "prov/digestcommon.h" |
af3e7e1b | 23 | #include "prov/implementations.h" |
d5e5e2ff | 24 | |
363b1e5d DMSP |
25 | static OSSL_FUNC_digest_set_ctx_params_fn mdc2_set_ctx_params; |
26 | static OSSL_FUNC_digest_settable_ctx_params_fn mdc2_settable_ctx_params; | |
d5e5e2ff | 27 | |
ec02412b | 28 | static const OSSL_PARAM known_mdc2_settable_ctx_params[] = { |
1c3ace68 | 29 | OSSL_PARAM_uint(OSSL_DIGEST_PARAM_PAD_TYPE, NULL), |
ec02412b RL |
30 | OSSL_PARAM_END |
31 | }; | |
32 | ||
1017ab21 | 33 | static const OSSL_PARAM *mdc2_settable_ctx_params(ossl_unused void *provctx) |
ec02412b RL |
34 | { |
35 | return known_mdc2_settable_ctx_params; | |
36 | } | |
37 | ||
92d9d0ae | 38 | static int mdc2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) |
d5e5e2ff SL |
39 | { |
40 | const OSSL_PARAM *p; | |
41 | MDC2_CTX *ctx = (MDC2_CTX *)vctx; | |
42 | ||
43 | if (ctx != NULL && params != NULL) { | |
4e7991b4 | 44 | p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE); |
1c3ace68 | 45 | if (p != NULL && !OSSL_PARAM_get_uint(p, &ctx->pad_type)) { |
c85d5e02 | 46 | ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); |
d5e5e2ff | 47 | return 0; |
c85d5e02 | 48 | } |
d5e5e2ff SL |
49 | return 1; |
50 | } | |
51 | return 0; /* Null Parameter */ | |
52 | } | |
53 | ||
1be63951 | 54 | /* ossl_mdc2_functions */ |
c85d5e02 SL |
55 | IMPLEMENT_digest_functions_with_settable_ctx( |
56 | mdc2, MDC2_CTX, MDC2_BLOCK, MDC2_DIGEST_LENGTH, 0, | |
57 | MDC2_Init, MDC2_Update, MDC2_Final, | |
58 | mdc2_settable_ctx_params, mdc2_set_ctx_params) |