]>
Commit | Line | Data |
---|---|---|
d5e5e2ff SL |
1 | /* |
2 | * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. | |
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 | ||
10 | #include <openssl/crypto.h> | |
11 | #include <openssl/params.h> | |
12 | #include <openssl/mdc2.h> | |
13 | #include <openssl/core_names.h> | |
14 | ||
15 | #include "internal/core_mkdigest.h" | |
16 | #include "internal/provider_algs.h" | |
17 | ||
92d9d0ae | 18 | static OSSL_OP_digest_set_ctx_params_fn mdc2_set_ctx_params; |
ec02412b | 19 | static OSSL_OP_digest_settable_ctx_params_fn mdc2_settable_ctx_params; |
d5e5e2ff | 20 | |
ec02412b RL |
21 | static const OSSL_PARAM known_mdc2_settable_ctx_params[] = { |
22 | {OSSL_DIGEST_PARAM_PAD_TYPE, OSSL_PARAM_INTEGER, NULL, sizeof(int), 0}, | |
23 | OSSL_PARAM_END | |
24 | }; | |
25 | ||
26 | static const OSSL_PARAM *mdc2_settable_ctx_params(void) | |
27 | { | |
28 | return known_mdc2_settable_ctx_params; | |
29 | } | |
30 | ||
92d9d0ae | 31 | static int mdc2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) |
d5e5e2ff SL |
32 | { |
33 | const OSSL_PARAM *p; | |
34 | MDC2_CTX *ctx = (MDC2_CTX *)vctx; | |
35 | ||
36 | if (ctx != NULL && params != NULL) { | |
4e7991b4 | 37 | p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE); |
d5e5e2ff SL |
38 | if (p != NULL && !OSSL_PARAM_get_int(p, &ctx->pad_type)) |
39 | return 0; | |
40 | return 1; | |
41 | } | |
42 | return 0; /* Null Parameter */ | |
43 | } | |
44 | ||
45 | OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(mdc2, MDC2_CTX, | |
f1d3df3e | 46 | MDC2_BLOCK, MDC2_DIGEST_LENGTH, 0, |
d5e5e2ff | 47 | MDC2_Init, MDC2_Update, MDC2_Final, |
92d9d0ae | 48 | mdc2_settable_ctx_params, mdc2_set_ctx_params) |