/**
 * @file       provisioning.h
 * @brief      API to create or derive PA certificate
 * @author     Ivan Vorobiov (i.vorobiov@samsung.com)
 * @version    1.0
 * @date       Created Sep 8, 2016
 * @copyright  In Samsung Ukraine R&D Center (SURC) under a contract between
 * @copyright  LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
 * @copyright  "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 * @copyright  Copyright: (c) Samsung Electronics Co, Ltd 2016. All rights reserved.
**/

#ifndef PA_TZ_DRV_PROVISIONING_H_
#define PA_TZ_DRV_PROVISIONING_H_

#include "memory.h"
#include "pa_tz_api.h"
#include "task.h"

/**
 * @brief Create new certificate for APK signed by HMAC
 * @warning \a new_certificate should be freed using function ::PaCertificateDestroy
 * @param [in] issuer Task of NWd application that called this API (issuer)
 * @param [in] mapped_apk Virtual address of mapped APK file in NWd (file can be mapped not whole)
 * @param [in] package_name Package name of APK (NULL-terminated)
 * @param [in] rsa,rsa_size Public RSA key of APK
 * @param [out] new_certificate PA certificate of \a mapped_apk
 * @return ::PA_TZ_SUCCESS in case of success, ::PA_TZ_GENERAL_ERROR
 */
PaTzResult CreateNewCertificate(
    const TaskInfo *issuer,
    ProcessAddress mapped_apk,
    const char *package_name,
    const uint8_t *rsa, size_t rsa_size,
    PaCertificate_t **new_certificate);

#endif // PA_TZ_DRV_PROVISIONING_H_
