Change OSSL_PARAM return size to not be a pointer.
[oweals/openssl.git] / providers / legacy / digests / mdc2_prov.c
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
18 static OSSL_OP_digest_set_params_fn mdc2_set_params;
19
20 static int mdc2_set_params(void *vctx, const OSSL_PARAM params[])
21 {
22     const OSSL_PARAM *p;
23     MDC2_CTX *ctx = (MDC2_CTX *)vctx;
24
25     if (ctx != NULL && params != NULL) {
26         p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE);
27         if (p != NULL && !OSSL_PARAM_get_int(p, &ctx->pad_type))
28             return 0;
29         return 1;
30     }
31     return 0; /* Null Parameter */
32 }
33
34 OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(mdc2, MDC2_CTX,
35                                   MDC2_BLOCK, MDC2_DIGEST_LENGTH,
36                                   MDC2_Init, MDC2_Update, MDC2_Final,
37                                   mdc2_set_params)