/*
 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Created in Samsung Ukraine R&D Center (SRK) under a contract between
 * LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine)
 * and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 */

/**
 * @file MbedTlsExt.h
 * @brief TigerTa
 * @author Viktor Kopp (v.kopp@samsung.com)
 * @date Created Sep 16, 2016
 */

#ifndef MBEDTLSEXT_H_
#define MBEDTLSEXT_H_

#include <mbedtls/rsa.h>

/**
 * @brief Random generator function used by most of mbedtls functions which require rng function pointer
 * @param[in] CTR_DRBG context.
 * @param[out] Buffer to fill.
 * @param[in] Length of the buffer.
 * @return Status of operation.
 */
int tigerMbedtlsRng(void* pRng, unsigned char* output, size_t outputLen);

/**
 * @brief Extended rsapss signature algorithm function with possibility to assign arbitrary salt length
 */
int tigerMbedtlsRsaRsassaPssSign( mbedtls_rsa_context *ctx,
                         int (*f_rng)(void *, unsigned char *, size_t),
                         void *p_rng,
                         int mode,
                         mbedtls_md_type_t md_alg,
                         unsigned int hashlen,
                         const unsigned char *hash,
                         int salt_len,
                         unsigned char *sig );

#endif /* MBEDTLSEXT_H_ */
