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_set_params_fn md5_sha1_set_params
;
22 /* Special set_params method for SSL3 */
23 static int md5_sha1_set_params(void *vctx
, const OSSL_PARAM params
[])
27 const void *msg
= NULL
;
29 MD5_SHA1_CTX
*ctx
= (MD5_SHA1_CTX
*)vctx
;
31 if (ctx
!= NULL
&& params
!= NULL
) {
32 p
= OSSL_PARAM_locate(params
, OSSL_DIGEST_PARAM_CMD
);
33 if (p
!= NULL
&& !OSSL_PARAM_get_int(p
, &cmd
))
35 p
= OSSL_PARAM_locate(params
, OSSL_DIGEST_PARAM_MSG
);
36 if (p
!= NULL
&& !OSSL_PARAM_get_octet_ptr(p
, &msg
, &msg_len
))
38 return md5_sha1_ctrl(ctx
, cmd
, msg_len
, (void *)msg
);
43 OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(md5_sha1
, MD5_SHA1_CTX
,
44 MD5_SHA1_CBLOCK
, MD5_SHA1_DIGEST_LENGTH
,
45 md5_sha1_init
, md5_sha1_update
, md5_sha1_final
,