2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
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
12 #include <openssl/crypto.h>
13 #include <openssl/evp.h>
14 #include <openssl/params.h>
15 #include <openssl/core_names.h>
16 #include "internal/core_mkdigest.h"
17 #include "internal/md5_sha1.h"
18 #include "internal/provider_algs.h"
20 static OSSL_OP_digest_ctx_set_params_fn md5_sha1_ctx_set_params
;
21 static OSSL_OP_digest_settable_ctx_params_fn md5_sha1_settable_ctx_params
;
23 static const OSSL_PARAM known_md5_sha1_settable_ctx_params
[] = {
24 {OSSL_DIGEST_PARAM_SSL3_MS
, OSSL_PARAM_OCTET_STRING
, NULL
, 0, 0},
28 static const OSSL_PARAM
*md5_sha1_settable_ctx_params(void)
30 return known_md5_sha1_settable_ctx_params
;
33 /* Special set_params method for SSL3 */
34 static int md5_sha1_ctx_set_params(void *vctx
, const OSSL_PARAM params
[])
37 MD5_SHA1_CTX
*ctx
= (MD5_SHA1_CTX
*)vctx
;
39 if (ctx
!= NULL
&& params
!= NULL
) {
40 p
= OSSL_PARAM_locate_const(params
, OSSL_DIGEST_PARAM_SSL3_MS
);
41 if (p
!= NULL
&& p
->data_type
== OSSL_PARAM_OCTET_STRING
)
42 return md5_sha1_ctrl(ctx
, EVP_CTRL_SSL3_MASTER_SECRET
, p
->data_size
,
48 OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(md5_sha1
, MD5_SHA1_CTX
,
49 MD5_SHA1_CBLOCK
, MD5_SHA1_DIGEST_LENGTH
, 0,
50 md5_sha1_init
, md5_sha1_update
, md5_sha1_final
,
51 md5_sha1_settable_ctx_params
,
52 md5_sha1_ctx_set_params
)