当前位置:网站首页>Intel SGX开发入门
Intel SGX开发入门
2022-04-22 05:40:00 【Q446512799】
sgx定义文件*.edl
enclave {
/*引用外部.edl*/
from "sgx_tstdc.edl" import *;
/*安全区函数接口定义*/
trusted {
public int sgx_sdkinit([in,size=iplen] unsigned char *ip,size_t iplen,[in,size=portlen] unsigned char *port, size_t portlen);
};
/*非安全区函数接口定义*/
untrusted {
void ocall_print_string([in, string] const char *str);
};
};
初始化安全区
//ENCLAVE_FILE为安全动态库,可使用绝对路径
sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &token_updated, &eid, NULL);
释放安全区
sgx_destroy_enclave(eid);
安全区函数调用
//有返回值的char *类型,对应的长度要传入字符串真实sizeof长度,如传入0则在sgx中未申请空间变为NULL
sgx_sdkinit(eid,&i_ret,ip,iplen,port,portlen);
芯片真随机数及密封密钥加解密
sgx_read_rand 随机数
sgx_read_rand(buf, buflen);
sgx_seal_data 密封密钥加密
sgx_seal_data(0, NULL, key_len, key_buf, seal_len, (sgx_sealed_data_t*)seal_data);
sgx_unseal_data 密封密钥解密
sgx_unseal_data((sgx_sealed_data_t*)seal_data, NULL, NULL, unseal_key, &len);
版权声明
本文为[Q446512799]所创,转载请带上原文链接,感谢
https://blog.csdn.net/woailp___2005/article/details/123331997
边栏推荐
- LeetCode 2044. Count the number of subsets that can get the maximum value by bit -- depth traversal
- meilisearch使用记录
- 蓝桥杯冲刺——DFS
- golang 合并两个有序的数组(笔试题)
- 16 - 容器综合训练
- 蓝桥杯31天冲刺 Day18
- Root cause: the package import downloaded by the PIP terminal cannot be used
- LeetCode 2049. Count the number of nodes with the highest score -- traversal of the tree
- STM32学习笔记3——GPIO的输入引脚
- Chenchen picks herbs
猜你喜欢

TCGA downloads RNA SEQ data from GBM patients

geojson文件shapefile文件 批量 互转 小工具

Alist easy to use guide

苹果 CMS 搭建视频网站,定时采集视频

Blue Bridge Cup 31 day sprint Day8

软件测试分类

08 - 程序的输入和输出

LeetCode 1770. Maximum score for performing multiplication -- interval DP

LeetCode 2049. Count the number of nodes with the highest score -- traversal of the tree

蓝桥杯冲刺——并查集
随机推荐
16 - 容器综合训练
Matrix multiplication implementation
08 - 程序的输入和输出
软件测试分类
06-数据类型
蓝桥杯31天冲刺 Day18
由浅入深:小白爬虫学习之旅(1)
Chenchen picks herbs
15 - 容器 - 字典
Two ways of JS array value
C language -- classic 100 questions
Dynamically create array (c6385 reading invalid data from 'a')
golang 计算天数 四舍五入 time
11 - process control - for loop
Pytorch environment preparation
写一篇关于ddt数据驱动的自动化测试
Judge whether the linked list has a ring (Set & speed pointer)
蓝桥杯冲刺——二进制枚举
05 - variables and identifiers
日常学习记录——解决graphviz中文乱码问题