104 lines
3.4 KiB
C
104 lines
3.4 KiB
C
// Copyright (C) 2023 Amlogic, Inc. All rights reserved.
|
|
//
|
|
// All information contained herein is Amlogic confidential.
|
|
//
|
|
// This software is provided to you pursuant to Software License
|
|
// Agreement (SLA) with Amlogic Inc ("Amlogic"). This software may be
|
|
// used only in accordance with the terms of this agreement.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification is strictly prohibited without prior written permission
|
|
// from Amlogic.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#ifndef CLEAR_KEY_CRYPTO_H_
|
|
#define CLEAR_KEY_CRYPTO_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "clearkey_type.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief ClearKey_OpenSession
|
|
* @param session session id
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_INIT_FAILED</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_OpenSession(ClearKey_SESSION *session);
|
|
|
|
/**
|
|
* @brief ClearKey_CloseSession
|
|
* @param session session id
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_UNKNOWN_FAILURE</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_CloseSession(ClearKey_SESSION session);
|
|
|
|
/**
|
|
* @brief getkeyrequest
|
|
* @param initData InitData
|
|
* @param len InitData Size
|
|
* @param licenseRequest Return json Request
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_UNKNOWN_FAILURE</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_GetKeyRequest(const uint8_t *initData,
|
|
uint32_t len,
|
|
char **licenseRequest);
|
|
/**
|
|
* @brief ClearKey_provideKeyResponse
|
|
* @param session session id
|
|
* @param response response data
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_UNKNOWN_FAILURE</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_ProvideKeyResponse(ClearKey_SESSION session, const char *response);
|
|
|
|
/**
|
|
* @brief ClearKey_CopyBuffer
|
|
* @param session session id
|
|
* @param sample sample data, only UNENCRYPT mode
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_UNKNOWN_FAILURE</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_CopyBuffer(ClearKey_SESSION session,
|
|
const ClearKey_SampleDescription sample);
|
|
|
|
/**
|
|
* @brief ClearKey_Decrypt
|
|
* @param session session id
|
|
* @param sample sample data
|
|
* @return ClearKeyResult
|
|
* -<em>ClearKey_ERROR_UNKNOWN_FAILURE</em>
|
|
* -<em>ClearKey_SUCCESS</em> succeed
|
|
*/
|
|
ClearKeyResult ClearKey_Decrypt(ClearKey_SESSION session,
|
|
const ClearKey_SampleDescription sample);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CLEAR_KEY_CRYPTO_H_ */ |