aboutsummaryrefslogblamecommitdiffstats
path: root/src/md5.c
blob: e5ab95e8269867c79150440360478922b852c9f7 (plain) (tree)























                                                         
/*
 * Copyright (c) 2023, yzrh <yzrh@noema.org>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdlib.h>

#include <openssl/md5.h>

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;
}