]>
Commit | Line | Data |
---|---|---|
d5e5e2ff | 1 | /* |
8020d79b | 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 | ||
85d843c8 | 10 | /* |
781aa7ab | 11 | * MD5 and SHA-1 low level APIs are deprecated for public use, but still ok for |
85d843c8 P |
12 | * internal use. |
13 | */ | |
14 | #include "internal/deprecated.h" | |
15 | ||
d5e5e2ff SL |
16 | #include <string.h> |
17 | #include <openssl/crypto.h> | |
18 | #include <openssl/evp.h> | |
19 | #include <openssl/params.h> | |
20 | #include <openssl/core_names.h> | |
7c214f10 RL |
21 | #include "prov/md5_sha1.h" |
22 | #include "prov/digestcommon.h" | |
af3e7e1b | 23 | #include "prov/implementations.h" |
d5e5e2ff | 24 | |
363b1e5d DMSP |
25 | static OSSL_FUNC_digest_set_ctx_params_fn md5_sha1_set_ctx_params; |
26 | static OSSL_FUNC_digest_settable_ctx_params_fn md5_sha1_settable_ctx_params; | |
ec02412b RL |
27 | |
28 | static const OSSL_PARAM known_md5_sha1_settable_ctx_params[] = { | |
29 | {OSSL_DIGEST_PARAM_SSL3_MS, OSSL_PARAM_OCTET_STRING, NULL, 0, 0}, | |
30 | OSSL_PARAM_END | |
31 | }; | |
32 | ||
e772f25c P |
33 | static const OSSL_PARAM *md5_sha1_settable_ctx_params(ossl_unused void *ctx, |
34 | ossl_unused void *provctx) | |
ec02412b RL |
35 | { |
36 | return known_md5_sha1_settable_ctx_params; | |
37 | } | |
d5e5e2ff SL |
38 | |
39 | /* Special set_params method for SSL3 */ | |
92d9d0ae | 40 | static int md5_sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) |
d5e5e2ff | 41 | { |
d5e5e2ff SL |
42 | const OSSL_PARAM *p; |
43 | MD5_SHA1_CTX *ctx = (MD5_SHA1_CTX *)vctx; | |
44 | ||
45 | if (ctx != NULL && params != NULL) { | |
4e7991b4 | 46 | p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS); |
83b4a243 | 47 | if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING) |
627b73cc P |
48 | return ossl_md5_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET, |
49 | p->data_size, p->data); | |
d5e5e2ff SL |
50 | } |
51 | return 0; | |
52 | } | |
53 | ||
1be63951 | 54 | /* ossl_md5_sha1_functions */ |
c85d5e02 SL |
55 | IMPLEMENT_digest_functions_with_settable_ctx( |
56 | md5_sha1, MD5_SHA1_CTX, MD5_SHA1_CBLOCK, MD5_SHA1_DIGEST_LENGTH, 0, | |
627b73cc | 57 | ossl_md5_sha1_init, ossl_md5_sha1_update, ossl_md5_sha1_final, |
c85d5e02 | 58 | md5_sha1_settable_ctx_params, md5_sha1_set_ctx_params) |