• Ubuntu20.04配置Intel SGX


    一、安装linux-sgx-driver

    克隆linux-sgx-driver项目

    git clone https://github.com/intel/linux-sgx-driver.git
    
    • 1

    检查是否安装匹配的内核头文件

    dpkg-query -s linux-headers-$(uname -r)
    
    • 1

    安装匹配的内核头文件

    sudo apt-get install linux-headers-$(uname -r)
    
    • 1

    构建linux-sgx驱动

    # 进入项目目录
    cd linux-sgx-driver
    # 编译
    make
    
    • 1
    • 2
    • 3
    • 4

    安装linux-sgx驱动

    sudo mkdir -p "/lib/modules/"`uname -r`"/kernel/drivers/intel/sgx"    
    sudo cp isgx.ko "/lib/modules/"`uname -r`"/kernel/drivers/intel/sgx"    
    sudo sh -c "cat /etc/modules | grep -Fxq isgx || echo isgx >> /etc/modules"    
    sudo /sbin/depmod
    sudo /sbin/modprobe isgx
    
    • 1
    • 2
    • 3
    • 4
    • 5

    检查是否已经安装成功

    lsmod | grep isgx
    
    • 1

    二、安装SGX SDK

    安装SDK所需的工具(以ubuntu 20.04或ubuntu22.04为例)

    sudo apt-get install build-essential ocaml ocamlbuild automake autoconf libtool wget python-is-python3 libssl-dev git cmake perl
    
    • 1

    安装PSW所需的工具(以ubuntu 20.04或ubuntu22.04为例)

    sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper cmake reprepro unzip pkgconf libboost-dev libboost-system-dev libboost-thread-dev lsb-release libsystemd0
    
    • 1

    克隆linux-sgx项目

    git clone https://github.com/intel/linux-sgx.git
    
    • 1

    准备子模块和预构建的二进制文件

    cd linux-sgx && make preparation
    
    • 1

    将与当前操作系统发行版对应的缓解工具从 external/toolset/{current_distr} 复制到 /usr/local/bin,并确保它们具有执行权限

    sudo cp external/toolset/{current_distr}/* /usr/local/bin
    # 以ubuntu20.04为例
    sudo cp external/toolset/ubuntu20.04/* /usr/local/bin
    # 检查是否复制成功
    which ar as ld objcopy objdump ranlib
    
    • 1
    • 2
    • 3
    • 4
    • 5

    使用默认配置构建 SGX SDK

    make sdk
    
    • 1

    构建SGX SDK安装程序

    make sdk_install_pkg
    
    • 1

    调用安装程序

    # 在项目的根目录下运行
    cd linux/installer/bin
    ./sgx_linux_x64_sdk_${version}.bin
    # 运行时按照以下内容进行
    # Do you want to install in current directory? [yes/no] : no
    # please input the directory which you want to install in : /opt/intel/
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    三、安装SGX PSW

    使用默认配置构建SGX PSW

    make psw
    make psw_install_pkg
    
    • 1
    • 2

    在相应文件夹中使用make命令构建每个Architecture Enclave

    cd psw/ae/le
    make
    
    • 1
    • 2

    调用安装程序

    # 在项目的根目录下运行
    cd linux/installer/bin
    ./sgx_linux_x64_psw_${version}.bin
    
    • 1
    • 2
    • 3

    SGX PSW提供 3 个服务:启动、基于EPID的证明和算法无关的证明。从 2.8 版本开始,SGX PSW被拆分成较小的包,用户可以选择安装哪些功能和服务。安装所需的软件包有两种方法:使用单独的软件包或使用构建系统生成的本地仓库。推荐使用本地仓库,因为系统会自动解决依赖关系。

    在安装前,首先执行以下三条命令

    # 将以下库添加到源中
    echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
    # 获取 Debian 存储库公钥并将其添加到 apt 用于验证软件包的受信任密钥列表中
    wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add
    # 更新apt
    sudo apt-get update
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    然后,运行以下命令安装对应的服务

     sudo apt-get install libsgx-launch libsgx-urts
     sudo apt-get install libsgx-epid libsgx-urts
     sudo apt-get install libsgx-quote-ex libsgx-urts
     sudo apt-get install libsgx-dcap-ql
    
    • 1
    • 2
    • 3
    • 4
  • 相关阅读:
    String类型函数传递问题
    Android Platform Architecture 安卓平台架构
    解决Java异常java.sql.SQLException: Unexpected exception encountered during query.
    自学软件测试必备的英文单词【1500道加语法】
    pdf提取其中一页,怎么实现?
    缓存P27,28,29
    零基础新手也能会的H5邀请函制作教程
    2022/8/16 考试总结
    第一周 改善深层神经网络—初始化、正则化、梯度校验(1 & 2 & 3)
    vue中如何给后端过来的数组中每一个对象加一个新的属性和新的对象(不影响后端的原始数据)
  • 原文地址:https://blog.csdn.net/cacique111/article/details/133246169