doxygen

/**
* sgx - wasm
* @param task_buf ciphertext which include private key of transaction || wasm bytecode
* @param task_buf length of ciphertext and wasm bytecode
* @param result_buf result buffer provided
* @param result_size length of result buffer provided
* @return Upon successful completion, the actual length of result_buf is returned.
* Otherwise, a value of -length of result is returned, while result_buf is filled with error messages.
*/
ssize_t ecall_wasm(const void *task_buf, size_t task_size, uint8_t *result_buf, size_t result_size);


/**
*
* @param out attestation with ecdhe public key
* @param out_length length of out buffer
* @param nonce [in] addr of nonce
* @param nonce_length [in] length of nonce
* @return Upon successful completion, the actual length of out buffer is returned.
* Otherwise, return a negative value as error code.
*/
ssize_t ecall_attest(uint8_t * out, size_t out_length, const void *nonce, size_t nonce_length);


/**
*
* @param out sm2 signature (asn1) compatible with go
* @param out_length length of out buffer
* @param key [in] addr of sm2 private key
* @param key_length [in] length of key
* @param hash [in] addr of pre-processed sm3 hash of message
* @param hash_length [in] length of hash
* @return Upon successful completion, the actual length of out buffer is returned.
* Otherwise, return a negative value as error code.
*/
static int sm2_sign(void *out, size_t out_length, const void *key, size_t key_length = 32,
const void *hash, size_t hash_length = 32);

/**
*
* @param out plain text
* @param out_length length of out buffer
* @param key [in] addr of sm2 private key
* @param key_length [in] length of key
* @param ciphertext [in] sm2 ciphertext c1||c3||c2
* @param ciphertext_length [in] length of ciphertext
* @return
*/
static int sm2_decrypt(void *out, size_t out_length, const void *key, size_t key_length = 32,
const void *ciphertext, size_t ciphertext_length);

#include "limits.h"
#include "stdint.h"
INT32_MAX
posted @ 2021-12-02 13:48  zJanly  阅读(75)  评论(0编辑  收藏  举报