<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Some additional info - I in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160338#M2836</link>
    <description>&lt;P&gt;Some additional info - I reran the ./configure script as ./configure --with-pic --enable-crypto --enable-dotnet --enable-magic --enable-cuckoo --with-crypto&amp;nbsp; to include "--with-pic".&amp;nbsp; Yara, of course compiled, but when attempting to link libyara.a using the given makefile, additional errors were produced. A snapshot of those errors, below seems to indicate basic c standard library are no longer locatable in the libyara object files.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;make SGX_DEBUG=1 SGX_MODE=SIM -f sgx/Makefile all &amp;nbsp;&lt;BR /&gt;make -C ./sgx/enclave_Intrusions_Enclave&amp;nbsp; -f sgx_u.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; untrusted/Intrusions_Enclave_u.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/Intrusions_Enclave_u.c&lt;BR /&gt;CXX&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/sample.c&lt;BR /&gt;LINK =&amp;gt;&amp;nbsp; sample&lt;BR /&gt;make[1]: Leaving directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;make -C ./sgx/enclave_Intrusions_Enclave&amp;nbsp;&amp;nbsp;&amp;nbsp; -f sgx_t.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; trusted/Intrusions_Enclave_t.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/Intrusions_Enclave_t.c&lt;BR /&gt;CC&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/Intrusions_Enclave.c&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yara_yyfatal':&lt;BR /&gt;lexer.c:(.text+0x819): undefined reference to `longjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yara_yylex':&lt;BR /&gt;lexer.c:(.text+0x15db): undefined reference to `stdin'&lt;BR /&gt;lexer.c:(.text+0x15eb): undefined reference to `stdout'&lt;BR /&gt;lexer.c:(.text+0x18f4): undefined reference to `strtoll'&lt;BR /&gt;lexer.c:(.text+0x19a7): undefined reference to `strtod'&lt;BR /&gt;lexer.c:(.text+0x19eb): undefined reference to `strtoll'&lt;BR /&gt;lexer.c:(.text+0x1a23): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1ad2): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1aea): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1b02): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1e9e): undefined reference to `fwrite'&lt;BR /&gt;lexer.c:(.text+0x2479): undefined reference to `__isoc99_sscanf'&lt;BR /&gt;lexer.c:(.text+0x29d5): undefined reference to `_IO_getc'&lt;BR /&gt;lexer.c:(.text+0x2a0b): undefined reference to `ferror'&lt;BR /&gt;lexer.c:(.text+0x2b5a): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2b9f): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2bb3): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2c75): undefined reference to `snprintf'&lt;BR /&gt;lexer.c:(.text+0x2d05): undefined reference to `strrchr'&lt;BR /&gt;lexer.c:(.text+0x2f15): undefined reference to `ferror'&lt;BR /&gt;lexer.c:(.text+0x2f4e): undefined reference to `clearerr'&lt;BR /&gt;lexer.c:(.text+0x2f86): undefined reference to `fread'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_string':&lt;BR /&gt;lexer.c:(.text+0x30db): undefined reference to `_setjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_file':&lt;BR /&gt;lexer.c:(.text+0x31bb): undefined reference to `_setjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_fd':&lt;BR /&gt;lexer.c:(.text+0x3260): undefined reference to `_setjmp'&lt;BR /&gt;lexer.c:(.text+0x328f): undefined reference to `__fxstat'&lt;BR /&gt;lexer.c:(.text+0x32e4): undefined reference to `read'&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;etc....&lt;/P&gt;&lt;P&gt;These appear to be C library functions that the Yara baseline code is not finding e.g., (pe_utils.c:(.text+0x54c): undefined reference to `sprintf') when linked into SGX C libraries.&amp;nbsp; Does this mean I'd have to attempt to recompile the Yara using the SGX C libraries?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Nov 2018 16:28:42 GMT</pubDate>
    <dc:creator>Harris__David</dc:creator>
    <dc:date>2018-11-19T16:28:42Z</dc:date>
    <item>
      <title>Running Yara rules using C-API in SGX enclave</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160337#M2835</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to see if I can run memory-resident Yara rule-matching (C-API) functions in the SGX enclave.&amp;nbsp; I'm getting the following linking errors that seem to indicate I need to recompile the Yara baseline as position-independent code before it will link to the enclave code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;++++++++++++++++++++&lt;/P&gt;&lt;P&gt;11:34:02 **** Build of configuration Intel(R) SGX Simulation Debug for project non_sgx_empty_proj ****&lt;BR /&gt;make SGX_DEBUG=1 SGX_MODE=SIM -f sgx/Makefile all&lt;BR /&gt;make -C ./sgx/enclave_yara_enclave&amp;nbsp; -f sgx_u.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/developer/eclipse-workspace/non_sgx_empty_proj/sgx/enclave_yara_enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; untrusted/yara_enclave_u.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/yara_enclave_u.c&lt;BR /&gt;CXX&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/sample.c&lt;BR /&gt;LINK =&amp;gt;&amp;nbsp; sample&lt;BR /&gt;make[1]: Leaving directory `/home/developer/eclipse-workspace/non_sgx_empty_proj/sgx/enclave_yara_enclave'&lt;BR /&gt;make -C ./sgx/enclave_yara_enclave&amp;nbsp;&amp;nbsp;&amp;nbsp; -f sgx_t.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/developer/eclipse-workspace/non_sgx_empty_proj/sgx/enclave_yara_enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; trusted/yara_enclave_t.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/yara_enclave_t.c&lt;BR /&gt;CC&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/yara_enclave.c&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(tests.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(pe.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(elf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(math.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(time.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(pe_utils.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(cuckoo.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(magic.o): relocation R_X86_64_32S against undefined hidden symbol `cached_mime_types' can not be used when making a shared object&lt;BR /&gt;make[1]: Leaving directory `/home/developer/eclipse-workspace/non_sgx_empty_proj/sgx/enclave_yara_enclave'&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(hash.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(dotnet.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(grammar.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(ahocorasick.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(arena.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(atoms.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(bitmask.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(compiler.o): relocation R_X86_64_32 against hidden symbol `yr_object_destroy' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(exec.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(lt1-hash.o): relocation R_X86_64_32S against hidden symbol `byte_to_int32' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(hex_grammar.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(hex_lexer.o): relocation R_X86_64_32 against undefined hidden symbol `yr_recovery_state_key' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(lexer.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(libyara.o): relocation R_X86_64_32S against undefined hidden symbol `yr_altercase' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(modules.o): relocation R_X86_64_32 against hidden symbol `yr_modules_table' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(object.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(parser.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(proc.o): relocation R_X86_64_32S against symbol `yr_process_get_first_memory_block' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(re.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(re_grammar.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(re_lexer.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(rules.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(scan.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(scanner.o): relocation R_X86_64_32S against undefined hidden symbol `exc_jmp_buf' can not be used when making a shared object&lt;BR /&gt;/usr/bin/ld: /usr/local/lib/libyara.a(linux.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;/usr/bin/ld: final link failed: Nonrepresentable section on output&lt;BR /&gt;collect2: error: ld returned 1 exit status&lt;BR /&gt;make[1]: *** [yara_enclave.so] Error 1&lt;BR /&gt;make: *** [all] Error 2&lt;/P&gt;&lt;P&gt;11:34:02 Build Failed. 36 errors, 0 warnings. (took 369ms)&lt;/P&gt;&lt;P&gt;++++++++++++++++&lt;/P&gt;&lt;P&gt;The auto-generated makefile I'm using is below - what I added is in bold:&lt;/P&gt;&lt;P&gt;*********************************************************************************************&lt;/P&gt;&lt;P&gt;######## Intel(R) SGX SDK Settings ########&lt;BR /&gt;SGX_SDK ?= /opt/intel/sgxsdk&lt;BR /&gt;SGX_MODE ?= SIM&lt;BR /&gt;SGX_ARCH ?= x64&lt;/P&gt;&lt;P&gt;ifeq ($(shell getconf LONG_BIT), 32)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_ARCH := x86&lt;BR /&gt;else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_ARCH := x86&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;ifeq ($(SGX_ARCH), x86)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_COMMON_CFLAGS := -m32&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_LIBRARY_PATH := $(SGX_SDK)/lib&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r&lt;BR /&gt;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_COMMON_CFLAGS := -m64&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_LIBRARY_PATH := $(SGX_SDK)/lib64&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;ifeq ($(SGX_DEBUG), 1)&lt;BR /&gt;ifeq ($(SGX_PRERELEASE), 1)&lt;BR /&gt;$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!)&lt;BR /&gt;endif&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;ifeq ($(SGX_DEBUG), 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SGX_COMMON_CFLAGS += -O0 -g&lt;BR /&gt;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SGX_COMMON_CFLAGS += -O2&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;ifneq ($(SGX_MODE), HW)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Trts_Library_Name := sgx_trts_sim&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Service_Library_Name := sgx_tservice_sim&lt;BR /&gt;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Trts_Library_Name := sgx_trts&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Service_Library_Name := sgx_tservice&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;Crypto_Library_Name := sgx_tcrypto&lt;/P&gt;&lt;P&gt;Yara_enclave_C_Files := trusted/yara_enclave.c&lt;BR /&gt;Yara_enclave_Include_Paths := -IInclude -Itrusted -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx &lt;STRONG&gt;-I/usr/local/include&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11&lt;BR /&gt;Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Yara_enclave_Include_Paths) -fno-builtin-printf -I.&lt;BR /&gt;Yara_enclave_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Yara_enclave_Link_Flags &lt;/STRONG&gt;:= $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,--start-group -lsgx_tstdc -lsgx_tcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,-pie,-eenclave_entry -Wl,--export-dynamic&amp;nbsp; \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,--defsym,__ImageBase=0 \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,--version-script=trusted/yara_enclave.lds \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;-L/usr/local/lib \&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-Wl,--whole-archive -lyara&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Yara_enclave_C_Objects := $(Yara_enclave_C_Files:.c=.o)&lt;/P&gt;&lt;P&gt;ifeq ($(SGX_MODE), HW)&lt;BR /&gt;ifneq ($(SGX_DEBUG), 1)&lt;BR /&gt;ifneq ($(SGX_PRERELEASE), 1)&lt;BR /&gt;Build_Mode = HW_RELEASE&lt;BR /&gt;endif&lt;BR /&gt;endif&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;.PHONY: all run&lt;/P&gt;&lt;P&gt;ifeq ($(Build_Mode), HW_RELEASE)&lt;BR /&gt;all: yara_enclave.so&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "Build enclave yara_enclave.so [$(Build_Mode)|$(SGX_ARCH)] success!"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "*********************************************************************************************************************************************************"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "PLEASE NOTE: In this mode, please sign the yara_enclave.so first using Two Step Sign mechanism before you run the app to launch and access the enclave."&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "*********************************************************************************************************************************************************"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo&lt;BR /&gt;else&lt;BR /&gt;all: yara_enclave.signed.so&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;run: all&lt;BR /&gt;ifneq ($(Build_Mode), HW_RELEASE)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@$(CURDIR)/app&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "RUN&amp;nbsp; =&amp;gt;&amp;nbsp; app [$(SGX_MODE)|$(SGX_ARCH), OK]"&lt;BR /&gt;endif&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;######## yara_enclave Objects ########&lt;/P&gt;&lt;P&gt;trusted/yara_enclave_t.c: $(SGX_EDGER8R) ./trusted/yara_enclave.edl&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@cd ./trusted &amp;amp;&amp;amp; $(SGX_EDGER8R) --trusted ../trusted/yara_enclave.edl --search-path ../trusted --search-path $(SGX_SDK)/include&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "GEN&amp;nbsp; =&amp;gt;&amp;nbsp; $@"&lt;/P&gt;&lt;P&gt;trusted/yara_enclave_t.o: ./trusted/yara_enclave_t.c&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@$(CC) $(Yara_enclave_C_Flags) -c $&amp;lt; -o $@&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; $&amp;lt;"&lt;/P&gt;&lt;P&gt;trusted/%.o: trusted/%.c&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@$(CC) $(Yara_enclave_C_Flags) -c $&amp;lt; -o $@&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "CC&amp;nbsp; &amp;lt;=&amp;nbsp; $&amp;lt;"&lt;/P&gt;&lt;P&gt;yara_enclave.so: trusted/yara_enclave_t.o $(Yara_enclave_C_Objects)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@$(CXX) $^ -o $@ $(Yara_enclave_Link_Flags)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "LINK =&amp;gt;&amp;nbsp; $@"&lt;/P&gt;&lt;P&gt;yara_enclave.signed.so: yara_enclave.so&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@$(SGX_ENCLAVE_SIGNER) sign -key trusted/yara_enclave_private.pem -enclave yara_enclave.so -out $@ -config trusted/yara_enclave.config.xml&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@echo "SIGN =&amp;gt;&amp;nbsp; $@"&lt;BR /&gt;clean:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@rm -f yara_enclave.* trusted/yara_enclave_t.*&amp;nbsp; $(Yara_enclave_C_Objects)&lt;/P&gt;&lt;P&gt;**************************************************************************************************************&lt;/P&gt;&lt;P&gt;Just wondering, short of recompiling Yara as position-independent code, whether there's another change I need to make in the makefile to compile Yara into the enclave code.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 17:03:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160337#M2835</guid>
      <dc:creator>Harris__David</dc:creator>
      <dc:date>2018-11-18T17:03:05Z</dc:date>
    </item>
    <item>
      <title>Some additional info - I</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160338#M2836</link>
      <description>&lt;P&gt;Some additional info - I reran the ./configure script as ./configure --with-pic --enable-crypto --enable-dotnet --enable-magic --enable-cuckoo --with-crypto&amp;nbsp; to include "--with-pic".&amp;nbsp; Yara, of course compiled, but when attempting to link libyara.a using the given makefile, additional errors were produced. A snapshot of those errors, below seems to indicate basic c standard library are no longer locatable in the libyara object files.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;make SGX_DEBUG=1 SGX_MODE=SIM -f sgx/Makefile all &amp;nbsp;&lt;BR /&gt;make -C ./sgx/enclave_Intrusions_Enclave&amp;nbsp; -f sgx_u.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; untrusted/Intrusions_Enclave_u.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/Intrusions_Enclave_u.c&lt;BR /&gt;CXX&amp;nbsp; &amp;lt;=&amp;nbsp; untrusted/sample.c&lt;BR /&gt;LINK =&amp;gt;&amp;nbsp; sample&lt;BR /&gt;make[1]: Leaving directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;make -C ./sgx/enclave_Intrusions_Enclave&amp;nbsp;&amp;nbsp;&amp;nbsp; -f sgx_t.mk all;&lt;BR /&gt;make[1]: Entering directory `/home/dave/eclipse-workspace/SGX_Proj2/sgx/enclave_Intrusions_Enclave'&lt;BR /&gt;GEN&amp;nbsp; =&amp;gt;&amp;nbsp; trusted/Intrusions_Enclave_t.c&lt;BR /&gt;CC&amp;nbsp;&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/Intrusions_Enclave_t.c&lt;BR /&gt;CC&amp;nbsp; &amp;lt;=&amp;nbsp; trusted/Intrusions_Enclave.c&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yara_yyfatal':&lt;BR /&gt;lexer.c:(.text+0x819): undefined reference to `longjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yara_yylex':&lt;BR /&gt;lexer.c:(.text+0x15db): undefined reference to `stdin'&lt;BR /&gt;lexer.c:(.text+0x15eb): undefined reference to `stdout'&lt;BR /&gt;lexer.c:(.text+0x18f4): undefined reference to `strtoll'&lt;BR /&gt;lexer.c:(.text+0x19a7): undefined reference to `strtod'&lt;BR /&gt;lexer.c:(.text+0x19eb): undefined reference to `strtoll'&lt;BR /&gt;lexer.c:(.text+0x1a23): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1ad2): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1aea): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1b02): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x1e9e): undefined reference to `fwrite'&lt;BR /&gt;lexer.c:(.text+0x2479): undefined reference to `__isoc99_sscanf'&lt;BR /&gt;lexer.c:(.text+0x29d5): undefined reference to `_IO_getc'&lt;BR /&gt;lexer.c:(.text+0x2a0b): undefined reference to `ferror'&lt;BR /&gt;lexer.c:(.text+0x2b5a): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2b9f): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2bb3): undefined reference to `strstr'&lt;BR /&gt;lexer.c:(.text+0x2c75): undefined reference to `snprintf'&lt;BR /&gt;lexer.c:(.text+0x2d05): undefined reference to `strrchr'&lt;BR /&gt;lexer.c:(.text+0x2f15): undefined reference to `ferror'&lt;BR /&gt;lexer.c:(.text+0x2f4e): undefined reference to `clearerr'&lt;BR /&gt;lexer.c:(.text+0x2f86): undefined reference to `fread'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_string':&lt;BR /&gt;lexer.c:(.text+0x30db): undefined reference to `_setjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_file':&lt;BR /&gt;lexer.c:(.text+0x31bb): undefined reference to `_setjmp'&lt;BR /&gt;/usr/local/lib/libyara.a(lexer.o): In function `yr_lex_parse_rules_fd':&lt;BR /&gt;lexer.c:(.text+0x3260): undefined reference to `_setjmp'&lt;BR /&gt;lexer.c:(.text+0x328f): undefined reference to `__fxstat'&lt;BR /&gt;lexer.c:(.text+0x32e4): undefined reference to `read'&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;etc....&lt;/P&gt;&lt;P&gt;These appear to be C library functions that the Yara baseline code is not finding e.g., (pe_utils.c:(.text+0x54c): undefined reference to `sprintf') when linked into SGX C libraries.&amp;nbsp; Does this mean I'd have to attempt to recompile the Yara using the SGX C libraries?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 16:28:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160338#M2836</guid>
      <dc:creator>Harris__David</dc:creator>
      <dc:date>2018-11-19T16:28:42Z</dc:date>
    </item>
    <item>
      <title>David, happy to chat and see</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160339#M2837</link>
      <description>&lt;P&gt;David, happy to chat and see if we can be helpful with it. yan@anjuna.io.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 18:10:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160339#M2837</guid>
      <dc:creator>Michalevsky__Yan</dc:creator>
      <dc:date>2018-11-19T18:10:45Z</dc:date>
    </item>
    <item>
      <title>Thanks, Yan.  I may take you</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160340#M2838</link>
      <description>&lt;P&gt;Thanks, Yan.&amp;nbsp; I may take you up on that.&amp;nbsp; I've been reading up on the GNU build process the Yara baseline and optional tools use and am thinking about adding something that will recognize and point to an actual or default SGX baseline in the configure.ac or Makefile.am files.&amp;nbsp; Still working out where that belongs in the build tool chain. I may have to generate some kind of file that will become OCALL stubs in an edl for Yara-related calls not supported by SGX.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 21:26:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Running-Yara-rules-using-C-API-in-SGX-enclave/m-p/1160340#M2838</guid>
      <dc:creator>Harris__David</dc:creator>
      <dc:date>2018-11-20T21:26:00Z</dc:date>
    </item>
  </channel>
</rss>

