From 9019a184494e6fc220bcc1eb8f47f33fe0f3e506 Mon Sep 17 00:00:00 2001 From: yzrh Date: Sun, 1 Jan 2023 10:44:27 +0000 Subject: Split md5 function. Signed-off-by: yzrh --- src/md5.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/md5.c (limited to 'src/md5.c') diff --git a/src/md5.c b/src/md5.c new file mode 100644 index 0000000..e5ab95e --- /dev/null +++ b/src/md5.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023, yzrh + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include + +int +strmd5(unsigned char **dst, int *dst_size, + const unsigned char * restrict src, int src_size) +{ + *dst_size = MD5_DIGEST_LENGTH; + *dst = malloc(*dst_size); + + if (*dst == NULL) + return 1; + + MD5(src, src_size, *dst); + + return 0; +} -- cgit v1.2.3