VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.5/providers/implementations/digests/mdc2_prov.c@ 104078

Last change on this file since 104078 was 104078, checked in by vboxsync, 11 months ago

openssl-3.1.5: Applied and adjusted our OpenSSL changes to 3.1.4. bugref:10638

File size: 1.8 KB
Line 
1/*
2 * Copyright 2019-2021 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/*
11 * MDC2 low level APIs are deprecated for public use, but still ok for
12 * internal use.
13 */
14#include "internal/deprecated.h"
15
16#include <openssl/crypto.h>
17#include <openssl/params.h>
18#include <openssl/mdc2.h>
19#include <openssl/core_names.h>
20#include <openssl/err.h>
21#include <openssl/proverr.h>
22#include "prov/digestcommon.h"
23#include "prov/implementations.h"
24
25static OSSL_FUNC_digest_set_ctx_params_fn mdc2_set_ctx_params;
26static OSSL_FUNC_digest_settable_ctx_params_fn mdc2_settable_ctx_params;
27
28static const OSSL_PARAM known_mdc2_settable_ctx_params[] = {
29 OSSL_PARAM_uint(OSSL_DIGEST_PARAM_PAD_TYPE, NULL),
30 OSSL_PARAM_END
31};
32
33static const OSSL_PARAM *mdc2_settable_ctx_params(ossl_unused void *ctx,
34 ossl_unused void *provctx)
35{
36 return known_mdc2_settable_ctx_params;
37}
38
39static int mdc2_set_ctx_params(void *vctx, const OSSL_PARAM params[])
40{
41 const OSSL_PARAM *p;
42 MDC2_CTX *ctx = (MDC2_CTX *)vctx;
43
44 if (ctx == NULL)
45 return 0;
46 if (params == NULL)
47 return 1;
48
49 p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE);
50 if (p != NULL && !OSSL_PARAM_get_uint(p, &ctx->pad_type)) {
51 ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
52 return 0;
53 }
54 return 1;
55}
56
57/* ossl_mdc2_functions */
58IMPLEMENT_digest_functions_with_settable_ctx(
59 mdc2, MDC2_CTX, MDC2_BLOCK, MDC2_DIGEST_LENGTH, 0,
60 MDC2_Init, MDC2_Update, MDC2_Final,
61 mdc2_settable_ctx_params, mdc2_set_ctx_params)
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette