/*
 *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may
 *  not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *
 */
#ifndef MD5_ALT_H
#define MD5_ALT_H

#ifdef __cplusplus
extern "C" {
#endif

#if defined(MBEDTLS_MD5_ALT)
#include "esp_md5.h"

typedef esp_md5_context_t mbedtls_md5_context;

#define mbedtls_md5_init(_ctx)                     { }

#define mbedtls_md5_free(_ctx)                     { }

#define mbedtls_md5_clone(_d, _s)                  { *(_d) = *(_s); }

#define mbedtls_md5_starts_ret(_ctx)               esp_md5_init(_ctx)

#define mbedtls_md5_update_ret(_ctx, _s, _l)       esp_md5_update(_ctx, _s, _l)

#define mbedtls_md5_finish_ret(_ctx, _d)           esp_md5_final(_ctx, _d)

#define mbedtls_internal_md5_process(_ctx, _s)     esp_md5_update(_ctx, _s, 64)
#endif /* MBEDTLS_MD5_ALT */

#ifdef __cplusplus
}
#endif

#endif

