├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── Makefile ├── README.md ├── client ├── CMakeLists.txt ├── Makefile ├── cert_verify_config.cpp ├── cert_verify_config.h └── client.cpp ├── common.cmake ├── common ├── CMakeLists.txt ├── block.cpp ├── block.h ├── bucket_sort.cpp ├── bucket_sort.h ├── cert_verifier.cpp ├── common.h ├── crypto.cpp ├── crypto.h ├── empty_client_pubkey.h ├── empty_server_pubkey.h ├── identity_verifier.cpp ├── json.hpp ├── load_balancer_client_enc_pubkey.h ├── load_balancer_server_enc_pubkey.h ├── log │ ├── CMakeLists.txt │ ├── log.cpp │ └── log.h ├── mbedtls_utility.cpp ├── mbedtls_utility.h ├── obl_primitives.h ├── openssl_utility.cpp ├── openssl_utility.h ├── par_obl_primitives.cpp ├── par_obl_primitives.h ├── protos │ └── oram.proto ├── ring_buffer.h ├── suboram_enc_pubkey.h ├── test_ring_buffer.cpp ├── tls_client_enc_pubkey.h ├── utility.cpp ├── utility.h └── verify_callback.cpp ├── config ├── client.config ├── lb_1.config ├── lb_10.config ├── lb_5.config └── suboram.config ├── experiments └── artifact_figures │ ├── artifact │ └── baselines.json │ ├── paper │ ├── balancers_vs_latency.dat │ ├── balancers_vs_throughput.dat │ ├── balancers_vs_throughput_bounded.dat │ ├── baselines.json │ ├── epoch_time.dat │ ├── micro_balancer_make_batch.dat │ ├── micro_balancer_match_resps.dat │ ├── micro_lb_make_batch.dat │ ├── micro_suboram.dat │ ├── micro_suboram_batch_sz.dat │ ├── parallel_legend.dat │ ├── params_alphas.dat │ ├── params_overheads.dat │ ├── params_scaling_capacity.dat │ ├── params_varying_N.dat │ ├── planner_config.dat │ ├── planner_cost.dat │ ├── planner_legend.dat │ ├── scale_breakdown.dat │ ├── scale_breakdown_1024.dat │ ├── scale_breakdown_1048576.dat │ ├── scale_breakdown_32768.dat │ ├── scale_breakdown_legend.dat │ ├── scale_data.dat │ ├── scale_throughput.dat │ ├── scale_throughput.dat_300 │ ├── scale_throughput.dat_500 │ ├── scale_throughput_redis.dat │ ├── scooby_oblix.dat │ ├── scooby_oblix.dat_300 │ ├── scooby_oblix.dat_500 │ ├── sort_parallel.dat │ ├── suboram_legend.dat │ ├── suboram_parallel.dat │ └── suborams_vs_latency.dat │ └── sample │ ├── 10a.png │ ├── 10b.png │ ├── 11a.png │ ├── 11b.png │ ├── 11c.png │ ├── 12a.png │ ├── 12b.png │ ├── 13.png │ ├── 14a.png │ ├── 14b.png │ └── 9.png ├── gen_mrenclave_header.sh ├── include └── intrinsics │ ├── adxintrin.h │ ├── ammintrin.h │ ├── avx2intrin.h │ ├── avx5124fmapsintrin.h │ ├── avx5124vnniwintrin.h │ ├── avx512bwintrin.h │ ├── avx512cdintrin.h │ ├── avx512dqintrin.h │ ├── avx512erintrin.h │ ├── avx512fintrin.h │ ├── avx512ifmaintrin.h │ ├── avx512ifmavlintrin.h │ ├── avx512pfintrin.h │ ├── avx512vbmiintrin.h │ ├── avx512vbmivlintrin.h │ ├── avx512vlbwintrin.h │ ├── avx512vldqintrin.h │ ├── avx512vlintrin.h │ ├── avx512vpopcntdqintrin.h │ ├── avxintrin.h │ ├── bmi2intrin.h │ ├── bmiintrin.h │ ├── bmmintrin.h │ ├── clflushoptintrin.h │ ├── clwbintrin.h │ ├── clzerointrin.h │ ├── emmintrin.h │ ├── f16cintrin.h │ ├── fma4intrin.h │ ├── fmaintrin.h │ ├── fxsrintrin.h │ ├── ia32intrin.h │ ├── immintrin.h │ ├── lwpintrin.h │ ├── lzcntintrin.h │ ├── mm_malloc.h │ ├── mmintrin.h │ ├── mwaitxintrin.h │ ├── nmmintrin.h │ ├── pkuintrin.h │ ├── pmmintrin.h │ ├── popcntintrin.h │ ├── prfchwintrin.h │ ├── rdseedintrin.h │ ├── rtmintrin.h │ ├── sgxintrin.h │ ├── shaintrin.h │ ├── smmintrin.h │ ├── tbmintrin.h │ ├── tmmintrin.h │ ├── wmmintrin.h │ ├── x86intrin.h │ ├── xmmintrin.h │ ├── xopintrin.h │ ├── xsavecintrin.h │ ├── xsaveintrin.h │ ├── xsaveoptintrin.h │ ├── xsavesintrin.h │ └── xtestintrin.h ├── load_balancer ├── CMakeLists.txt ├── Makefile ├── enc │ ├── .balancer.h.swp │ ├── CMakeLists.txt │ ├── Makefile │ ├── _log.h │ ├── balancer.cpp │ ├── balancer.h │ ├── cert_verify_config.cpp │ ├── cert_verify_config.h │ ├── ecalls.cpp │ ├── enc.conf │ ├── obl_primitives.cpp │ ├── openssl_server.cpp │ ├── private.pem │ ├── public.pem │ ├── test_balancer.cpp │ └── test_balancer.h ├── host │ ├── CMakeLists.txt │ ├── Makefile │ ├── host.cpp │ ├── host.h │ └── rpc.cpp └── load_balancer.edl ├── planner ├── bench │ ├── micro_balancer_make_batch.dat │ ├── micro_balancer_match_resps.dat │ └── micro_suboram_batch_sz.dat ├── planner.py ├── plannerBenchmark.py ├── scaleData.py ├── scale_throughput_config.dat └── scale_throughput_cost.dat ├── requirements.txt ├── scripts ├── balancer_benchmark.py ├── config │ ├── adaptiveDebug.json │ ├── adaptiveScaleThroughput.json │ ├── adaptiveScaleThroughputOblix.json │ ├── adaptiveScaleThroughputOblix_300.json │ ├── adaptiveScaleThroughputOblix_500.json │ ├── adaptiveScaleThroughput_300.json │ ├── adaptiveScaleThroughput_500.json │ ├── balancer.config │ ├── balancerMakeBatch.json │ ├── balancerMatchResponses.json │ ├── balancer_benchmark.config │ ├── basic.json │ ├── client.config │ ├── client2.config │ ├── lb.config │ ├── lb2.config │ ├── machines.json │ ├── my.cnf │ ├── scaleBatch.json │ ├── scaleData.json │ ├── scaleDataLatency.json │ ├── suboram.config │ ├── suboram2.config │ ├── suboramProcessBatch.json │ ├── suboramProcessBatchThreads.json │ ├── suboramSort.json │ ├── suboram_benchmark.config │ └── testScaleDataLatency.json ├── fig │ ├── balancers_vs_latency.py │ ├── balancers_vs_throughput.py │ ├── balancers_vs_throughput_bounded.py │ ├── baselines.json │ ├── config.py │ ├── custom_style.py │ ├── dumbo_figs.key │ ├── epoch_time.py │ ├── load_balancer.graffle │ ├── load_balancer.png │ ├── load_balancer_make_batches.graffle │ ├── load_balancer_match_resps.graffle │ ├── micro_balancer_make_batch.dat │ ├── micro_balancer_make_batch.py │ ├── micro_balancer_match_resps.dat │ ├── micro_balancer_match_resps.py │ ├── micro_suboram.py │ ├── micro_suboram_batch_sz.dat │ ├── parallel_legend.py │ ├── params_alphas.py │ ├── params_overheads.py │ ├── params_scaling_capacity.py │ ├── params_varying_N.py │ ├── planner_config.py │ ├── planner_cost.py │ ├── planner_legend.py │ ├── scale_breakdown.py │ ├── scale_breakdown_1024.py │ ├── scale_breakdown_1048576.py │ ├── scale_breakdown_32768.py │ ├── scale_breakdown_legend.py │ ├── scale_data.py │ ├── scale_throughput.py │ ├── scooby_oblix.py │ ├── sort_parallel.py │ ├── suboram.graffle │ ├── suboram_legend.py │ ├── suboram_new.graffle │ ├── suboram_parallel.py │ ├── suborams_vs_latency.py │ ├── system_architecture.graffle │ ├── system_steps.graffle │ ├── tufte.py │ └── util.py ├── figure11.sh ├── figure13.sh ├── figure14.sh ├── figure9.sh ├── get_baselines.py ├── obladi │ ├── config │ │ └── batch-500.json │ └── runExperiment.py ├── oblix │ ├── config │ │ ├── machines.json │ │ └── oblix_benchmark.json │ └── runExperiment.py ├── process_baselines.sh ├── provision_machines.sh ├── runExperiment.py ├── suboram_benchmark.py ├── update_config.py └── util_py3 │ ├── .ec2_util.py.swp │ ├── __init__.py │ ├── azure_util.py │ ├── ec2_util.py │ ├── graph_util.py │ ├── math_util.py │ ├── prop_util.py │ └── ssh_util.py └── suboram ├── CMakeLists.txt ├── Makefile ├── enc ├── CMakeLists.txt ├── Makefile ├── _log.h ├── cert_verify_config.cpp ├── cert_verify_config.h ├── ecalls.cpp ├── enc.conf ├── oblix_suboram.cpp ├── private.pem ├── public.pem ├── suboram.cpp └── suboram.h ├── host ├── CMakeLists.txt ├── Makefile ├── host.cpp ├── host.h └── oblix │ ├── RAMStore.cpp │ ├── RAMStore.hpp │ ├── RAMStoreEnclaveInterface.h │ ├── Utilities.cpp │ └── Utilities.h └── suboram.edl /.gitignore: -------------------------------------------------------------------------------- 1 | debug/ 2 | build/ 3 | *.pyc 4 | common/*mrenclave.h 5 | *.pdf 6 | *.pgf 7 | ssh_config 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/protobuf"] 2 | path = third_party/protobuf 3 | url = https://github.com/protocolbuffers/protobuf.git 4 | ignore = all 5 | [submodule "third_party/grpc"] 6 | path = third_party/grpc 7 | url = https://github.com/grpc/grpc.git 8 | ignore = all 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | cmake_minimum_required(VERSION 3.11) 5 | 6 | project("Attested TLS sample" LANGUAGES C CXX) 7 | set(CMAKE_CXX_STANDARD 11) 8 | 9 | find_package(OpenEnclave CONFIG REQUIRED) 10 | 11 | add_subdirectory(load_balancer) 12 | add_subdirectory(client) 13 | add_subdirectory(suboram) 14 | add_subdirectory(oblix) 15 | 16 | if ((NOT DEFINED ENV{OE_SIMULATION}) OR (NOT $ENV{OE_SIMULATION})) 17 | add_custom_target( 18 | run 19 | DEPENDS suboram client suboram_enc 20 | # COMMAND ${CMAKE_COMMAND} -E sleep 2 21 | # COMMENT 22 | # "Launch processes to establish an Attested TLS between an non-enclave TLS client and an TLS server running inside an enclave " 23 | COMMAND 24 | bash -c 25 | "${CMAKE_BINARY_DIR}/suboram/host/suboram_host ${CMAKE_BINARY_DIR}/suboram/enc/suboram_enc.signed -port:12346 -num_blocks:128 -server-in-loop &" 26 | # COMMAND ${CMAKE_COMMAND} -E sleep 2 27 | #COMMAND 28 | # bash -c 29 | # "${CMAKE_BINARY_DIR}/load_balancer/host/load_balancer_host ${CMAKE_BINARY_DIR}/load_balancer/enc/load_balancer_enc.signed -port:12345 -suboram_name:localhost -suboram_port:12346 -server-in-loop &" 30 | #COMMAND ${CMAKE_COMMAND} -E sleep 2 31 | # COMMAND ${CMAKE_BINARY_DIR}/client/client 32 | # -server:localhost -port:12345) 33 | endif () 34 | -------------------------------------------------------------------------------- /client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | #include(../cmake/common.cmake) 5 | 6 | find_package(OpenSSL REQUIRED) 7 | 8 | add_executable(client client.cpp cert_verify_config.cpp ../common/crypto.cpp 9 | ../common/verify_callback.cpp ../common/block.cpp) 10 | 11 | add_dependencies(client load_balancer_sign_enc) 12 | 13 | include_directories(${PROTOBUF_INCLUDE_DIRS} ${PROTO_GRPC_DIR} ${BOOST_DIR}) 14 | 15 | target_include_directories( 16 | client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} 17 | ${CMAKE_CURRENT_BINARY_DIR}) 18 | 19 | target_link_libraries(client 20 | openenclave::oehost 21 | OpenSSL::SSL 22 | log 23 | oram_grpc_proto 24 | ${_REFLECTION} 25 | ${_GRPC_GRPCPP} 26 | ${_PROTOBUF_LIBPROTOBUF}) 27 | 28 | add_dependencies(client load_balancer) 29 | -------------------------------------------------------------------------------- /client/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | include ../../config.mk 5 | 6 | .PHONY: all build clean run 7 | 8 | all: build 9 | 10 | CFLAGS=$(shell pkg-config oehost-$(C_COMPILER) --cflags) 11 | CXXFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --cflags) 12 | LDFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --libs) 13 | 14 | all: build 15 | 16 | build: 17 | $(CXX) -g -c $(CXXFLAGS) $(INCLUDES) -std=c++11 -I. -I/usr/include/openssl client.cpp cert_verify_config.cpp ../common/verify_callback.cpp ../common/crypto.cpp ../common/block.cpp 18 | $(CXX) -o client client.o cert_verify_config.o verify_callback.o crypto.o block.o config.o $(LDFLAGS) 19 | 20 | clean: 21 | rm -f client *.o ../cert.der 22 | 23 | run: 24 | ./client -server:localhost -port:12341 25 | -------------------------------------------------------------------------------- /client/cert_verify_config.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | #include "cert_verify_config.h" 4 | 5 | oe_result_t verify_claim_value(const oe_claim_t* claim) 6 | { 7 | oe_result_t result = OE_FAILURE; 8 | printf(TLS_ENCLAVE "\nverify unique_id:\n"); 9 | for (size_t i = 0; i < claim->value_size; i++) 10 | { 11 | printf("0x%x ", (uint8_t)claim->value[i]); 12 | if (SERVER_ENCLAVE_MRENCLAVE[i] != (uint8_t)claim->value[i]) 13 | { 14 | printf( 15 | TLS_ENCLAVE "\nunique_id[%lu] expected: 0x%0x found: 0x%0x ", 16 | i, 17 | SERVER_ENCLAVE_MRENCLAVE[i], 18 | (uint8_t)claim->value[i]); 19 | printf(TLS_ENCLAVE "failed: unique_id not equal\n"); 20 | goto exit; 21 | } 22 | } 23 | printf("\n" TLS_ENCLAVE "unique_id validation passed\n"); 24 | result = OE_OK; 25 | exit: 26 | return result; 27 | } 28 | -------------------------------------------------------------------------------- /client/cert_verify_config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef ATTLESTED_TLS_ENCLAVE_CONFIG 5 | #define ATTLESTED_TLS_ENCLAVE_CONFIG 6 | 7 | #include 8 | #include 9 | #include "../common/common.h" 10 | #include "../common/load_balancer_enc_mrenclave.h" 11 | #include "../common/load_balancer_server_enc_pubkey.h" 12 | #include "../common/empty_client_pubkey.h" 13 | #define TLS_ENCLAVE TLS_CLIENT 14 | 15 | oe_result_t verify_claim_value(const oe_claim_t* claim); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(PROTOS 2 | ${CMAKE_CURRENT_SOURCE_DIR}/protos/oram.proto 3 | ) 4 | set(PROTOS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/protos") 5 | set(PROTO_HDRS "${CMAKE_CURRENT_BINARY_DIR}/oram.pb.h") 6 | set(PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/oram.pb.cc") 7 | set(GRPC_SRCS "${CMAKE_CURRENT_BINARY_DIR}/oram.grpc.pb.cc") 8 | set(GRPC_HDRS "${CMAKE_CURRENT_BINARY_DIR}/oram.grpc.pb.h") 9 | add_custom_command( 10 | OUTPUT "${PROTO_SRCS}" "${PROTO_HDRS}" "${GRPC_SRCS}" "${GRPC_HDRS}" 11 | COMMAND ${_PROTOBUF_PROTOC} 12 | ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" 13 | --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" 14 | -I "${PROTOS_PATH}" 15 | --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" 16 | "${PROTOS}" 17 | DEPENDS "${PROTOS}") 18 | set(PROTO_SRCS ${PROTO_SRCS} PARENT_SCOPE) 19 | set(PROTO_HDRS ${PROTO_HDRS} PARENT_SCOPE) 20 | set(GRPC_SRCS ${GRPC_SRCS} PARENT_SCOPE) 21 | set(GRPC_HDRS ${GRPC_HDRS} PARENT_SCOPE) 22 | set(PROTO_GRPC_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) 23 | add_custom_target(protos DEPENDS ${PROTO_SRCS} ${PROTO_HDRS} ${GRPC_HDRS} ${GRPC_SRCS}) 24 | 25 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") 26 | add_library(oram_grpc_proto 27 | ${PROTO_SRCS} 28 | ${PROTO_HDRS} 29 | ${GRPC_HDRS} 30 | ${GRPC_SRCS}) 31 | 32 | target_link_libraries(oram_grpc_proto 33 | ${_REFLECTION} 34 | ${_GRPC_GRPCPP} 35 | ${_PROTOBUF_LIBPROTOBUF}) 36 | 37 | 38 | add_executable(test_ring_buffer test_ring_buffer.cpp) 39 | add_test_deps(test_ring_buffer) 40 | add_test(NAME test_ring_buffer COMMAND test_ring_buffer) 41 | -------------------------------------------------------------------------------- /common/bucket_sort.cpp: -------------------------------------------------------------------------------- 1 | #include "bucket_sort.h" 2 | 3 | namespace bs { 4 | std::mutex m; 5 | std::condition_variable cv; 6 | thread_state state; 7 | } 8 | 9 | BucketSortParams::BucketSortParams() : num_blocks(1), log_num_blocks(1), z(1), log_total_buckets(1), total_buckets(1), buf_size(1) {} 10 | 11 | BucketSortParams::BucketSortParams(int n) : num_blocks(n) { 12 | num_blocks = std::max(num_blocks, 1); 13 | log_num_blocks = log2(num_blocks); 14 | z = get_z(num_blocks); 15 | z = 1 << (int) ceil(log2(z)); 16 | //z = std::min(num_blocks, 65536); 17 | log_total_buckets = ceil(log2(num_blocks * 2 / z)); 18 | total_buckets = 1 << log_total_buckets; 19 | int log_buf_size = ceil(log2(16 * z + 1)); 20 | buf_size = 1 << log_buf_size; 21 | //buf_size = 1; 22 | printf("num blocks: %d, log_total_buckets: %d, z: %d, buf size: %zu\n", n, log_total_buckets, z, buf_size); 23 | } 24 | 25 | int BucketSortParams::get_z(int n) { 26 | if (n <= 1 << 8) { 27 | return 52; 28 | } else if (n <= 1 << 9) { 29 | return 61; 30 | } else if (n <= 1 << 10) { 31 | return 70; 32 | } else if (n <= 1 << 11) { 33 | return 78; 34 | } else if (n <= 1 << 12) { 35 | return 87; 36 | } else if (n <= 1 << 13) { 37 | return 95; 38 | } else if (n <= 1 << 14) { 39 | return 103; 40 | } else if (n <= 1 << 15) { 41 | return 112; 42 | } else if (n <= 1 << 16) { 43 | return 120; 44 | } else if (n <= 1 << 17) { 45 | return 129; 46 | } else if (n <= 1 << 18) { 47 | return 145; 48 | } else if (n <= 1 << 20) { 49 | return 154; 50 | } else if (n <= 1 << 21) { 51 | return 162; 52 | } else if (n <= 1 << 22) { 53 | return 171; 54 | } else if (n <= 1 << 23) { 55 | return 179; 56 | } else { 57 | return -1; 58 | } 59 | } 60 | 61 | void pin_host_thread() { 62 | cpu_set_t cpuset; 63 | CPU_ZERO(&cpuset); 64 | CPU_SET(0, &cpuset); 65 | int rc = sched_setaffinity(0, sizeof(cpuset), &cpuset); 66 | if (rc != 0) { 67 | std::cerr << "Error calling sched_setaffinity: " << rc << "\n"; 68 | } 69 | } -------------------------------------------------------------------------------- /common/cert_verifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "cert_verify_config.h" 15 | #include "utility.h" 16 | 17 | oe_result_t enclave_claims_verifier_callback_server( 18 | oe_claim_t* claims, 19 | size_t claims_length, 20 | void* arg); 21 | 22 | oe_result_t enclave_claims_verifier_callback_client( 23 | oe_claim_t* claims, 24 | size_t claims_length, 25 | void* arg); 26 | 27 | int cert_verify_callback_server( 28 | void* data, 29 | mbedtls_x509_crt* crt, 30 | int depth, 31 | uint32_t* flags) 32 | { 33 | return cert_verify_callback(data, crt, depth, flags, true); 34 | } 35 | 36 | int cert_verify_callback_client( 37 | void* data, 38 | mbedtls_x509_crt* crt, 39 | int depth, 40 | uint32_t* flags) 41 | { 42 | return cert_verify_callback(data, crt, depth, flags, false); 43 | } 44 | 45 | // If set, the verify callback is called for each certificate in the chain. 46 | // The verification callback is supposed to return 0 on success. Otherwise, the 47 | // verification failed. 48 | int cert_verify_callback( 49 | void* data, 50 | mbedtls_x509_crt* crt, 51 | int depth, 52 | uint32_t* flags, 53 | bool isServer) 54 | { 55 | oe_result_t result = OE_FAILURE; 56 | int ret = 1; 57 | unsigned char* cert_buf = NULL; 58 | size_t cert_size = 0; 59 | 60 | (void)data; 61 | 62 | printf(TLS_ENCLAVE "Received TLS certificate\n"); 63 | printf(TLS_ENCLAVE "cert_verify_callback with depth = %d\n", depth); 64 | 65 | cert_buf = crt->raw.p; 66 | cert_size = crt->raw.len; 67 | 68 | printf( 69 | TLS_ENCLAVE "crt->version = %d cert_size = %zu\n", 70 | crt->version, 71 | cert_size); 72 | 73 | if (cert_size <= 0) 74 | goto exit; 75 | 76 | if (isServer) { 77 | result = oe_verify_attestation_certificate_with_evidence( 78 | cert_buf, cert_size, enclave_claims_verifier_callback_server, NULL); 79 | } else { 80 | result = oe_verify_attestation_certificate_with_evidence( 81 | cert_buf, cert_size, enclave_claims_verifier_callback_client, NULL); 82 | 83 | } 84 | if (result != OE_OK) 85 | { 86 | printf( 87 | TLS_ENCLAVE 88 | "oe_verify_attestation_certificate_with_evidence failed " 89 | "with result = %s\n", 90 | oe_result_str(result)); 91 | goto exit; 92 | } 93 | ret = 0; 94 | *flags = 0; 95 | 96 | exit: 97 | return ret; 98 | } 99 | -------------------------------------------------------------------------------- /common/crypto.h: -------------------------------------------------------------------------------- 1 | #ifndef _CRYPTO_ 2 | #define _CRYPTO_ 3 | 4 | #include 5 | #include 6 | 7 | #define IV_LEN 12 8 | #define TAG_LEN 16 9 | //#define AAD_LEN 16 10 | 11 | void inc_iv(uint8_t *iv); 12 | 13 | int hashToBytes(uint8_t *bytesOut, int outLen, const uint8_t *bytesIn, int inLen); 14 | int prf(EVP_CIPHER_CTX *ctx, uint8_t *bytesOut, int outLen, const uint8_t *bytesIn, int inLen); 15 | 16 | int symm_encrypt(const uint8_t *key, uint8_t *bytesOut, uint8_t *iv, uint8_t *tag, const uint8_t *bytesIn, int len); 17 | int symm_decrypt(const uint8_t *key, uint8_t *bytesOut, const uint8_t *iv, uint8_t *tag, const uint8_t *bytesIn, int len); 18 | 19 | int symm_encrypt(const uint8_t *key, EVP_CIPHER_CTX *ctx, uint8_t *bytesOut, uint8_t *iv, uint8_t *tag, const uint8_t *bytesIn, uint8_t *curr_iv); 20 | int symm_decrypt(const uint8_t *key, EVP_CIPHER_CTX *ctx, uint8_t *bytesOut, const uint8_t *iv, uint8_t *tag, const uint8_t *bytesIn); 21 | 22 | void print_bytes(char *label, const uint8_t *bytes, int len); 23 | 24 | // Encryption/Decryption with a specific IV. 25 | int symm_encrypt(EVP_CIPHER_CTX *ctx, uint8_t *bytesOut, uint8_t *iv, uint8_t *tag, uint8_t *curr_iv, const uint8_t *bytesIn, int len); 26 | int symm_decrypt(EVP_CIPHER_CTX *ctx, uint8_t *bytesOut, const uint8_t *iv, uint8_t *tag, const uint8_t *bytesIn, int len); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /common/empty_client_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 6 | 7 | static const char CLIENT_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEAqhEGbnOzUfNffyL98nRj\n" 10 | "FOXYb+4d1Q/CluY3GlbDFv9OphD9zwY8TnSUz/cIBMdphAadGlnjIi8SS9Yey1If\n" 11 | "RcIW1pMnRaAS8J1Kwh9WgBqBZlA/bFB4a45ZC16l+oeG5/u3MeQsKDsNIT1kfHJD\n" 12 | "Sb18UHlvEPNcrzIDy+TAcAhd7q/aav1lDp28TgT7kUdVb5HitBzBQ67s4/L6Xzlo\n" 13 | "yAMqSybT56nnTeADcNa/tvom8vqz0lZ5nXAQ7ZAhGKJKCWk+9aT5oxLNBCrUYQ+U\n" 14 | "tnJ8429uzBYvG/fyaMcAGjkcfnW2irYSpwfFbpN6Ew2252V6O6KYTcFGKBGQaXKe\n" 15 | "zflTOOQ6yRUr5a4GqwTsVc6TH+NvpIyL1SgY2zzSkwciqTRyHBh7UpfCC3E3ZNJK\n" 16 | "T4CUPXu5eINL6v2Wmz8CRbc2hoPoD+oIvLoqcgClihZs3XlGp3D6ULEgKBP5ortC\n" 17 | "gpUbitgtA0zGLrQlJhKHVkGgwxax1U9wLHPNLxzzsGaJAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/empty_server_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 6 | 7 | static const char SERVER_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEA3G5Wa4v6OPqaboH5qO/g\n" 10 | "8Hg0NCkAIRAN3dCepNPjtjY/UanrmMu99GZn/L/+SzMjawYhudUmtHkh3m3nHKJq\n" 11 | "p0HMVgXV0k1BK00fnlUHYP2bNr5RtV0LvpGH6Iy4b7t0/WRCZrxVdbJfaCnR8f7n\n" 12 | "9AJZ9xsnuuIiRL1dppH1lfijHuajaH2VBbOrrzkhS3LQQloG278KO3Yy0VeVCbm7\n" 13 | "ljO06QXv+V2I4jExVRtiiWAPnb0x54b6AKkD+K4r+9LvYofZPVig+aQ9y54H3wJw\n" 14 | "3PWOlTOgkJPONIDhxkP+sTbaAlODNSE3XtPdMkGIH3RxMSkg8NWEa9tYhNOIfNUA\n" 15 | "N/ECT1Qe6UhMS5MVH2bCru/TijbAIIWUwypWpt8UBs420RF8aJ69mivLsiEeJm3O\n" 16 | "Dwa70h+1e2Da6Kgp6kpG9ZOm3wQ7WK9ywxiG1HR9Yd+wu8bBMfW1HBCjdpH2wQFO\n" 17 | "TsC5qy1FqIAU9a5r3tXn6CbMJnevSg2NAwd5UTADBOVhAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/load_balancer_client_enc_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 6 | 7 | static const char CLIENT_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEA3G5Wa4v6OPqaboH5qO/g\n" 10 | "8Hg0NCkAIRAN3dCepNPjtjY/UanrmMu99GZn/L/+SzMjawYhudUmtHkh3m3nHKJq\n" 11 | "p0HMVgXV0k1BK00fnlUHYP2bNr5RtV0LvpGH6Iy4b7t0/WRCZrxVdbJfaCnR8f7n\n" 12 | "9AJZ9xsnuuIiRL1dppH1lfijHuajaH2VBbOrrzkhS3LQQloG278KO3Yy0VeVCbm7\n" 13 | "ljO06QXv+V2I4jExVRtiiWAPnb0x54b6AKkD+K4r+9LvYofZPVig+aQ9y54H3wJw\n" 14 | "3PWOlTOgkJPONIDhxkP+sTbaAlODNSE3XtPdMkGIH3RxMSkg8NWEa9tYhNOIfNUA\n" 15 | "N/ECT1Qe6UhMS5MVH2bCru/TijbAIIWUwypWpt8UBs420RF8aJ69mivLsiEeJm3O\n" 16 | "Dwa70h+1e2Da6Kgp6kpG9ZOm3wQ7WK9ywxiG1HR9Yd+wu8bBMfW1HBCjdpH2wQFO\n" 17 | "TsC5qy1FqIAU9a5r3tXn6CbMJnevSg2NAwd5UTADBOVhAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/load_balancer_server_enc_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 6 | 7 | static const char SERVER_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEA3G5Wa4v6OPqaboH5qO/g\n" 10 | "8Hg0NCkAIRAN3dCepNPjtjY/UanrmMu99GZn/L/+SzMjawYhudUmtHkh3m3nHKJq\n" 11 | "p0HMVgXV0k1BK00fnlUHYP2bNr5RtV0LvpGH6Iy4b7t0/WRCZrxVdbJfaCnR8f7n\n" 12 | "9AJZ9xsnuuIiRL1dppH1lfijHuajaH2VBbOrrzkhS3LQQloG278KO3Yy0VeVCbm7\n" 13 | "ljO06QXv+V2I4jExVRtiiWAPnb0x54b6AKkD+K4r+9LvYofZPVig+aQ9y54H3wJw\n" 14 | "3PWOlTOgkJPONIDhxkP+sTbaAlODNSE3XtPdMkGIH3RxMSkg8NWEa9tYhNOIfNUA\n" 15 | "N/ECT1Qe6UhMS5MVH2bCru/TijbAIIWUwypWpt8UBs420RF8aJ69mivLsiEeJm3O\n" 16 | "Dwa70h+1e2Da6Kgp6kpG9ZOm3wQ7WK9ywxiG1HR9Yd+wu8bBMfW1HBCjdpH2wQFO\n" 17 | "TsC5qy1FqIAU9a5r3tXn6CbMJnevSg2NAwd5UTADBOVhAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/log/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(log log.cpp) 2 | add_library(log_enc log.cpp) 3 | target_link_libraries(log_enc PRIVATE openenclave::oelibcxx) -------------------------------------------------------------------------------- /common/log/log.cpp: -------------------------------------------------------------------------------- 1 | #include "log.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace debug_log { 9 | const char *NAME = ""; 10 | 11 | void set_name(const char *name) { 12 | NAME = name; 13 | } 14 | 15 | void info(const char *format, ...) { 16 | auto now = std::time(nullptr); 17 | printf("[%ld] [%s] ", now, NAME); 18 | va_list args; 19 | va_start(args, format); 20 | vprintf(format, args); 21 | va_end(args); 22 | } 23 | 24 | void error(const char *format, ...) { 25 | va_list args; 26 | va_start(args, format); 27 | vprintf(format, args); 28 | va_end(args); 29 | } 30 | } // namespace debug_log 31 | -------------------------------------------------------------------------------- /common/log/log.h: -------------------------------------------------------------------------------- 1 | namespace debug_log 2 | { 3 | extern const char *NAME; 4 | void set_name(const char *name); 5 | void info(const char *format, ...); 6 | void error(const char *format, ...); 7 | } // namespace log 8 | -------------------------------------------------------------------------------- /common/mbedtls_utility.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #include "mbedtls_utility.h" 5 | #include 6 | #include 7 | #include 8 | 9 | // SGX Remote Attestation UUID. 10 | static oe_uuid_t _uuid_sgx_ecdsa = {OE_FORMAT_UUID_SGX_ECDSA}; 11 | 12 | // Consider to move this function into a shared directory 13 | oe_result_t generate_certificate_and_pkey( 14 | mbedtls_x509_crt* certificate, 15 | mbedtls_pk_context* private_key) 16 | { 17 | oe_result_t result = OE_FAILURE; 18 | uint8_t* output_certificate = nullptr; 19 | size_t output_certificate_size = 0; 20 | uint8_t* private_key_buffer = nullptr; 21 | size_t private_key_buffer_size = 0; 22 | uint8_t* public_key_buffer = nullptr; 23 | size_t public_key_buffer_size = 0; 24 | int ret = 0; 25 | 26 | result = generate_key_pair( 27 | &public_key_buffer, 28 | &public_key_buffer_size, 29 | &private_key_buffer, 30 | &private_key_buffer_size); 31 | if (result != OE_OK) 32 | { 33 | printf("generate_key_pair failed with %s\n", oe_result_str(result)); 34 | goto exit; 35 | } 36 | 37 | printf("public key used:\n%s\n", public_key_buffer); 38 | 39 | // both ec key such ASYMMETRIC_KEY_EC_SECP256P1 or RSA key work 40 | oe_attester_initialize(); 41 | result = oe_get_attestation_certificate_with_evidence( 42 | &_uuid_sgx_ecdsa, 43 | certificate_subject_name, 44 | private_key_buffer, 45 | private_key_buffer_size, 46 | public_key_buffer, 47 | public_key_buffer_size, 48 | &output_certificate, 49 | &output_certificate_size); 50 | if (result != OE_OK) 51 | { 52 | printf( 53 | "oe_generate_attestation_certificate failed with %s\n", 54 | oe_result_str(result)); 55 | goto exit; 56 | } 57 | 58 | // create mbedtls_x509_crt from output_cert 59 | ret = mbedtls_x509_crt_parse_der( 60 | certificate, output_certificate, output_certificate_size); 61 | if (ret != 0) 62 | { 63 | printf("mbedtls_x509_crt_parse_der failed with ret = %d\n", ret); 64 | result = OE_FAILURE; 65 | goto exit; 66 | } 67 | 68 | // create mbedtls_pk_context from private key data 69 | ret = mbedtls_pk_parse_key( 70 | private_key, 71 | (const unsigned char*)private_key_buffer, 72 | private_key_buffer_size, 73 | NULL, 74 | 0); 75 | if (ret != 0) 76 | { 77 | printf("mbedtls_pk_parse_key failed with ret = %d\n", ret); 78 | result = OE_FAILURE; 79 | goto exit; 80 | } 81 | 82 | exit: 83 | oe_attester_shutdown(); 84 | oe_free_key(private_key_buffer, private_key_buffer_size, NULL, 0); 85 | oe_free_key(public_key_buffer, public_key_buffer_size, NULL, 0); 86 | oe_free_attestation_certificate(output_certificate); 87 | return result; 88 | } 89 | -------------------------------------------------------------------------------- /common/mbedtls_utility.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "utility.h" 10 | 11 | oe_result_t generate_certificate_and_pkey( 12 | mbedtls_x509_crt* certificate, 13 | mbedtls_pk_context* private_key); 14 | -------------------------------------------------------------------------------- /common/openssl_utility.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | #include 7 | #include "utility.h" 8 | 9 | int read_from_session_peer( 10 | SSL*& ssl_session, 11 | const char* payload, 12 | size_t payload_length); 13 | int write_to_session_peer( 14 | SSL*& ssl_session, 15 | const char* payload, 16 | size_t payload_length); 17 | 18 | oe_result_t load_tls_certificates_and_keys( 19 | SSL_CTX* ctx, 20 | X509*& certificate, 21 | EVP_PKEY*& pkey); 22 | 23 | oe_result_t initalize_ssl_context(SSL_CONF_CTX*& ssl_conf_ctx, SSL_CTX*& ctx); 24 | -------------------------------------------------------------------------------- /common/par_obl_primitives.cpp: -------------------------------------------------------------------------------- 1 | #include "par_obl_primitives.h" 2 | #include 3 | 4 | namespace pos { 5 | std::mutex m; 6 | std::condition_variable cv; 7 | thread_state state; 8 | 9 | void notify_threads(ThreadFn fn) { 10 | { 11 | std::lock_guard lk(m); 12 | state.fn = fn; 13 | state.curr_iter++; 14 | state.n_done = 1; 15 | } 16 | cv.notify_all(); 17 | } 18 | 19 | void wait_for_threads(int num_threads) { 20 | { 21 | std::unique_lock lk(m); 22 | cv.wait(lk, [num_threads]{ 23 | bool done = state.n_done == num_threads; 24 | /* 25 | if (done) { 26 | printf("all threads done\n"); 27 | } else { 28 | printf("waiting for threads to finish, done: %d\n", state.n_done); 29 | } 30 | */ 31 | return done; 32 | }); 33 | } 34 | } 35 | } 36 | 37 | std::pair get_cutoffs_for_thread(int thread_id, int total, int n_threads) { 38 | int chunks = floor(total / n_threads); 39 | int start = chunks*thread_id; 40 | int end = start+chunks; 41 | if (thread_id + 1 == n_threads) { 42 | end = total; 43 | } 44 | // printf("[t %d] bounds: [%d, %d)\n", thread_id, start, end); 45 | return std::make_pair(start, end); 46 | } -------------------------------------------------------------------------------- /common/protos/oram.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package oram; 4 | 5 | 6 | // OramRequest represents an ORAM access request (read or write). 7 | message OramRequest { 8 | int32 client_id = 1; 9 | repeated bytes ct = 2; 10 | repeated bytes iv = 3; 11 | repeated bytes tag = 4; 12 | } 13 | 14 | message OramRequests { 15 | int32 balancer_id = 1; 16 | bytes ct = 2; 17 | bytes iv = 3; 18 | bytes tag = 4; 19 | uint32 len = 5; 20 | } 21 | 22 | message OramResponse { 23 | repeated bytes ct = 1; 24 | repeated bytes iv = 2; 25 | repeated bytes tag = 3; 26 | } 27 | 28 | message OramResponses { 29 | bytes ct = 1; 30 | bytes iv = 2; 31 | bytes tag = 3; 32 | uint32 len = 4; 33 | } 34 | 35 | service Oram { 36 | rpc ReadKey(OramRequest) returns (OramResponse); 37 | rpc WriteKey(OramRequest) returns (OramResponse); 38 | rpc AccessKey(OramRequest) returns (OramResponse); 39 | // rpc ReadKeysStream(OramRequests) returns (stream OramResponse); 40 | // rpc WriteKeysStream(OramRequests) returns (stream OramResponse); 41 | rpc BatchedReadKeys(OramRequests) returns (OramResponses); 42 | rpc BatchedWriteKeys(OramRequests) returns (OramResponses); 43 | rpc BatchedAccessKeys(OramRequests) returns (OramResponses); 44 | } 45 | 46 | 47 | // TODO: API required for oblivious shuffle 48 | service Storage { 49 | 50 | } 51 | -------------------------------------------------------------------------------- /common/suboram_enc_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_SERVER_PUBKEY_H 6 | 7 | static const char SERVER_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEA3G5Wa4v6OPqaboH5qO/g\n" 10 | "8Hg0NCkAIRAN3dCepNPjtjY/UanrmMu99GZn/L/+SzMjawYhudUmtHkh3m3nHKJq\n" 11 | "p0HMVgXV0k1BK00fnlUHYP2bNr5RtV0LvpGH6Iy4b7t0/WRCZrxVdbJfaCnR8f7n\n" 12 | "9AJZ9xsnuuIiRL1dppH1lfijHuajaH2VBbOrrzkhS3LQQloG278KO3Yy0VeVCbm7\n" 13 | "ljO06QXv+V2I4jExVRtiiWAPnb0x54b6AKkD+K4r+9LvYofZPVig+aQ9y54H3wJw\n" 14 | "3PWOlTOgkJPONIDhxkP+sTbaAlODNSE3XtPdMkGIH3RxMSkg8NWEa9tYhNOIfNUA\n" 15 | "N/ECT1Qe6UhMS5MVH2bCru/TijbAIIWUwypWpt8UBs420RF8aJ69mivLsiEeJm3O\n" 16 | "Dwa70h+1e2Da6Kgp6kpG9ZOm3wQ7WK9ywxiG1HR9Yd+wu8bBMfW1HBCjdpH2wQFO\n" 17 | "TsC5qy1FqIAU9a5r3tXn6CbMJnevSg2NAwd5UTADBOVhAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/test_ring_buffer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "ring_buffer.h" 5 | #include "block.h" 6 | 7 | using Block = bucket_item; 8 | 9 | int main() { 10 | size_t TEST_NUM_BLOCKS = 63; 11 | RingBuffer rbuf(TEST_NUM_BLOCKS+1); 12 | 13 | Block b; 14 | b.index = 1; 15 | rbuf.write(&b, 1); 16 | assert_eq(rbuf.available_to_write(), TEST_NUM_BLOCKS-1); 17 | assert_eq(rbuf.available_to_read(), 1); 18 | Block rb; 19 | rbuf.read(&rb, 1); 20 | assert_eq(rb.index, 1); 21 | assert_eq(rbuf.available_to_write(), TEST_NUM_BLOCKS); 22 | assert_eq(rbuf.available_to_read(), 0); 23 | 24 | std::vector bvec; 25 | for (int i = 0; i < TEST_NUM_BLOCKS; i++) { 26 | Block b; 27 | b.index = i; 28 | bvec.push_back(b); 29 | } 30 | rbuf.write(bvec.data(), TEST_NUM_BLOCKS); 31 | std::vector buf(10); 32 | int batch_size = 4; 33 | int offset = 0; 34 | for (int i = 0; i < TEST_NUM_BLOCKS / batch_size; i++) { 35 | assert_eq(rbuf.available_to_write(), i*batch_size); 36 | assert_eq(rbuf.available_to_read(), TEST_NUM_BLOCKS-i*batch_size); 37 | assert_eq(rbuf.read(buf.data(), batch_size), batch_size); 38 | for (int j = 0; j < batch_size; j++) { 39 | assert_eq(buf[j].index, i*batch_size+j); 40 | } 41 | offset += batch_size; 42 | } 43 | int rem = TEST_NUM_BLOCKS % batch_size; 44 | assert_eq(rbuf.available_to_write(), TEST_NUM_BLOCKS-rem); 45 | assert_eq(rbuf.available_to_read(), rem); 46 | assert_eq(rbuf.read_full(buf.data(), batch_size), 0); 47 | assert_eq(rbuf.read(buf.data(), rem), rem); 48 | for (int j = 0; j < rem; j++) { 49 | assert_eq(buf[j].index, offset+j); 50 | } 51 | 52 | assert_eq(rbuf.available_to_write(), TEST_NUM_BLOCKS); 53 | assert_eq(rbuf.available_to_read(), 0); 54 | } -------------------------------------------------------------------------------- /common/tls_client_enc_pubkey.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 5 | #define SAMPLES_REMOTE_ATTESTATION_CLIENT_PUBKEY_H 6 | 7 | static const char CLIENT_PUBKEY[] = 8 | "-----BEGIN PUBLIC KEY-----\n" 9 | "MIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEAqhEGbnOzUfNffyL98nRj\n" 10 | "FOXYb+4d1Q/CluY3GlbDFv9OphD9zwY8TnSUz/cIBMdphAadGlnjIi8SS9Yey1If\n" 11 | "RcIW1pMnRaAS8J1Kwh9WgBqBZlA/bFB4a45ZC16l+oeG5/u3MeQsKDsNIT1kfHJD\n" 12 | "Sb18UHlvEPNcrzIDy+TAcAhd7q/aav1lDp28TgT7kUdVb5HitBzBQ67s4/L6Xzlo\n" 13 | "yAMqSybT56nnTeADcNa/tvom8vqz0lZ5nXAQ7ZAhGKJKCWk+9aT5oxLNBCrUYQ+U\n" 14 | "tnJ8429uzBYvG/fyaMcAGjkcfnW2irYSpwfFbpN6Ew2252V6O6KYTcFGKBGQaXKe\n" 15 | "zflTOOQ6yRUr5a4GqwTsVc6TH+NvpIyL1SgY2zzSkwciqTRyHBh7UpfCC3E3ZNJK\n" 16 | "T4CUPXu5eINL6v2Wmz8CRbc2hoPoD+oIvLoqcgClihZs3XlGp3D6ULEgKBP5ortC\n" 17 | "gpUbitgtA0zGLrQlJhKHVkGgwxax1U9wLHPNLxzzsGaJAgED\n" 18 | "-----END PUBLIC KEY-----\n"; 19 | 20 | #endif /* SAMPLES_REMOTE_ATTESTATION_PUBKEY_H */ 21 | -------------------------------------------------------------------------------- /common/utility.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "common.h" 8 | 9 | const unsigned char certificate_subject_name[] = 10 | "CN=Open Enclave SDK,O=OESDK TLS,C=US"; 11 | 12 | oe_result_t generate_key_pair( 13 | uint8_t** public_key, 14 | size_t* public_key_size, 15 | uint8_t** private_key, 16 | size_t* private_key_size); 17 | 18 | bool verify_signer_id( 19 | const char* siging_public_key_buf, 20 | size_t siging_public_key_buf_size, 21 | uint8_t* signer_id_buf, 22 | size_t signer_id_buf_size); 23 | 24 | const oe_claim_t* find_claim( 25 | const oe_claim_t* claims, 26 | size_t claims_size, 27 | const char* name); 28 | 29 | oe_result_t load_oe_modules(); -------------------------------------------------------------------------------- /config/client.config: -------------------------------------------------------------------------------- 1 | { 2 | "lb_addrs": ["localhost:12345"], 3 | "num_blocks": 1024, 4 | "threads": 5, 5 | "run_name": "~/dumbo/results/", 6 | "exp_sec": 60, 7 | "experiment_dir": "~/dumbo/tmp", 8 | "num_balancers": 1, 9 | "batch_size": 100, 10 | "client_id": 0, 11 | "ip_addr": "40.87.49.190" 12 | } 13 | -------------------------------------------------------------------------------- /config/lb_1.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12345", 3 | "suboram_addrs": [["localhost:12346"]], 4 | "epoch_ms": 1000, 5 | "num_blocks": 1024, 6 | "balancer_id": 0, 7 | "threads": 1 8 | } 9 | -------------------------------------------------------------------------------- /config/lb_10.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12345", 3 | "suboram_addrs": [["localhost:12346"], ["localhost:12347"], ["localhost:12348"], ["localhost:12349"], ["localhost:12350"], ["localhost:12346"], ["localhost:12347"], ["localhost:12348"], ["localhost:12349"], ["localhost:12350"]], 4 | "epoch_ms": 1000, 5 | "num_blocks": 1024, 6 | "balancer_id": 0, 7 | "threads": 1 8 | } 9 | -------------------------------------------------------------------------------- /config/lb_5.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12345", 3 | "suboram_addrs": [["localhost:12346"], ["localhost:12347"], ["localhost:12348"], ["localhost:12349"], ["localhost:12350"]], 4 | "epoch_ms": 1000, 5 | "num_blocks": 1024, 6 | "balancer_id": 0, 7 | "threads": 1 8 | } 9 | -------------------------------------------------------------------------------- /config/suboram.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12346", 3 | "num_blocks": 100000, 4 | "mode": "server", 5 | "sort_type": "bitonic_sort", 6 | "num_balancers": 1, 7 | "num_suborams": 1, 8 | "protocol_type": "our_protocol", 9 | "run_name": "test", 10 | "suboram_id": 0, 11 | "threads": 3 12 | } 13 | -------------------------------------------------------------------------------- /experiments/artifact_figures/artifact/baselines.json: -------------------------------------------------------------------------------- 1 | { 2 | "obladi_throughput": 8333, 3 | "oblix_latency": { 4 | "160": { 5 | "10": 0.00023065090179443358, 6 | "100": 0.00029450440406799316, 7 | "1000": 0.00034726834297180175, 8 | "10000": 0.0004075307846069336, 9 | "100000": 0.0004960217475891113, 10 | "1000000": 0.0006062004566192627, 11 | "2000000": 0.0006139371395111084 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/baselines.json: -------------------------------------------------------------------------------- 1 | { 2 | "oblix_latency": { 3 | "160": { 4 | "2000000": 0.0008669505119 5 | } 6 | }, 7 | "obladi_latency": 149, 8 | "obladi_throughput": 6716 9 | } 10 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/epoch_time.dat: -------------------------------------------------------------------------------- 1 | 1 131072 1 1 100 0 158.18424101969873 57.0 210.0 26.768736921879714 5.173851265921713 158.0 159.0 161.0 163.0 170.0 3200 2 | 1 131072 1 1 100 0 172.82607123485806 53.0 201.0 50.04026044620023 7.073914082472322 172.0 175.0 180.0 184.0 194.0 5888 3 | 1 131072 1 1 100 0 204.74914383561645 119.0 282.0 106.7624136505442 10.332589881077455 203.0 210.0 217.0 222.0 235.0 9856 4 | 1 131072 1 1 100 0 274.09114359415304 60.0 516.0 645.4987149146058 25.40666674151896 269.0 280.0 294.0 302.0 333.0 14848 5 | 1 131072 1 1 100 0 352.53207267334074 221.0 1485.0 12045.271589067022 109.75095256564757 336.0 351.0 364.0 375.1999999999998 1003.04 22528 6 | 1 131072 1 1 100 0 684.6374908825675 142.0 3539.0 179533.72927277072 423.714207069778 599.0 612.0 633.0 853.5 3245.2999999999997 22528 7 | 1 131072 1 1 100 0 1188.4324675324676 270.0 1519.0 41022.528556248944 202.5401899778139 1246.5 1275.0 1308.0 1329.0 1359.62 24576 8 | 1 131072 1 1 100 0 2792.112426035503 655.0 3280.0 84806.58499352264 291.21570183203147 2787.5 2897.0 2985.4000000000005 3089.7999999999993 3250.75 20480 9 | 1 131072 1 1 100 0 7256.162601626016 661.0 8755.0 2612900.1686826623 1616.446772610426 7527.0 7872.0 8565.6 8649.9 8716.84 16384 10 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/micro_balancer_make_batch.dat: -------------------------------------------------------------------------------- 1 | 1 64 999 2 | 1 128 800 3 | 1 256 1538 4 | 1 512 3540 5 | 1 1024 7966 6 | 1 2048 16149 7 | 1 4096 28817 8 | 1 8192 60451 9 | 1 16384 139748 10 | 2 64 1113 11 | 2 128 1103 12 | 2 256 1776 13 | 2 512 3473 14 | 2 1024 8318 15 | 2 2048 16347 16 | 2 4096 28785 17 | 2 8192 61907 18 | 2 16384 118463 19 | 3 64 1185 20 | 3 128 1180 21 | 3 256 1906 22 | 3 512 3609 23 | 3 1024 7508 24 | 3 2048 16855 25 | 3 4096 31292 26 | 3 8192 64916 27 | 3 16384 134938 28 | 4 64 1289 29 | 4 128 1293 30 | 4 256 2416 31 | 4 512 4058 32 | 4 1024 7891 33 | 4 2048 24471 34 | 4 4096 30316 35 | 4 8192 65246 36 | 4 16384 137626 37 | 5 64 2598 38 | 5 128 1373 39 | 5 256 2635 40 | 5 512 4450 41 | 5 1024 8465 42 | 5 2048 18390 43 | 5 4096 30290 44 | 5 8192 63417 45 | 5 16384 131415 46 | 6 64 1898 47 | 6 128 1544 48 | 6 256 2616 49 | 6 512 4394 50 | 6 1024 8389 51 | 6 2048 20119 52 | 6 4096 30569 53 | 6 8192 59310 54 | 6 16384 126360 55 | 7 64 1865 56 | 7 128 1658 57 | 7 256 2709 58 | 7 512 4487 59 | 7 1024 8417 60 | 7 2048 18264 61 | 7 4096 30212 62 | 7 8192 60662 63 | 7 16384 121958 64 | 8 64 2073 65 | 8 128 1994 66 | 8 256 3195 67 | 8 512 6021 68 | 8 1024 9410 69 | 8 2048 20311 70 | 8 4096 32113 71 | 8 8192 60642 72 | 8 16384 140546 73 | 9 64 2216 74 | 9 128 1800 75 | 9 256 3193 76 | 9 512 6113 77 | 9 1024 9934 78 | 9 2048 21327 79 | 9 4096 32656 80 | 9 8192 61469 81 | 9 16384 132412 82 | 10 64 2401 83 | 10 128 2052 84 | 10 256 3432 85 | 10 512 6334 86 | 10 1024 9882 87 | 10 2048 19848 88 | 10 4096 35499 89 | 10 8192 68006 90 | 10 16384 128982 91 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/micro_balancer_match_resps.dat: -------------------------------------------------------------------------------- 1 | 1 64 721 2 | 1 128 1219 3 | 1 256 2183 4 | 1 512 4335 5 | 1 1024 8995 6 | 1 2048 19001 7 | 1 4096 33897 8 | 1 8192 68540 9 | 1 16384 141054 10 | 2 64 1554 11 | 2 128 1412 12 | 2 256 2504 13 | 2 512 4960 14 | 2 1024 9530 15 | 2 2048 19272 16 | 2 4096 38871 17 | 2 8192 71996 18 | 2 16384 160020 19 | 3 64 1133 20 | 3 128 1510 21 | 3 256 3041 22 | 3 512 5315 23 | 3 1024 10313 24 | 3 2048 20315 25 | 3 4096 38665 26 | 3 8192 77382 27 | 3 16384 166892 28 | 4 64 1197 29 | 4 128 1881 30 | 4 256 3126 31 | 4 512 5583 32 | 4 1024 10340 33 | 4 2048 23512 34 | 4 4096 39156 35 | 4 8192 76569 36 | 4 16384 152047 37 | 5 64 1197 38 | 5 128 1988 39 | 5 256 3247 40 | 5 512 5703 41 | 5 1024 10472 42 | 5 2048 23410 43 | 5 4096 39156 44 | 5 8192 74658 45 | 5 16384 157095 46 | 6 64 1373 47 | 6 128 2022 48 | 6 256 3630 49 | 6 512 6227 50 | 6 1024 11332 51 | 6 2048 22310 52 | 6 4096 39819 53 | 6 8192 82448 54 | 6 16384 161032 55 | 7 64 1612 56 | 7 128 2009 57 | 7 256 3695 58 | 7 512 6837 59 | 7 1024 11578 60 | 7 2048 22702 61 | 7 4096 42899 62 | 7 8192 80921 63 | 7 16384 209695 64 | 8 64 1468 65 | 8 128 2230 66 | 8 256 3650 67 | 8 512 6892 68 | 8 1024 11213 69 | 8 2048 23564 70 | 8 4096 50613 71 | 8 8192 79773 72 | 8 16384 162739 73 | 9 64 1683 74 | 9 128 2146 75 | 9 256 3874 76 | 9 512 7498 77 | 9 1024 11893 78 | 9 2048 23821 79 | 9 4096 44007 80 | 9 8192 82883 81 | 9 16384 181011 82 | 10 64 1745 83 | 10 128 2315 84 | 10 256 4002 85 | 10 512 7482 86 | 10 1024 11863 87 | 10 2048 24971 88 | 10 4096 43134 89 | 10 8192 88467 90 | 10 16384 199611 91 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/micro_lb_make_batch.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/paper/micro_lb_make_batch.dat -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/micro_suboram.dat: -------------------------------------------------------------------------------- 1 | hash_table 8192 136.62 2 | hash_table 16384 161.75 3 | hash_table 32768 150.96 4 | hash_table 65536 169.01 5 | hash_table 131072 158.04 6 | hash_table 262144 185.66 7 | hash_table 524288 263.3 8 | hash_table 1048576 306.42 9 | hash_table 2097152 492.42 10 | hash_table 4194304 837.57 11 | hash_table 8388608 1617.23 12 | hash_table 16777216 3237.66 13 | bucket_sort 8192 85 14 | bucket_sort 16384 156 15 | bucket_sort 32768 337 16 | bucket_sort 65536 738 17 | bucket_sort 131072 1600 18 | bucket_sort 262144 3430 19 | bucket_sort 524288 8640 20 | bucket_sort 1048576 18100 21 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/parallel_legend.dat: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/params_alphas.dat: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/params_overheads.dat: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/params_scaling_capacity.dat: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/params_varying_N.dat: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/planner_config.dat: -------------------------------------------------------------------------------- 1 | config1 1 1 200 2 | config1 2 1 6000 3 | config1 3 1 25800 4 | config1 4 1 38700 5 | config1 5 1 51600 6 | config3 1 1 200 7 | config3 2 2 61500 8 | config3 4 3 122900 9 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/planner_cost.dat: -------------------------------------------------------------------------------- 1 | config1 200 1154 2 | config1 6000 1732 3 | config1 25800 2309 4 | config1 38700 2887 5 | config1 51600 3464 6 | config3 200 1154 7 | config3 61500 2309 8 | config3 122900 4042 9 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/planner_legend.dat: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_breakdown.dat: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_breakdown_1024.dat: -------------------------------------------------------------------------------- 1 | ffoo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_breakdown_1048576.dat: -------------------------------------------------------------------------------- 1 | ffoo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_breakdown_32768.dat: -------------------------------------------------------------------------------- 1 | ffoo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_breakdown_legend.dat: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/scale_throughput_redis.dat: -------------------------------------------------------------------------------- 1 | 1880179.968 2 | 2230037.504 3 | 3005219.456 4 | 3471668.736 5 | 3966647.808 6 | 4073241.472 7 | 4173268.48 8 | 4124524.352 9 | 4755365.184 10 | 4507003.328 11 | 6416874.88 12 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/sort_parallel.dat: -------------------------------------------------------------------------------- 1 | 0.58 2.28 2.64 0.81 2 | 1.52 2.91 3.67 1.94 3 | 3.71 5.01 5.09 4.99 4 | 8.65 8.73 8.06 7.05 5 | 19.93 18.21 12.35 12.88 6 | 48.98 37.63 22.44 22.73 7 | 197.78 127.74 75.58 82.7 8 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/suboram_legend.dat: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/suboram_parallel.dat: -------------------------------------------------------------------------------- 1 | 231.14 183.6 161.18 2 | 223.97 183.26 171.13 3 | 230.7 196.9 171.27 4 | 248.06 197.55 184.89 5 | 252 214.61 185.8 6 | 288.75 230.05 200.67 7 | 370.69 276.4 257.23 8 | 479.68 364.71 317.12 9 | 723.87 655.52 548.71 10 | 1275.32 981.22 840.25 11 | -------------------------------------------------------------------------------- /experiments/artifact_figures/paper/suborams_vs_latency.dat: -------------------------------------------------------------------------------- 1 | 1 2000000 1 1 20 0 846.8051948051948 426.0 916.0 1484.4512284252544 38.52857677653373 846.0 866.0 888.0 906.0 909.0 736 2 | 1 2000000 2 1 20 0 444.06666666666666 253.0 576.0 913.1688888888889 30.218684433457536 437.0 459.0 475.0 482.0 550.0 1440 3 | 1 2000000 3 1 20 0 316.8253968253968 154.0 411.0 858.7155454774502 29.303848646166774 306.0 338.0 355.5000000000007 376.0 410.0 2016 4 | 1 2000000 4 1 20 0 261.5095206828628 129.0 364.0 1111.6064425148381 33.34076247650671 251.0 275.0 315.0 329.0 364.0 2432 5 | 1 2000000 5 1 20 0 218.2264254385965 104.0 369.0 974.6302008190021 31.219067904391412 209.0 234.0 258.0 278.0 352.0 2912 6 | 1 2000000 6 1 20 0 181.55327868852459 100.0 246.0 415.1488007256114 20.375200630315554 176.0 191.0 210.5 227.0 243.0 3488 7 | 1 2000000 7 1 20 0 173.27652173913043 96.0 330.0 794.36962268431 28.184563553198938 166.0 185.0 207.0 219.0 280.0 3680 8 | 1 2000000 8 1 20 0 152.62370936902485 88.0 239.0 435.1111778275795 20.859318728749976 148.0 160.0 180.0 198.0 223.0 4160 9 | 1 2000000 9 1 20 0 149.38533834586465 100.0 245.0 485.52256699078526 22.034576623815244 145.0 162.0 178.0 193.0 215.0 4256 10 | 1 2000000 10 1 20 0 136.50274536719286 82.0 236.0 407.5355106510166 20.187508777732248 132.0 147.0 164.0 176.0 197.0 4640 11 | 1 2000000 11 1 20 0 125.38449416955562 100.0 197.0 343.1909603256042 18.525413904299256 120.0 134.0 153.0 166.0 180.0 5056 12 | 1 2000000 12 1 20 0 123.58354037267081 82.0 183.0 259.959170074457 16.12324936464288 121.0 133.0 144.0 154.0 165.0 5152 13 | 1 2000000 13 1 20 0 116.67155425219941 58.0 188.0 265.0047333614262 16.278965979491026 113.0 126.0 140.0 147.0 163.0 5440 14 | 1 2000000 14 1 20 0 114.56057553956835 61.0 190.0 254.06848887738732 15.939525992870282 111.0 125.0 135.0 143.0 164.25999999999976 5536 15 | 1 2000000 15 1 20 0 111.66966292134832 62.0 205.0 309.33975381896227 17.58805713599323 108.0 119.0 135.0 147.0 174.0 5696 16 | -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/10a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/10a.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/10b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/10b.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/11a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/11a.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/11b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/11b.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/11c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/11c.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/12a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/12a.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/12b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/12b.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/13.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/14a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/14a.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/14b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/14b.png -------------------------------------------------------------------------------- /experiments/artifact_figures/sample/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/experiments/artifact_figures/sample/9.png -------------------------------------------------------------------------------- /gen_mrenclave_header.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) Open Enclave SDK contributors. 4 | # Licensed under the MIT License. 5 | 6 | destfile="$1" 7 | input_file="$2" 8 | 9 | # Store text in variables and then write file all at once at the end. This 10 | # will keep build tools from consuming an incomplete header file. 11 | 12 | SECTION1="$(cat <<-EOF 13 | // Copyright (c) Open Enclave SDK contributors. 14 | // Licensed under the MIT License. 15 | 16 | #ifndef SAMPLES_ATTESTED_TLS_SERVER_UNIQUE_ID_H 17 | #define SAMPLES_ATTESTED_TLS_SERVER_UNIQUE_ID_H 18 | 19 | static const unsigned char SERVER_ENCLAVE_MRENCLAVE[] = 20 | { 21 | EOF 22 | )" 23 | 24 | SECTION2="" 25 | while read -r line; do 26 | if [[ $line == mrenclave=* ]]; then 27 | read -r mrenclave < <(echo "$line" | cut -d'=' --fields=2) 28 | if [[ "${mrenclave: -1}" = $'\r' ]]; then 29 | mrenclave="${mrenclave:0: -1}" 30 | fi 31 | 32 | for (( i=0; i<${#mrenclave}; i=i+2)); do 33 | echo -n "" >> "$destfile" 34 | SECTION2=$SECTION2"0x${mrenclave:$i:2}" 35 | index=$((${#mrenclave} - 2)) 36 | if [ $i -lt $index ]; then 37 | SECTION2=$SECTION2",\n" 38 | fi 39 | done 40 | fi 41 | done < "$input_file" 42 | 43 | 44 | SECTION3="$(cat <<-EOF 45 | }; 46 | 47 | #endif /* SAMPLES_ATTESTED_TLS_SERVER_UNIQUE_ID_H */ 48 | EOF 49 | )" 50 | 51 | echo -ne "$SECTION1$SECTION2$SECTION3" > "$destfile" 52 | 53 | -------------------------------------------------------------------------------- /include/intrinsics/bmmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _BMMINTRIN_H_INCLUDED 25 | #define _BMMINTRIN_H_INCLUDED 26 | 27 | # error "SSE5 instruction set removed from compiler" 28 | 29 | #endif /* _BMMINTRIN_H_INCLUDED */ 30 | -------------------------------------------------------------------------------- /include/intrinsics/clflushoptintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _CLFLUSHOPTINTRIN_H_INCLUDED 29 | #define _CLFLUSHOPTINTRIN_H_INCLUDED 30 | 31 | #ifndef __CLFLUSHOPT__ 32 | #pragma GCC push_options 33 | #pragma GCC target("clflushopt") 34 | #define __DISABLE_CLFLUSHOPT__ 35 | #endif /* __CLFLUSHOPT__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_clflushopt (void *__A) 40 | { 41 | __builtin_ia32_clflushopt (__A); 42 | } 43 | 44 | #ifdef __DISABLE_CLFLUSHOPT__ 45 | #undef __DISABLE_CLFLUSHOPT__ 46 | #pragma GCC pop_options 47 | #endif /* __DISABLE_CLFLUSHOPT__ */ 48 | 49 | #endif /* _CLFLUSHOPTINTRIN_H_INCLUDED */ 50 | -------------------------------------------------------------------------------- /include/intrinsics/clwbintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _CLWBINTRIN_H_INCLUDED 29 | #define _CLWBINTRIN_H_INCLUDED 30 | 31 | #ifndef __CLWB__ 32 | #pragma GCC push_options 33 | #pragma GCC target("clwb") 34 | #define __DISABLE_CLWB__ 35 | #endif /* __CLWB__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_clwb (void *__A) 40 | { 41 | __builtin_ia32_clwb (__A); 42 | } 43 | 44 | #ifdef __DISABLE_CLWB__ 45 | #undef __DISABLE_CLWB__ 46 | #pragma GCC pop_options 47 | #endif /* __DISABLE_CLWB__ */ 48 | 49 | #endif /* _CLWBINTRIN_H_INCLUDED */ 50 | -------------------------------------------------------------------------------- /include/intrinsics/clzerointrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _CLZEROINTRIN_H_INCLUDED 25 | #define _CLZEROINTRIN_H_INCLUDED 26 | 27 | #ifndef __CLZERO__ 28 | #pragma GCC push_options 29 | #pragma GCC target("clzero") 30 | #define __DISABLE_CLZERO__ 31 | #endif /* __CLZERO__ */ 32 | 33 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 34 | _mm_clzero (void * __I) 35 | { 36 | __builtin_ia32_clzero (__I); 37 | } 38 | 39 | #ifdef __DISABLE_CLZERO__ 40 | #undef __DISABLE_CLZERO__ 41 | #pragma GCC pop_options 42 | #endif /* __DISABLE_CLZERO__ */ 43 | 44 | #endif /* _CLZEROINTRIN_H_INCLUDED */ 45 | -------------------------------------------------------------------------------- /include/intrinsics/fxsrintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _FXSRINTRIN_H_INCLUDED 29 | #define _FXSRINTRIN_H_INCLUDED 30 | 31 | #ifndef __FXSR__ 32 | #pragma GCC push_options 33 | #pragma GCC target("fxsr") 34 | #define __DISABLE_FXSR__ 35 | #endif /* __FXSR__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _fxsave (void *__P) 40 | { 41 | __builtin_ia32_fxsave (__P); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _fxrstor (void *__P) 47 | { 48 | __builtin_ia32_fxrstor (__P); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _fxsave64 (void *__P) 55 | { 56 | __builtin_ia32_fxsave64 (__P); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _fxrstor64 (void *__P) 62 | { 63 | __builtin_ia32_fxrstor64 (__P); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_FXSR__ 68 | #undef __DISABLE_FXSR__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_FXSR__ */ 71 | 72 | 73 | #endif /* _FXSRINTRIN_H_INCLUDED */ 74 | -------------------------------------------------------------------------------- /include/intrinsics/lzcntintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | 29 | #ifndef _LZCNTINTRIN_H_INCLUDED 30 | #define _LZCNTINTRIN_H_INCLUDED 31 | 32 | #ifndef __LZCNT__ 33 | #pragma GCC push_options 34 | #pragma GCC target("lzcnt") 35 | #define __DISABLE_LZCNT__ 36 | #endif /* __LZCNT__ */ 37 | 38 | extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | __lzcnt16 (unsigned short __X) 40 | { 41 | return __builtin_ia32_lzcnt_u16 (__X); 42 | } 43 | 44 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 45 | __lzcnt32 (unsigned int __X) 46 | { 47 | return __builtin_ia32_lzcnt_u32 (__X); 48 | } 49 | 50 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 51 | _lzcnt_u32 (unsigned int __X) 52 | { 53 | return __builtin_ia32_lzcnt_u32 (__X); 54 | } 55 | 56 | #ifdef __x86_64__ 57 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 58 | __lzcnt64 (unsigned long long __X) 59 | { 60 | return __builtin_ia32_lzcnt_u64 (__X); 61 | } 62 | 63 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 64 | _lzcnt_u64 (unsigned long long __X) 65 | { 66 | return __builtin_ia32_lzcnt_u64 (__X); 67 | } 68 | #endif 69 | 70 | #ifdef __DISABLE_LZCNT__ 71 | #undef __DISABLE_LZCNT__ 72 | #pragma GCC pop_options 73 | #endif /* __DISABLE_LZCNT__ */ 74 | 75 | #endif /* _LZCNTINTRIN_H_INCLUDED */ 76 | -------------------------------------------------------------------------------- /include/intrinsics/mm_malloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _MM_MALLOC_H_INCLUDED 25 | #define _MM_MALLOC_H_INCLUDED 26 | 27 | #include 28 | 29 | /* We can't depend on since the prototype of posix_memalign 30 | may not be visible. */ 31 | #ifndef __cplusplus 32 | extern int posix_memalign (void **, size_t, size_t); 33 | #else 34 | extern "C" int posix_memalign (void **, size_t, size_t) throw (); 35 | #endif 36 | 37 | static __inline void * 38 | _mm_malloc (size_t __size, size_t __alignment) 39 | { 40 | void *__ptr; 41 | if (__alignment == 1) 42 | return malloc (__size); 43 | if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) 44 | __alignment = sizeof (void *); 45 | if (posix_memalign (&__ptr, __alignment, __size) == 0) 46 | return __ptr; 47 | else 48 | return NULL; 49 | } 50 | 51 | static __inline void 52 | _mm_free (void *__ptr) 53 | { 54 | free (__ptr); 55 | } 56 | 57 | #endif /* _MM_MALLOC_H_INCLUDED */ 58 | -------------------------------------------------------------------------------- /include/intrinsics/mwaitxintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _MWAITXINTRIN_H_INCLUDED 25 | #define _MWAITXINTRIN_H_INCLUDED 26 | 27 | #ifndef __MWAITX__ 28 | #pragma GCC push_options 29 | #pragma GCC target("mwaitx") 30 | #define __DISABLE_MWAITX__ 31 | #endif /* __MWAITX__ */ 32 | 33 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 34 | _mm_monitorx (void const * __P, unsigned int __E, unsigned int __H) 35 | { 36 | __builtin_ia32_monitorx (__P, __E, __H); 37 | } 38 | 39 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 40 | _mm_mwaitx (unsigned int __E, unsigned int __H, unsigned int __C) 41 | { 42 | __builtin_ia32_mwaitx (__E, __H, __C); 43 | } 44 | 45 | #ifdef __DISABLE_MWAITX__ 46 | #undef __DISABLE_MWAITX__ 47 | #pragma GCC pop_options 48 | #endif /* __DISABLE_MWAITX__ */ 49 | 50 | #endif /* _MWAITXINTRIN_H_INCLUDED */ 51 | -------------------------------------------------------------------------------- /include/intrinsics/nmmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* Implemented from the specification included in the Intel C++ Compiler 25 | User Guide and Reference, version 10.0. */ 26 | 27 | #ifndef _NMMINTRIN_H_INCLUDED 28 | #define _NMMINTRIN_H_INCLUDED 29 | 30 | /* We just include SSE4.1 header file. */ 31 | #include 32 | 33 | #endif /* _NMMINTRIN_H_INCLUDED */ 34 | -------------------------------------------------------------------------------- /include/intrinsics/pkuintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _PKUINTRIN_H_INCLUDED 29 | #define _PKUINTRIN_H_INCLUDED 30 | 31 | #ifndef __PKU__ 32 | #pragma GCC push_options 33 | #pragma GCC target("pku") 34 | #define __DISABLE_PKU__ 35 | #endif /* __PKU__ */ 36 | 37 | extern __inline unsigned int 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _rdpkru_u32 (void) 40 | { 41 | return __builtin_ia32_rdpkru (); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _wrpkru (unsigned int __key) 47 | { 48 | __builtin_ia32_wrpkru (__key); 49 | } 50 | 51 | #ifdef __DISABLE_PKU__ 52 | #undef __DISABLE_PKU__ 53 | #pragma GCC pop_options 54 | #endif /* __DISABLE_PKU__ */ 55 | 56 | #endif /* _PKUINTRIN_H_INCLUDED */ 57 | -------------------------------------------------------------------------------- /include/intrinsics/popcntintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _POPCNTINTRIN_H_INCLUDED 25 | #define _POPCNTINTRIN_H_INCLUDED 26 | 27 | #ifndef __POPCNT__ 28 | #pragma GCC push_options 29 | #pragma GCC target("popcnt") 30 | #define __DISABLE_POPCNT__ 31 | #endif /* __POPCNT__ */ 32 | 33 | /* Calculate a number of bits set to 1. */ 34 | extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 35 | _mm_popcnt_u32 (unsigned int __X) 36 | { 37 | return __builtin_popcount (__X); 38 | } 39 | 40 | #ifdef __x86_64__ 41 | extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 42 | _mm_popcnt_u64 (unsigned long long __X) 43 | { 44 | return __builtin_popcountll (__X); 45 | } 46 | #endif 47 | 48 | #ifdef __DISABLE_POPCNT__ 49 | #undef __DISABLE_POPCNT__ 50 | #pragma GCC pop_options 51 | #endif /* __DISABLE_POPCNT__ */ 52 | 53 | #endif /* _POPCNTINTRIN_H_INCLUDED */ 54 | -------------------------------------------------------------------------------- /include/intrinsics/prfchwintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _MM3DNOW_H_INCLUDED 25 | # error "Never use directly; include or instead." 26 | #endif 27 | 28 | #ifndef _PRFCHWINTRIN_H_INCLUDED 29 | #define _PRFCHWINTRIN_H_INCLUDED 30 | 31 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 32 | _m_prefetchw (void *__P) 33 | { 34 | __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */); 35 | } 36 | 37 | #endif /* _PRFCHWINTRIN_H_INCLUDED */ 38 | -------------------------------------------------------------------------------- /include/intrinsics/rdseedintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _RDSEEDINTRIN_H_INCLUDED 29 | #define _RDSEEDINTRIN_H_INCLUDED 30 | 31 | #ifndef __RDSEED__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rdseed") 34 | #define __DISABLE_RDSEED__ 35 | #endif /* __RDSEED__ */ 36 | 37 | 38 | extern __inline int 39 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 40 | _rdseed16_step (unsigned short *__p) 41 | { 42 | return __builtin_ia32_rdseed_hi_step (__p); 43 | } 44 | 45 | extern __inline int 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _rdseed32_step (unsigned int *__p) 48 | { 49 | return __builtin_ia32_rdseed_si_step (__p); 50 | } 51 | 52 | #ifdef __x86_64__ 53 | extern __inline int 54 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 55 | _rdseed64_step (unsigned long long *__p) 56 | { 57 | return __builtin_ia32_rdseed_di_step (__p); 58 | } 59 | #endif 60 | 61 | #ifdef __DISABLE_RDSEED__ 62 | #undef __DISABLE_RDSEED__ 63 | #pragma GCC pop_options 64 | #endif /* __DISABLE_RDSEED__ */ 65 | 66 | #endif /* _RDSEEDINTRIN_H_INCLUDED */ 67 | -------------------------------------------------------------------------------- /include/intrinsics/rtmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _RTMINTRIN_H_INCLUDED 29 | #define _RTMINTRIN_H_INCLUDED 30 | 31 | #ifndef __RTM__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rtm") 34 | #define __DISABLE_RTM__ 35 | #endif /* __RTM__ */ 36 | 37 | #define _XBEGIN_STARTED (~0u) 38 | #define _XABORT_EXPLICIT (1 << 0) 39 | #define _XABORT_RETRY (1 << 1) 40 | #define _XABORT_CONFLICT (1 << 2) 41 | #define _XABORT_CAPACITY (1 << 3) 42 | #define _XABORT_DEBUG (1 << 4) 43 | #define _XABORT_NESTED (1 << 5) 44 | #define _XABORT_CODE(x) (((x) >> 24) & 0xFF) 45 | 46 | /* Start an RTM code region. Return _XBEGIN_STARTED on success and the 47 | abort condition otherwise. */ 48 | extern __inline unsigned int 49 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 50 | _xbegin (void) 51 | { 52 | return __builtin_ia32_xbegin (); 53 | } 54 | 55 | /* Specify the end of an RTM code region. If it corresponds to the 56 | outermost transaction, then attempts the transaction commit. If the 57 | commit fails, then control is transferred to the outermost transaction 58 | fallback handler. */ 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xend (void) 62 | { 63 | __builtin_ia32_xend (); 64 | } 65 | 66 | /* Force an RTM abort condition. The control is transferred to the 67 | outermost transaction fallback handler with the abort condition IMM. */ 68 | #ifdef __OPTIMIZE__ 69 | extern __inline void 70 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 71 | _xabort (const unsigned int __imm) 72 | { 73 | __builtin_ia32_xabort (__imm); 74 | } 75 | #else 76 | #define _xabort(N) __builtin_ia32_xabort (N) 77 | #endif /* __OPTIMIZE__ */ 78 | 79 | #ifdef __DISABLE_RTM__ 80 | #undef __DISABLE_RTM__ 81 | #pragma GCC pop_options 82 | #endif /* __DISABLE_RTM__ */ 83 | 84 | #endif /* _RTMINTRIN_H_INCLUDED */ 85 | -------------------------------------------------------------------------------- /include/intrinsics/x86intrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _X86INTRIN_H_INCLUDED 25 | #define _X86INTRIN_H_INCLUDED 26 | 27 | #include 28 | 29 | #ifndef __iamcu__ 30 | 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include 42 | 43 | #include 44 | 45 | #include 46 | 47 | /* For including AVX instructions */ 48 | #include 49 | 50 | #include 51 | 52 | #include 53 | 54 | #include 55 | 56 | #include 57 | 58 | #include 59 | 60 | #include 61 | 62 | #include 63 | 64 | #include 65 | 66 | #include 67 | 68 | #include 69 | 70 | #include 71 | 72 | #include 73 | 74 | #include 75 | 76 | #include 77 | 78 | #include 79 | 80 | #endif /* __iamcu__ */ 81 | 82 | #include 83 | 84 | #ifndef __iamcu__ 85 | 86 | #include 87 | 88 | #include 89 | 90 | #include 91 | 92 | #include 93 | 94 | #include 95 | 96 | #include 97 | 98 | #include 99 | 100 | #endif /* __iamcu__ */ 101 | 102 | #endif /* _X86INTRIN_H_INCLUDED */ 103 | -------------------------------------------------------------------------------- /include/intrinsics/xsavecintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XSAVECINTRIN_H_INCLUDED 29 | #define _XSAVECINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVEC__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsavec") 34 | #define __DISABLE_XSAVEC__ 35 | #endif /* __XSAVEC__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsavec (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsavec (__P, __M); 42 | } 43 | 44 | #ifdef __x86_64__ 45 | extern __inline void 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _xsavec64 (void *__P, long long __M) 48 | { 49 | __builtin_ia32_xsavec64 (__P, __M); 50 | } 51 | #endif 52 | 53 | #ifdef __DISABLE_XSAVEC__ 54 | #undef __DISABLE_XSAVEC__ 55 | #pragma GCC pop_options 56 | #endif /* __DISABLE_XSAVEC__ */ 57 | 58 | #endif /* _XSAVECINTRIN_H_INCLUDED */ 59 | -------------------------------------------------------------------------------- /include/intrinsics/xsaveintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _XSAVEINTRIN_H_INCLUDED 29 | #define _XSAVEINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVE__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsave") 34 | #define __DISABLE_XSAVE__ 35 | #endif /* __XSAVE__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsave (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsave (__P, __M); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _xrstor (void *__P, long long __M) 47 | { 48 | __builtin_ia32_xrstor (__P, __M); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _xsave64 (void *__P, long long __M) 55 | { 56 | __builtin_ia32_xsave64 (__P, __M); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xrstor64 (void *__P, long long __M) 62 | { 63 | __builtin_ia32_xrstor64 (__P, __M); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_XSAVE__ 68 | #undef __DISABLE_XSAVE__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_XSAVE__ */ 71 | 72 | #endif /* _XSAVEINTRIN_H_INCLUDED */ 73 | -------------------------------------------------------------------------------- /include/intrinsics/xsaveoptintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _XSAVEOPTINTRIN_H_INCLUDED 29 | #define _XSAVEOPTINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVEOPT__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsaveopt") 34 | #define __DISABLE_XSAVEOPT__ 35 | #endif /* __XSAVEOPT__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsaveopt (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsaveopt (__P, __M); 42 | } 43 | 44 | #ifdef __x86_64__ 45 | extern __inline void 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _xsaveopt64 (void *__P, long long __M) 48 | { 49 | __builtin_ia32_xsaveopt64 (__P, __M); 50 | } 51 | #endif 52 | 53 | #ifdef __DISABLE_XSAVEOPT__ 54 | #undef __DISABLE_XSAVEOPT__ 55 | #pragma GCC pop_options 56 | #endif /* __DISABLE_XSAVEOPT__ */ 57 | 58 | #endif /* _XSAVEOPTINTRIN_H_INCLUDED */ 59 | -------------------------------------------------------------------------------- /include/intrinsics/xsavesintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XSAVESINTRIN_H_INCLUDED 29 | #define _XSAVESINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVES__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsaves") 34 | #define __DISABLE_XSAVES__ 35 | #endif /* __XSAVES__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsaves (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsaves (__P, __M); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _xrstors (void *__P, long long __M) 47 | { 48 | __builtin_ia32_xrstors (__P, __M); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _xrstors64 (void *__P, long long __M) 55 | { 56 | __builtin_ia32_xrstors64 (__P, __M); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xsaves64 (void *__P, long long __M) 62 | { 63 | __builtin_ia32_xsaves64 (__P, __M); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_XSAVES__ 68 | #undef __DISABLE_XSAVES__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_XSAVES__ */ 71 | 72 | #endif /* _XSAVESINTRIN_H_INCLUDED */ 73 | -------------------------------------------------------------------------------- /include/intrinsics/xtestintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XTESTINTRIN_H_INCLUDED 29 | #define _XTESTINTRIN_H_INCLUDED 30 | 31 | #ifndef __RTM__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rtm") 34 | #define __DISABLE_RTM__ 35 | #endif /* __RTM__ */ 36 | 37 | /* Return non-zero if the instruction executes inside an RTM or HLE code 38 | region. Return zero otherwise. */ 39 | extern __inline int 40 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 41 | _xtest (void) 42 | { 43 | return __builtin_ia32_xtest (); 44 | } 45 | 46 | #ifdef __DISABLE_RTM__ 47 | #undef __DISABLE_RTM__ 48 | #pragma GCC pop_options 49 | #endif /* __DISABLE_RTM__ */ 50 | 51 | #endif /* _XTESTINTRIN_H_INCLUDED */ 52 | -------------------------------------------------------------------------------- /load_balancer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(enc) 5 | add_subdirectory(host) 6 | 7 | add_custom_target(load_balancer DEPENDS load_balancer_host load_balancer_enc 8 | load_balancer_sign_enc) 9 | -------------------------------------------------------------------------------- /load_balancer/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | all: build 5 | 6 | build: 7 | $(MAKE) -C enc 8 | $(MAKE) -C host 9 | 10 | clean: 11 | $(MAKE) -C enc clean 12 | $(MAKE) -C host clean 13 | 14 | run: 15 | host/load_balancer_host ./enc/load_balancer_enc.signed -port:12341 -suboram_name:localhost -suboram_port:12346 16 | -------------------------------------------------------------------------------- /load_balancer/enc/.balancer.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/load_balancer/enc/.balancer.h.swp -------------------------------------------------------------------------------- /load_balancer/enc/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | include ../../config.mk 5 | 6 | CFLAGS=$(shell pkg-config oeenclave-$(C_COMPILER) --cflags) 7 | CXXFLAGS=$(shell pkg-config oeenclave-$(CXX_COMPILER) --cflags) 8 | LDFLAGS=$(shell pkg-config oeenclave-$(CXX_COMPILER) --libs) 9 | INCDIR=$(shell pkg-config oeenclave-$(C_COMPILER) --variable=includedir) 10 | CRYPTO_LDFLAGS=$(shell pkg-config oeenclave-$(COMPILER) --variable=${OE_CRYPTO_LIB}libs) 11 | 12 | .PHONY: all build clean run 13 | 14 | SRC_FILES = ecalls.cpp openssl_server.cpp balancer.cpp test_balancer.cpp obl_primitives.cpp cert_verify_config.cpp ../../common/verify_callback.cpp ../../common/utility.cpp ../../common/openssl_utility.cpp ../../common/crypto.cpp ../../common/block.cpp 15 | OBJ_FILES = ecalls.o openssl_server.o balancer.o test_balancer.o obl_primitives.o cert_verify_config.o verify_callback.o utility.o openssl_utility.o load_balancer_t.o crypto.o block.o 16 | 17 | all: 18 | $(MAKE) build 19 | $(MAKE) sign 20 | 21 | build: 22 | @ echo "Compilers used: $(CC), $(CXX)" 23 | oeedger8r ../load_balancer.edl --trusted \ 24 | --trusted-dir . \ 25 | --search-path $(INCDIR) \ 26 | --search-path $(INCDIR)/openenclave/edl/sgx 27 | 28 | 29 | $(CXX) -g -c $(CXXFLAGS) $(INCLUDES) -I. -std=c++11 ${SRC_FILES} 30 | $(CC) -c $(CFLAGS) $(CINCLUDES) -I. load_balancer_t.c 31 | $(CXX) -o load_balancer_enc $(OBJ_FILES) $(LDFLAGS) $(CRYPTO_LDFLAGS) -loehostsock -loehostresolver 32 | 33 | sign: 34 | oesign sign -e load_balancer_enc -c enc.conf -k private.pem 35 | oesign dump -e load_balancer_enc.signed > temp.dmp 36 | chmod u+x ../../gen_mrenclave_header.sh 37 | ../../gen_mrenclave_header.sh ../../common/load_balancer_enc_mrenclave.h temp.dmp 38 | rm temp.dmp 39 | 40 | clean: 41 | rm -f *.o load_balancer_enc load_balancer_enc.signed load_balancer_enc.signed.so load_balancer_t.* load_balancer_args.h yy ../../common/load_balancer_enc_mrenclave.h 42 | -------------------------------------------------------------------------------- /load_balancer/enc/_log.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef OE_SAMPLES_ATTESTATION_ENC_LOG_H 5 | #define OE_SAMPLES_ATTESTATION_ENC_LOG_H 6 | 7 | #include 8 | 9 | #define TRACE_ENCLAVE(fmt, ...) \ 10 | \ 11 | printf("Enclave: ***%s(%d): " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__) 12 | 13 | #endif // OE_SAMPLES_ATTESTATION_ENC_LOG_H 14 | -------------------------------------------------------------------------------- /load_balancer/enc/balancer.h: -------------------------------------------------------------------------------- 1 | #ifndef _BALANCER_ 2 | #define _BALANCER_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "../../common/block.h" 14 | #include "../../common/bucket_sort.h" 15 | 16 | using namespace std; 17 | using namespace lb_types; 18 | 19 | class Batch { 20 | public: 21 | vector incoming_reqs; 22 | vector outgoing_reqs; 23 | vector suboram_responses; 24 | vector client_responses; 25 | uint32_t reqs_per_suboram; 26 | EnclaveBucketSorter outgoing_req_sorter; 27 | EnclaveBucketSorter client_resp_sorter; 28 | 29 | 30 | Batch(uint32_t reqs_per_suboram) : reqs_per_suboram(reqs_per_suboram) {} 31 | void add_incoming_request(KeyBlockPairBucketItem req); 32 | void add_suboram_response(KeyBlockPairBucketItem req); 33 | 34 | }; 35 | 36 | class LoadBalancer { 37 | public: 38 | size_t num_suborams; 39 | vectorclient_comm_key; 40 | vectorsuboram_comm_key; 41 | mapclient_replay_ctr_in; 42 | vectorsuboram_replay_ctr_in; 43 | mapclient_replay_ctr_out; 44 | vectorsuboram_replay_ctr_out; 45 | map> suboram_key_map; 46 | int num_threads; 47 | 48 | LoadBalancer(size_t n, size_t num_blocks, int num_threads = 1); 49 | void create_outgoing_batch(Batch &b); 50 | void match_responses_to_clients(Batch &b); 51 | void worker_loop(int thread_id); 52 | void stop_workers(); 53 | 54 | private: 55 | enum class WorkerFn{ 56 | create_outgoing_batch, 57 | match_responses_to_clients, 58 | stop, 59 | }; 60 | struct worker_state { 61 | WorkerFn fn; 62 | Batch *curr_batch; 63 | int n_done; 64 | int curr_iter = 0; 65 | }; 66 | std::mutex m; 67 | std::condition_variable cv; 68 | worker_state state; 69 | 70 | void notify_workers(WorkerFn fn); 71 | void wait_for_workers(); 72 | 73 | EVP_CIPHER_CTX *suboram_key; 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /load_balancer/enc/cert_verify_config.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | #include "cert_verify_config.h" 4 | 5 | /* On the server side, we can't verify claim. During the build process, 6 | CLIENT_ENCLAVE_MRENCLAVE is not available as client image is built later. 7 | We can only verify the claim value of server or client, but not both. 8 | `verify_claim_value` always returns OE_OK so that it can work with common 9 | code in identity_verifier.cpp */ 10 | 11 | oe_result_t verify_claim_value(const oe_claim_t* claim) 12 | { 13 | oe_result_t result = OE_OK; 14 | printf("\nverify unique_id:\n"); 15 | for (size_t i = 0; i < claim->value_size; i++) 16 | printf("0x%x ", (uint8_t)claim->value[i]); 17 | printf("\n"); 18 | return result; 19 | } 20 | -------------------------------------------------------------------------------- /load_balancer/enc/cert_verify_config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef ATTLESTED_TLS_ENCLAVE_CONFIG 5 | #define ATTLESTED_TLS_ENCLAVE_CONFIG 6 | 7 | #include 8 | #include 9 | #include "../../common/common.h" 10 | #include "../../common/tls_client_enc_pubkey.h" 11 | #include "../../common/suboram_enc_pubkey.h" 12 | #include "../../common/suboram_enc_mrenclave.h" 13 | #define TLS_ENCLAVE TLS_SERVER 14 | 15 | oe_result_t verify_claim_value(const oe_claim_t* claim); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /load_balancer/enc/ecalls.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include "../../common/load_balancer_server_enc_pubkey.h" 6 | #include "../../common/load_balancer_client_enc_pubkey.h" 7 | #include "load_balancer_t.h" 8 | 9 | #include 10 | 11 | typedef struct _enclave_config_data 12 | { 13 | uint8_t* enclave_secret_data; 14 | const char* server_pubkey_pem; 15 | size_t server_pubkey_pem_size; 16 | const char* client_pubkey_pem; 17 | size_t client_pubkey_pem_size; 18 | } enclave_config_data_t; 19 | 20 | // For this purpose of this example: demonstrating how to do remote attestation 21 | // g_enclave_secret_data is hardcoded as part of the enclave. In this sample, 22 | // the secret data is hard coded as part of the enclave binary. In a real world 23 | // enclave implementation, secrets are never hard coded in the enclave binary 24 | // since the enclave binary itself is not encrypted. Instead, secrets are 25 | // acquired via provisioning from a service (such as a cloud server) after 26 | // successful attestation. 27 | // The g_enclave_secret_data holds the secret data specific to the holding 28 | // enclave, it's only visible inside this secured enclave. Arbitrary enclave 29 | // specific secret data exchanged by the enclaves. In this sample, the first 30 | // enclave sends its g_enclave_secret_data (encrypted) to the second enclave. 31 | // The second enclave decrypts the received data and adds it to its own 32 | // g_enclave_secret_data, and sends it back to the other enclave. 33 | #define ENCLAVE_SECRET_DATA_SIZE 16 34 | 35 | uint8_t g_enclave_secret_data[ENCLAVE_SECRET_DATA_SIZE] = 36 | {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; 37 | 38 | enclave_config_data_t config_data = {g_enclave_secret_data, 39 | SERVER_PUBKEY, 40 | sizeof(SERVER_PUBKEY), 41 | CLIENT_PUBKEY, 42 | sizeof(CLIENT_PUBKEY)}; 43 | 44 | // Declare a static dispatcher object for enabling 45 | // for better organizing enclave-wise global variables 46 | // static ecall_dispatcher dispatcher("Enclave1", &config_data); 47 | const char* enclave_name = "LoadBalancer"; 48 | -------------------------------------------------------------------------------- /load_balancer/enc/enc.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | # Enclave settings: 5 | Debug=1 6 | NumHeapPages=524288 7 | NumStackPages=1024 8 | NumTCS=4 9 | ProductID=1 10 | SecurityVersion=1 11 | -------------------------------------------------------------------------------- /load_balancer/enc/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /load_balancer/enc/public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /load_balancer/enc/test_balancer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "balancer.h" 4 | #include "test_balancer.h" 5 | 6 | using namespace std; 7 | 8 | void test_balancer() { 9 | int num_suborams = 10; 10 | int num_reqs = 100; 11 | int num_blocks = 2048; 12 | int total_out_reqs = num_suborams * num_reqs; 13 | printf("Going to create load balancer\n"); 14 | 15 | 16 | LoadBalancer lb(num_suborams, num_blocks, 1); 17 | printf("Going to create batch\n"); 18 | Batch batch = Batch(num_reqs); 19 | printf("Created batch\n"); 20 | uint8_t block[BLOCK_LEN]; 21 | for (int i = 0; i < num_reqs; i++) { 22 | batch.add_incoming_request(KeyBlockPairBucketItem(i, i, block)); 23 | } 24 | printf("Created %d requests\n", num_reqs); 25 | 26 | lb.create_outgoing_batch(batch); 27 | printf("Finished batch with %d subORAMs and %d reqs\n", num_suborams, num_reqs); 28 | for (int i = 0; i < batch.outgoing_reqs.size(); i++) { 29 | printf("%d/%zu: Req %d assigned to %d\n", i+1, batch.outgoing_reqs.size(), batch.outgoing_reqs[i].item.req.key, batch.outgoing_reqs[i].item.SID); 30 | } 31 | printf("Done with testing load balancer\n"); 32 | } 33 | 34 | int main() { 35 | test_balancer(); 36 | } 37 | -------------------------------------------------------------------------------- /load_balancer/enc/test_balancer.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_BALANCER_ 2 | #define _TEST_BALANCER_ 3 | 4 | void test_balancer(); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /load_balancer/host/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | add_custom_command( 5 | OUTPUT load_balancer_u.h load_balancer_u.c load_balancer_args.h 6 | DEPENDS ${CMAKE_SOURCE_DIR}/load_balancer/load_balancer.edl 7 | COMMAND 8 | openenclave::oeedger8r --untrusted 9 | ${CMAKE_SOURCE_DIR}/load_balancer/load_balancer.edl --search-path ${OE_INCLUDEDIR} 10 | --search-path ${OE_INCLUDEDIR}/openenclave/edl/sgx) 11 | 12 | add_executable(load_balancer_host host.cpp 13 | ../../common/crypto.cpp 14 | ../../common/block.cpp 15 | ../../common/bucket_sort.cpp 16 | ${CMAKE_CURRENT_BINARY_DIR}/load_balancer_u.c) 17 | 18 | include_directories(${PROTOBUF_INCLUDE_DIRS} ${PROTO_GRPC_DIR} ${BOOST_DIR}) 19 | 20 | target_include_directories(load_balancer_host 21 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 22 | 23 | target_link_libraries(load_balancer_host 24 | PRIVATE log 25 | openenclave::oehost 26 | oram_grpc_proto 27 | ${_REFLECTION} 28 | ${_GRPC_GRPCPP} 29 | ${_PROTOBUF_LIBPROTOBUF}) 30 | -------------------------------------------------------------------------------- /load_balancer/host/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | include ../../config.mk 5 | 6 | CFLAGS=$(shell pkg-config oehost-$(C_COMPILER) --cflags) 7 | CXXFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --cflags) 8 | LDFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --libs) 9 | INCDIR=$(shell pkg-config oehost-$(C_COMPILER) --variable=includedir) 10 | 11 | all: build 12 | 13 | build: 14 | @ echo "Compilers used: $(CC), $(CXX)" 15 | oeedger8r ../load_balancer.edl --untrusted \ 16 | --search-path $(INCDIR) \ 17 | --search-path $(INCDIR)/openenclave/edl/sgx 18 | $(CC) -c $(CFLAGS) $(CINCLUDES) load_balancer_u.c 19 | $(CXX) -c $(CXXFLAGS) $(INCLUDES) host.cpp ../../common/crypto.cpp ../../common/block.cpp 20 | $(CXX) -o load_balancer_host host.o load_balancer_u.o $(LDFLAGS) 21 | 22 | clean: 23 | rm -f load_balancer_host* *.o load_balancer_u.* load_balancer_args.h 24 | -------------------------------------------------------------------------------- /load_balancer/host/rpc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/load_balancer/host/rpc.cpp -------------------------------------------------------------------------------- /load_balancer/load_balancer.edl: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | enclave { 5 | from "openenclave/edl/syscall.edl" import *; 6 | from "platform.edl" import *; 7 | 8 | trusted { 9 | public void init_load_balancer(int num_suborams, int num_blocks, int num_threads); 10 | public void create_batch(uint8_t **in_ct_arr, uint8_t **in_iv_arr, 11 | uint8_t **in_tag_arr, uint32_t *in_client_id_arr, uint8_t 12 | **out_ct_arr, uint8_t **out_iv_arr, uint8_t **out_tag_arr, int 13 | num_reqs, int reqs_per_suboram); 14 | public void match_responses_to_reqs(uint8_t **in_ct_arr, uint8_t **in_iv_arr, uint8_t **in_tag_arr, uint32_t *in_client_id_arr, uint8_t **out_ct_arr, uint8_t **out_iv_arr, uint8_t **out_tag_arr); 15 | public void start_worker_loop(int thread_id); 16 | public void stop_workers(); 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /planner/bench/micro_balancer_make_batch.dat: -------------------------------------------------------------------------------- 1 | 1 64 991 2 | 1 128 784 3 | 1 256 1499 4 | 1 512 3392 5 | 1 1024 8046 6 | 1 2048 17462 7 | 1 4096 27695 8 | 1 8192 55326 9 | 1 16384 118998 10 | 1 32768 344131 11 | 1 65536 1829904 12 | 1 131072 4138269 13 | 1 262144 9485257 14 | 2 64 1217 15 | 2 128 1098 16 | 2 256 1741 17 | 2 512 3620 18 | 2 1024 7612 19 | 2 2048 16967 20 | 2 4096 28323 21 | 2 8192 60888 22 | 2 16384 117328 23 | 2 32768 398193 24 | 2 65536 1762331 25 | 2 131072 4020812 26 | 2 262144 9555498 27 | 3 64 1213 28 | 3 128 1430 29 | 3 256 1921 30 | 3 512 3568 31 | 3 1024 7562 32 | 3 2048 17374 33 | 3 4096 30375 34 | 3 8192 58004 35 | 3 16384 122550 36 | 3 32768 415551 37 | 3 65536 1806689 38 | 3 131072 4196419 39 | 3 262144 9665959 40 | 4 64 1444 41 | 4 128 1373 42 | 4 256 3474 43 | 4 512 4002 44 | 4 1024 7833 45 | 4 2048 17718 46 | 4 4096 30662 47 | 4 8192 57192 48 | 4 16384 123996 49 | 4 32768 333839 50 | 4 65536 1751141 51 | 4 131072 4214482 52 | 4 262144 9766312 53 | 5 64 1588 54 | 5 128 1386 55 | 5 256 2584 56 | 5 512 4245 57 | 5 1024 8470 58 | 5 2048 17742 59 | 5 4096 30373 60 | 5 8192 68436 61 | 5 16384 120029 62 | 5 32768 373235 63 | 5 65536 1784270 64 | 5 131072 4300999 65 | 5 262144 9604293 66 | 6 64 1937 67 | 6 128 1685 68 | 6 256 2839 69 | 6 512 4497 70 | 6 1024 8498 71 | 6 2048 18465 72 | 6 4096 31787 73 | 6 8192 60187 74 | 6 16384 125082 75 | 6 32768 457520 76 | 6 65536 1826475 77 | 6 131072 4267011 78 | 6 262144 9745204 79 | 7 64 1970 80 | 7 128 1850 81 | 7 256 2803 82 | 7 512 4598 83 | 7 1024 8463 84 | 7 2048 18574 85 | 7 4096 30609 86 | 7 8192 61334 87 | 7 16384 134260 88 | 7 32768 365376 89 | 7 65536 1821277 90 | 7 131072 4450665 91 | 7 262144 9646061 92 | 8 64 2168 93 | 8 128 1804 94 | 8 256 2900 95 | 8 512 6124 96 | 8 1024 9662 97 | 8 2048 19437 98 | 8 4096 33236 99 | 8 8192 63311 100 | 8 16384 169147 101 | 8 32768 412252 102 | 8 65536 1823527 103 | 8 131072 4282159 104 | 8 262144 9753240 105 | 9 64 2170 106 | 9 128 1805 107 | 9 256 3152 108 | 9 512 6028 109 | 9 1024 9474 110 | 9 2048 26883 111 | 9 4096 32817 112 | 9 8192 62128 113 | 9 16384 129383 114 | 9 32768 414108 115 | 9 65536 1760682 116 | 9 131072 4243441 117 | 9 262144 9710302 118 | 10 64 2418 119 | 10 128 1922 120 | 10 256 3323 121 | 10 512 6298 122 | 10 1024 11295 123 | 10 2048 20559 124 | 10 4096 33115 125 | 10 8192 66045 126 | 10 16384 137521 127 | 10 32768 404985 128 | 10 65536 1787217 129 | 10 131072 4238477 130 | 10 262144 9754086 131 | -------------------------------------------------------------------------------- /planner/bench/micro_balancer_match_resps.dat: -------------------------------------------------------------------------------- 1 | 1 64 692 2 | 1 128 1256 3 | 1 256 2128 4 | 1 512 4260 5 | 1 1024 9122 6 | 1 2048 18938 7 | 1 4096 33954 8 | 1 8192 71910 9 | 1 16384 160194 10 | 1 32768 416314 11 | 1 65536 1848860 12 | 1 131072 4249092 13 | 1 262144 9716769 14 | 2 64 884 15 | 2 128 1381 16 | 2 256 2582 17 | 2 512 4621 18 | 2 1024 9489 19 | 2 2048 19439 20 | 2 4096 36945 21 | 2 8192 72544 22 | 2 16384 144395 23 | 2 32768 424390 24 | 2 65536 1847660 25 | 2 131072 4309220 26 | 2 262144 9766282 27 | 3 64 990 28 | 3 128 3214 29 | 3 256 3120 30 | 3 512 6150 31 | 3 1024 10095 32 | 3 2048 26165 33 | 3 4096 38131 34 | 3 8192 75900 35 | 3 16384 149981 36 | 3 32768 382522 37 | 3 65536 1868822 38 | 3 131072 4372670 39 | 3 262144 9603561 40 | 4 64 1131 41 | 4 128 1848 42 | 4 256 3170 43 | 4 512 5675 44 | 4 1024 10667 45 | 4 2048 21559 46 | 4 4096 38894 47 | 4 8192 73657 48 | 4 16384 157393 49 | 4 32768 434310 50 | 4 65536 1916054 51 | 4 131072 4322731 52 | 4 262144 9645150 53 | 5 64 1367 54 | 5 128 1998 55 | 5 256 3457 56 | 5 512 5801 57 | 5 1024 16673 58 | 5 2048 23353 59 | 5 4096 40115 60 | 5 8192 77232 61 | 5 16384 175660 62 | 5 32768 556984 63 | 5 65536 1884856 64 | 5 131072 4404092 65 | 5 262144 9778289 66 | 6 64 1410 67 | 6 128 1969 68 | 6 256 3602 69 | 6 512 6058 70 | 6 1024 11245 71 | 6 2048 22489 72 | 6 4096 40017 73 | 6 8192 76900 74 | 6 16384 157409 75 | 6 32768 432344 76 | 6 65536 1893842 77 | 6 131072 4456184 78 | 6 262144 9574686 79 | 7 64 1592 80 | 7 128 2024 81 | 7 256 3583 82 | 7 512 6488 83 | 7 1024 11181 84 | 7 2048 23524 85 | 7 4096 40423 86 | 7 8192 83119 87 | 7 16384 163405 88 | 7 32768 436545 89 | 7 65536 1859926 90 | 7 131072 4415278 91 | 7 262144 9651451 92 | 8 64 1679 93 | 8 128 2286 94 | 8 256 3724 95 | 8 512 6924 96 | 8 1024 11079 97 | 8 2048 22959 98 | 8 4096 40435 99 | 8 8192 78852 100 | 8 16384 208632 101 | 8 32768 387832 102 | 8 65536 1883217 103 | 8 131072 4459409 104 | 8 262144 9755305 105 | 9 64 1652 106 | 9 128 2170 107 | 9 256 4411 108 | 9 512 7001 109 | 9 1024 12022 110 | 9 2048 23717 111 | 9 4096 46581 112 | 9 8192 80039 113 | 9 16384 158592 114 | 9 32768 417827 115 | 9 65536 1892580 116 | 9 131072 4401975 117 | 9 262144 9629361 118 | 10 64 1679 119 | 10 128 2366 120 | 10 256 3955 121 | 10 512 7218 122 | 10 1024 12012 123 | 10 2048 23865 124 | 10 4096 43863 125 | 10 8192 83682 126 | 10 16384 166634 127 | 10 32768 407854 128 | 10 65536 1894058 129 | 10 131072 4418567 130 | 10 262144 9787036 131 | -------------------------------------------------------------------------------- /planner/scaleData.py: -------------------------------------------------------------------------------- 1 | import planner 2 | 3 | data_size = 2**15 4 | latency = 10 5 | ''' 6 | configs = set() 7 | throughputs = dict() 8 | for throughput in range(100, 100000, 100): 9 | #data_size = 2**i 10 | config = planner.getConfigMinCost(latency, throughput, data_size) 11 | configs.add((config["suborams"], config["load_balancers"])) 12 | if (config["suborams"],config["load_balancers"]) not in throughputs: 13 | throughputs[(config["suborams"], config["load_balancers"])] = throughput 14 | 15 | print(throughputs) 16 | print(configs) 17 | ''' 18 | print("bucket sizes") 19 | print(planner.f(1024,128)) 20 | print(planner.f(1024,256)) 21 | print(planner.f(1024,512)) 22 | print(planner.f(1024,1024)) 23 | print(planner.f(1024,2048)) 24 | print("2048") 25 | print(planner.f(2048,128)) 26 | print(planner.f(2048,256)) 27 | print(planner.f(2048,512)) 28 | print(planner.f(2048,1024)) 29 | print(planner.f(2048,2048)) 30 | print(planner.f(2048,4096)) 31 | print("4096") 32 | print(planner.f(4096,128)) 33 | print(planner.f(4096,256)) 34 | print(planner.f(4096,512)) 35 | print(planner.f(4096,1024)) 36 | print(planner.f(4096,2048)) 37 | print(planner.f(4096,4096)) 38 | print(planner.f(4096,8192)) 39 | print("8192") 40 | print(planner.f(8192,128)) 41 | print(planner.f(8192,256)) 42 | print(planner.f(8192,512)) 43 | print(planner.f(8192,1024)) 44 | print(planner.f(8192,2048)) 45 | print(planner.f(8192,4096)) 46 | print(planner.f(8192,8192)) 47 | print(planner.f(8192,16384)) 48 | -------------------------------------------------------------------------------- /planner/scale_throughput_config.dat: -------------------------------------------------------------------------------- 1 | config1 1 1 100 2 | config1 2 1 3800 3 | config1 3 1 16500 4 | config1 4 1 24800 5 | config1 5 1 33000 6 | config2 1 1 100 7 | config2 2 1 8300 8 | config2 3 1 16500 9 | config2 4 1 24800 10 | config2 5 1 33000 11 | config2 5 2 41000 12 | config2 6 2 41200 13 | config2 7 2 49500 14 | config2 8 2 57700 15 | config2 9 2 65900 16 | config2 10 2 74100 17 | config3 1 1 100 18 | config3 2 1 17700 19 | config3 3 2 41000 20 | config3 5 3 82000 21 | config3 5 4 122900 22 | -------------------------------------------------------------------------------- /planner/scale_throughput_cost.dat: -------------------------------------------------------------------------------- 1 | config1 100 1154 2 | config1 3800 1732 3 | config1 16500 2309 4 | config1 24800 2887 5 | config1 33000 3464 6 | config2 100 1154 7 | config2 8300 1732 8 | config2 16500 2309 9 | config2 24800 2887 10 | config2 33000 3464 11 | config2 41000 4042 12 | config2 41200 4619 13 | config2 49500 5196 14 | config2 57700 5774 15 | config2 65900 6351 16 | config2 74100 6929 17 | config3 100 1154 18 | config3 17700 1732 19 | config3 41000 2887 20 | config3 82000 4619 21 | config3 122900 5196 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | azure-mgmt-resource 2 | azure-mgmt-compute 3 | azure-mgmt-network 4 | azure-identity 5 | numpy 6 | matplotlib 7 | seaborn 8 | tqdm 9 | brewer2mpl 10 | -------------------------------------------------------------------------------- /scripts/config/balancer.config: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /scripts/config/balancer_benchmark.config: -------------------------------------------------------------------------------- 1 | { 2 | "balancer_id": 0, 3 | "epoch_ms": 1000, 4 | "listening_port": "12345", 5 | "mode": "bench_match_resps", 6 | "num_blocks": 524288, 7 | "protocol": "our_protocol", 8 | "suboram_addrs": [ 9 | [ 10 | "1.1.1.1:12345" 11 | ], 12 | [ 13 | "1.1.1.1:12345" 14 | ], 15 | [ 16 | "1.1.1.1:12345" 17 | ], 18 | [ 19 | "1.1.1.1:12345" 20 | ], 21 | [ 22 | "1.1.1.1:12345" 23 | ], 24 | [ 25 | "1.1.1.1:12345" 26 | ], 27 | [ 28 | "1.1.1.1:12345" 29 | ], 30 | [ 31 | "1.1.1.1:12345" 32 | ], 33 | [ 34 | "1.1.1.1:12345" 35 | ], 36 | [ 37 | "1.1.1.1:12345" 38 | ] 39 | ], 40 | "threads": 3 41 | } -------------------------------------------------------------------------------- /scripts/config/basic.json: -------------------------------------------------------------------------------- 1 | { 2 | "balancer_ips": [ 3 | "13.68.183.62" 4 | ], 5 | "client_batch_size": 1000, 6 | "client_ips": [ 7 | "23.100.23.73" 8 | ], 9 | "epoch_ms": 500, 10 | "exp_sec": 60, 11 | "experiment_dir": "/results/test/2021:04:06:21:02/", 12 | "experiment_name": "test", 13 | "git_origin": "ucbrise/snoopy.git", 14 | "github_key": "~/.ssh/id_ed25519_snoopy", 15 | "github_pub_key": "~/.ssh/id_ed25519_snoopy.pub", 16 | "image_path": "resourceGroups/sgx3_group/providers/Microsoft.Compute/galleries/images/images/snoopy_2", 17 | "instance_types": { 18 | "balancer": "Standard_DC2s_v2", 19 | "client": "Standard_DC1s_v2", 20 | "suboram": "Standard_DC4s_v2" 21 | }, 22 | "local_project_dir": "/home/azureuser/snoopy/experiments", 23 | "local_src_dir": "/home/azureuser/snoopy", 24 | "location": "eastus", 25 | "log_folder": "log", 26 | "nbbalancers": [ 27 | 1 28 | ], 29 | "nbbatchsz": [ 30 | 1 31 | ], 32 | "nbclients": [ 33 | 1 34 | ], 35 | "nbdatasize": [ 36 | 1024 37 | ], 38 | "nbrepetitions": 1, 39 | "nbsuborams": [ 40 | 1 41 | ], 42 | "num_blocks": 1024, 43 | "num_instances": { 44 | "balancer": 1, 45 | "client": 1, 46 | "suboram": 1 47 | }, 48 | "remote_project_dir": "/home/azureuser/snoopy/experiments", 49 | "replication_factor": 2, 50 | "run_name": "test", 51 | "ssh_key_file": "~/.ssh/scalable_oram.pem", 52 | "ssh_key_pub": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkRPpE2bKwHmOW/gsG1mOHcz8T7JdGlIjz3YU7/RW8sRFaikUiA240Z+1SIsw+QbHFAbyhy9+OLOLQRN8CF9/cS+DU3BKXECGJP1dkiSPVs9tk9+Gfx2TILdHnY3tD0ylFKQYftNgin6OABUsTS//DFjEYbmGSDU+DGIvWSOirByWq0sQChX/SOueFAHWE2iO+ohINoZnFwAhYmwpV2feb7J3dK6DWVyne0JpNplodvhOaFA3hCRUnrJeAPb+WUrCsTdProkMLZOV1dpqq2N++VUWv690VUxZ+gzqGo7JkG2Vh02DuQlCarQ5AmY9o6Ws4O7fUS/CJ08hPISMy6brX", 53 | "suboram_ips": [ 54 | [ 55 | "13.92.211.232", 56 | "13.92.231.71" 57 | ] 58 | ], 59 | "suboram_protocol": "our_protocol", 60 | "suboram_threads": 3, 61 | "threads": 16, 62 | "username": "azureuser" 63 | } 64 | -------------------------------------------------------------------------------- /scripts/config/client.config: -------------------------------------------------------------------------------- 1 | { 2 | "exp_sec": 60, 3 | "experiment_dir": "results/oblix_adaptive_scale_throughput/2021:08:18:01:43", 4 | "lb_addrs": [ 5 | "52.249.248.252:12345", 6 | "52.152.230.248:12345", 7 | "52.152.231.32:12345", 8 | "52.152.231.86:12345", 9 | "52.152.231.88:12345" 10 | ], 11 | "num_blocks": 1024, 12 | "run_name": "test_out", 13 | "threads": 100 14 | } -------------------------------------------------------------------------------- /scripts/config/client2.config: -------------------------------------------------------------------------------- 1 | { 2 | "exp_sec": 60, 3 | "experiment_dir": "/results/oblix_small_adaptive_scale_throughput/2021:05:07:19:01/", 4 | "lb_addrs": [ 5 | "13.90.119.10:12345" 6 | ], 7 | "num_blocks": 1024, 8 | "run_name": "test_out", 9 | "threads": 100 10 | } -------------------------------------------------------------------------------- /scripts/config/lb.config: -------------------------------------------------------------------------------- 1 | { 2 | "epoch_ms": 1000, 3 | "listening_port": "12345", 4 | "num_blocks": 1024, 5 | "suboram_addrs": [ 6 | [ 7 | "52.152.231.105:12346" 8 | ], 9 | [ 10 | "52.152.224.64:12346" 11 | ], 12 | [ 13 | "52.152.224.72:12346" 14 | ], 15 | [ 16 | "52.152.224.82:12346" 17 | ], 18 | [ 19 | "52.152.224.101:12346" 20 | ], 21 | [ 22 | "52.249.251.137:12346" 23 | ], 24 | [ 25 | "52.152.224.107:12346" 26 | ], 27 | [ 28 | "20.102.53.220:12346" 29 | ], 30 | [ 31 | "13.68.243.155:12346" 32 | ], 33 | [ 34 | "13.68.240.28:12346" 35 | ], 36 | [ 37 | "52.152.224.148:12346" 38 | ], 39 | [ 40 | "52.152.224.164:12346" 41 | ], 42 | [ 43 | "52.152.224.227:12346" 44 | ], 45 | [ 46 | "52.152.231.136:12346" 47 | ], 48 | [ 49 | "52.152.231.181:12346" 50 | ] 51 | ], 52 | "threads": 1 53 | } -------------------------------------------------------------------------------- /scripts/config/lb2.config: -------------------------------------------------------------------------------- 1 | { 2 | "epoch_ms": 1000, 3 | "listening_port": "12345", 4 | "num_blocks": 1024, 5 | "suboram_addrs": [ 6 | [ 7 | "13.68.239.175:12346" 8 | ], 9 | [ 10 | "52.170.95.77:12346" 11 | ], 12 | [ 13 | "40.117.58.103:12346" 14 | ], 15 | [ 16 | "104.211.54.106:12346" 17 | ] 18 | ], 19 | "threads": 1 20 | } -------------------------------------------------------------------------------- /scripts/config/machines.json: -------------------------------------------------------------------------------- 1 | { 2 | "balancer_ips": [ 3 | "52.249.248.252", 4 | "52.152.230.248", 5 | "52.152.231.32", 6 | "52.152.231.86", 7 | "52.152.231.88" 8 | ], 9 | "balancer_private_ips": [ 10 | "10.0.0.5", 11 | "10.0.0.6", 12 | "10.0.0.7", 13 | "10.0.0.8", 14 | "10.0.0.9" 15 | ], 16 | "client_ips": [ 17 | "52.249.250.5" 18 | ], 19 | "client_private_ips": [ 20 | "10.0.0.4" 21 | ], 22 | "suboram_ips": [ 23 | [ 24 | "52.152.231.105" 25 | ], 26 | [ 27 | "52.152.224.64" 28 | ], 29 | [ 30 | "52.152.224.72" 31 | ], 32 | [ 33 | "52.152.224.82" 34 | ], 35 | [ 36 | "52.152.224.101" 37 | ], 38 | [ 39 | "52.249.251.137" 40 | ], 41 | [ 42 | "52.152.224.107" 43 | ], 44 | [ 45 | "20.102.53.220" 46 | ], 47 | [ 48 | "13.68.243.155" 49 | ], 50 | [ 51 | "13.68.240.28" 52 | ], 53 | [ 54 | "52.152.224.148" 55 | ], 56 | [ 57 | "52.152.224.164" 58 | ], 59 | [ 60 | "52.152.224.227" 61 | ], 62 | [ 63 | "52.152.231.136" 64 | ], 65 | [ 66 | "52.152.231.181" 67 | ] 68 | ], 69 | "suboram_private_ips": [ 70 | [ 71 | "10.0.0.10" 72 | ], 73 | [ 74 | "10.0.0.11" 75 | ], 76 | [ 77 | "10.0.0.12" 78 | ], 79 | [ 80 | "10.0.0.13" 81 | ], 82 | [ 83 | "10.0.0.14" 84 | ], 85 | [ 86 | "10.0.0.15" 87 | ], 88 | [ 89 | "10.0.0.16" 90 | ], 91 | [ 92 | "10.0.0.17" 93 | ], 94 | [ 95 | "10.0.0.18" 96 | ], 97 | [ 98 | "10.0.0.19" 99 | ], 100 | [ 101 | "10.0.0.20" 102 | ], 103 | [ 104 | "10.0.0.21" 105 | ], 106 | [ 107 | "10.0.0.22" 108 | ], 109 | [ 110 | "10.0.0.23" 111 | ], 112 | [ 113 | "10.0.0.24" 114 | ] 115 | ] 116 | } -------------------------------------------------------------------------------- /scripts/config/my.cnf: -------------------------------------------------------------------------------- 1 | innodb 2 | default-storage-engine=innodb 3 | default-tmp-storage-engine=MyISAM 4 | log-bin=node-0-bin 5 | sync_binlog=0 6 | binlog_format=ROW 7 | collation-server=latin1_bin 8 | transaction-isolation=REPEATABLE-READ 9 | innodb_flush_log_at_trx_commit=2 10 | innodb_flush_method=O_DIRECT 11 | innodb_page_size=8K 12 | innodb_buffer_pool_size=1G 13 | #basedir=/usr/local/mysql 14 | #datadir=/users/samehdi/data 15 | port = 3306 16 | 17 | # sync_relay_log_info=100 18 | # relay_log_recovery=1 19 | # relay_log_info_repository=FILE 20 | # innodb_purge_threads=8 21 | # innodb_compression_pad_pct_max=37 22 | # innodb_compression_failure_threshold_pct=10 23 | # innodb_flush_neighbors=0 24 | # innodb_old_blocks_pct=50 25 | # innodb_max_dirty_pages_pct=75 26 | # innodb_max_dirty_pages_pct_lwm=0 27 | # innodb_adaptive_flushing=1 28 | # innodb_adaptive_flushing_lwm=10 29 | # innodb_adaptive_hash_index=0 30 | # innodb_flushing_avg_loops=30 31 | # innodb_max_purge_lag=0 32 | # innodb_max_purge_lag_delay=0 33 | # eq_range_index_dive_limit=1000 34 | # gtid_mode=OFF 35 | # enforce_gtid_consistency=ON 36 | #lock_wait_timeout=1 37 | # part_scan_max=1000 38 | # ssl=0 39 | # plugin_load= 40 | # skip_temp_pool=0 41 | # long_query_time=10 42 | # wait_timeout=10 43 | # interactive_timeout=120 44 | # max_allowed_packet=128M 45 | # slave_max_allowed_packet=256M 46 | # skip_name_resolve 47 | # back_log=4096 48 | 49 | max_connections=5000 50 | max_user_connections=4000 51 | # max_connect_errors=3000 52 | 53 | # key_buffer_size=16M 54 | # myisam_sort_buffer_size=256M 55 | # max_tmp_tables=64 56 | # read_buffer_size=1M 57 | # read_rnd_buffer_size=1M 58 | # sort_buffer_size=2M 59 | # table_open_cache=50000 60 | # table_definition_cache=60000 61 | # query_cache_limit=4M 62 | # query_cache_size=0 63 | # query_cache_type=0 64 | # thread_cache_size=500 65 | # thread_stack=196608 66 | # open_files_limit=32767 67 | # net_read_timeout=15 68 | # net_write_timeout=30 69 | # tmp_table_size=64M 70 | # max_heap_table_size=512M 71 | # log_slow_extra=1 72 | # group_concat_max_len=1024 73 | # innodb_compression_level=1 74 | 75 | # innodb_deadlock_detect=0 76 | # innodb_file_format=Barracuda 77 | # innodb_file_per_table=1 78 | # innodb_lock_wait_timeout=2 79 | # innodb_log_buffer_size=4M 80 | # innodb_log_compressed_pages=0 81 | # innodb_log_file_size=2000M 82 | # innodb_old_blocks_time=1000 83 | # innodb_open_files=10240 84 | # innodb_read_io_threads=32 85 | # innodb_stats_on_metadata=0 86 | # innodb_thread_concurrency=256 87 | # innodb_write_io_threads=4 88 | # innodb_zlib_wrap=0 89 | # innodb_enable_slave_update_table_stats=1 90 | # innodb_io_capacity=1000 91 | # innodb_io_capacity_max=2000 92 | # innodb_lru_scan_depth=1024 93 | 94 | sql_mode=NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION #,STRICT_TRANS_TABLES 95 | -------------------------------------------------------------------------------- /scripts/config/scaleBatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "balancer_ips": [ 3 | "23.101.141.107" 4 | ], 5 | "client_ips": [ 6 | "23.100.16.60" 7 | ], 8 | "exp_sec": 60, 9 | "experiment_dir": "/results/scale_batch/2021:04:20:21:09/", 10 | "experiment_name": "scale_batch", 11 | "git_origin": "ucbrise/snoopy.git", 12 | "github_key": "~/.ssh/id_ed25519_snoopy", 13 | "github_pub_key": "~/.ssh/id_ed25519_snoopy.pub", 14 | "image_path": "resourceGroups/sgx3_group/providers/Microsoft.Compute/galleries/images/images/snoopy_2", 15 | "instance_types": { 16 | "balancer": "Standard_DC2s_v2", 17 | "client": "Standard_DC1s_v2", 18 | "suboram": "Standard_DC4s_v2" 19 | }, 20 | "local_project_dir": "/home/azureuser/snoopy/experiments", 21 | "local_src_dir": "/home/azureuser/snoopy", 22 | "location": "eastus", 23 | "log_folder": "log", 24 | "nbbalancers": [ 25 | 1 26 | ], 27 | "nbbatchsz": [ 28 | 32, 29 | 64, 30 | 128, 31 | 256, 32 | 512, 33 | 1024, 34 | 2048, 35 | 4096, 36 | 8192 37 | ], 38 | "nbclients": [ 39 | 1 40 | ], 41 | "nbdatasize": [ 42 | 131072 43 | ], 44 | "nbepochms": [ 45 | 100 46 | ], 47 | "nbrepetitions": 1, 48 | "nbsuborams": [ 49 | 1 50 | ], 51 | "num_blocks": 1024, 52 | "num_instances": { 53 | "balancer": 1, 54 | "client": 1, 55 | "suboram": 1 56 | }, 57 | "remote_project_dir": "/home/azureuser/snoopy/experiments", 58 | "replication_factor": 1, 59 | "run_name": "test", 60 | "sort_protocol": "bitonic_sort", 61 | "ssh_key_file": "~/.ssh/scalable_oram.pem", 62 | "ssh_key_pub": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkRPpE2bKwHmOW/gsG1mOHcz8T7JdGlIjz3YU7/RW8sRFaikUiA240Z+1SIsw+QbHFAbyhy9+OLOLQRN8CF9/cS+DU3BKXECGJP1dkiSPVs9tk9+Gfx2TILdHnY3tD0ylFKQYftNgin6OABUsTS//DFjEYbmGSDU+DGIvWSOirByWq0sQChX/SOueFAHWE2iO+ohINoZnFwAhYmwpV2feb7J3dK6DWVyne0JpNplodvhOaFA3hCRUnrJeAPb+WUrCsTdProkMLZOV1dpqq2N++VUWv690VUxZ+gzqGo7JkG2Vh02DuQlCarQ5AmY9o6Ws4O7fUS/CJ08hPISMy6brX", 63 | "suboram_ips": [ 64 | [ 65 | "104.41.144.22" 66 | ] 67 | ], 68 | "suboram_protocol": "our_protocol", 69 | "threads": 16, 70 | "suboram_threads": 3, 71 | "balancer_threads": 4, 72 | "username": "azureuser" 73 | } 74 | -------------------------------------------------------------------------------- /scripts/config/suboram.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12346", 3 | "mode": "server", 4 | "num_blocks": 1024, 5 | "oblix_baseline": { 6 | "160": { 7 | "10": 0.00023065090179443358, 8 | "100": 0.00029450440406799316, 9 | "1000": 0.00034726834297180175, 10 | "10000": 0.0004075307846069336, 11 | "100000": 0.0004960217475891113, 12 | "1000000": 0.0006062004566192627, 13 | "2000000": 0.0006139371395111084 14 | } 15 | }, 16 | "run_name": "test", 17 | "sort_type": "bitonic_sort" 18 | } -------------------------------------------------------------------------------- /scripts/config/suboram2.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12346", 3 | "mode": "server", 4 | "num_blocks": 1024, 5 | "oblix_baseline": { 6 | "160": { 7 | "10": 0.00023065090179443358, 8 | "100": 0.00029450440406799316, 9 | "1000": 0.00034726834297180175, 10 | "10000": 0.0004075307846069336, 11 | "100000": 0.0004960217475891113, 12 | "1000000": 0.0006062004566192627, 13 | "2000000": 0.0006139371395111084 14 | } 15 | }, 16 | "run_name": "test", 17 | "sort_type": "bitonic_sort" 18 | } -------------------------------------------------------------------------------- /scripts/config/suboram_benchmark.config: -------------------------------------------------------------------------------- 1 | { 2 | "listening_port": "12346", 3 | "mode": "bench_process_batch", 4 | "num_balancers": 1, 5 | "num_blocks": 33554432, 6 | "num_suborams": 1, 7 | "oblix_baseline": { 8 | "160": { 9 | "10": 0.00023065090179443358, 10 | "100": 0.00029450440406799316, 11 | "1000": 0.00034726834297180175, 12 | "10000": 0.0004075307846069336, 13 | "100000": 0.0004960217475891113, 14 | "1000000": 0.0006062004566192627, 15 | "2000000": 0.0006139371395111084 16 | } 17 | }, 18 | "protocol": "our_protocol", 19 | "protocol_type": "our_protocol", 20 | "run_name": "test", 21 | "sort_type": "bitonic_sort", 22 | "suboram_id": 0, 23 | "threads": 2 24 | } -------------------------------------------------------------------------------- /scripts/fig/balancers_vs_latency.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | 9 | out_name = sys.argv[2] 10 | in_name = sys.argv[1] 11 | print(("Out: %s") % (out_name)) 12 | print(("In: %s") % (in_name)) 13 | block_sz = 160 14 | 15 | ''' 16 | # ./app osm insert-one 1 100000 17 | oblix_insert_latency=0.014399878978729248 18 | #./app osm search 1 100000 1 19 | oblix_search_latency=0.00820251226425171 20 | oblix_avg_latency = (oblix_insert_latency + oblix_search_latency) / 2.0 21 | oblix_throughput = 1.0 / oblix_avg_latency 22 | ''' 23 | oblix_latency = 0.0008669505119 24 | oblix_throughput = 1.0 / oblix_latency 25 | 26 | data = util.parseDataNew2(in_name) 27 | balancers = util.getListOfVals(data, "balancers") 28 | latency = [] 29 | oblix_latencies = [] 30 | for balancer in balancers: 31 | print(balancer) 32 | latency.append(util.getLatencyForMaxThroughputForNumBalancers(data, balancer)) 33 | oblix_latencies.append(oblix_latency) 34 | 35 | 36 | print(balancers) 37 | print(latency) 38 | 39 | fig = plt.figure(figsize = (8,8)) 40 | ax = fig.add_subplot(111) 41 | ax.plot(balancers, latency, color=custom_style.hash_colors[0], label="Dumbo") 42 | ax.plot(balancers, oblix_latencies, color=custom_style.hash_colors[1], label="Oblix (1 machine)") 43 | print("plotted") 44 | ax.set_xlabel("Load balancers") 45 | ax.set_ylabel("Latency (ms)") 46 | #ax.set_yticks([20 * (2 ** 20), 40 * (2 ** 20), 60 * (2 ** 20), 80 * (2 ** 20), 100 * (2 ** 20)]) 47 | #ax.set_yticklabels(["20MB", "40MB", "60MB", "80MB", "100MB"]) 48 | plt.legend() 49 | 50 | #ax.spines['left'].set_position("zero") 51 | #ax.spines['bottom'].set_position("zero") 52 | 53 | remove_chart_junk(plt,ax) 54 | custom_style.save_fig(fig, out_name, [3, 2.5]) 55 | -------------------------------------------------------------------------------- /scripts/fig/balancers_vs_throughput.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | import config 9 | 10 | out_name = sys.argv[2] 11 | in_name = sys.argv[1] 12 | print(("Out: %s") % (out_name)) 13 | print(("In: %s") % (in_name)) 14 | block_sz = 160 15 | 16 | ''' 17 | # ./app osm insert-one 1 100000 18 | oblix_insert_latency=0.014399878978729248 19 | #./app osm search 1 100000 1 20 | oblix_search_latency=0.00820251226425171 21 | oblix_avg_latency = (oblix_insert_latency + oblix_search_latency) / 2.0 22 | oblix_throughput = 1.0 / oblix_avg_latency 23 | ''' 24 | oblix_latency = 0.0008669505119 25 | oblix_throughput = 1.0 / oblix_latency 26 | # obladi throughput for 2M blocks 27 | obladi_throughput = 6375 28 | 29 | data = util.parseDataNew2(in_name) 30 | balancers = util.getListOfVals(data, "balancers") 31 | throughput = [] 32 | oblix_throughputs = [] 33 | obladi_throughputs = [] 34 | for balancer in balancers: 35 | throughput.append(util.getMaxThroughputForNumBalancers(data, balancer)) 36 | oblix_throughputs.append(oblix_throughput) 37 | obladi_throughputs.append(obladi_throughput) 38 | 39 | print(balancers) 40 | print(throughput) 41 | print("hi") 42 | 43 | fig = plt.figure(figsize = (8,8)) 44 | ax = fig.add_subplot(111) 45 | ax.plot(balancers, throughput, color=config.dumbo_color, label="Dumbo", marker=config.dumbo_marker) 46 | ax.plot(balancers, oblix_throughputs, color=config.oblix_color, label="Oblix (1 machine)", marker=config.oblix_marker) 47 | ax.plot(balancers, obladi_throughputs, color=config.obladi_color, label="Obladi (1 machine)", marker=config.obladi_marker) 48 | ax.set_xlabel("Load balancers") 49 | ax.set_ylabel("Throughput (reqs/sec)") 50 | #ax.set_yticks([20 * (2 ** 20), 40 * (2 ** 20), 60 * (2 ** 20), 80 * (2 ** 20), 100 * (2 ** 20)]) 51 | #ax.set_yticklabels(["20MB", "40MB", "60MB", "80MB", "100MB"]) 52 | plt.legend() 53 | 54 | #ax.spines['left'].set_position("zero") 55 | ax.spines['bottom'].set_position("zero") 56 | 57 | remove_chart_junk(plt,ax) 58 | custom_style.save_fig(fig, out_name, [3, 2.5]) 59 | -------------------------------------------------------------------------------- /scripts/fig/balancers_vs_throughput_bounded.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | 9 | out_name = sys.argv[2] 10 | in_name = sys.argv[1] 11 | print(("Out: %s") % (out_name)) 12 | print(("In: %s") % (in_name)) 13 | block_sz = 160 14 | 15 | ''' 16 | # ./app osm insert-one 1 100000 17 | oblix_insert_latency=0.014399878978729248 18 | #./app osm search 1 100000 1 19 | oblix_search_latency=0.00820251226425171 20 | oblix_avg_latency = (oblix_insert_latency + oblix_search_latency) / 2.0 21 | oblix_throughput = 1.0 / oblix_avg_latency 22 | ''' 23 | oblix_latency = 0.0008669505119 24 | oblix_throughput = 1.0 / oblix_latency 25 | 26 | max_latencies = [100,200,300,400,10000] 27 | 28 | data = util.parseDataNew2(in_name) 29 | balancers = util.getListOfVals(data, "balancers") 30 | actual_balancers = [] 31 | throughput = [] 32 | oblix_throughputs = [] 33 | oblix_balancers = [] 34 | for max_latency in max_latencies: 35 | throughput.append([]) 36 | actual_balancers.append([]) 37 | index = len(throughput) - 1 38 | for balancer in balancers: 39 | val = util.getMaxThroughputForNumBalancersWithMaxLatency(data, balancer, max_latency) 40 | if val > 0: 41 | throughput[index].append(val) 42 | actual_balancers[index].append(balancer) 43 | 44 | for balancer in balancers: 45 | oblix_throughputs.append(oblix_throughput) 46 | oblix_balancers.append(balancer) 47 | print(balancers) 48 | print(throughput) 49 | 50 | fig = plt.figure(figsize = (8,8)) 51 | ax = fig.add_subplot(111) 52 | for i in range(len(throughput)): 53 | ax.plot(actual_balancers[i], throughput[i], label=("Dumbo (max latency=%d ms)") % (max_latencies[i])) 54 | ax.plot(oblix_balancers, oblix_throughputs, color=custom_style.hash_colors[1], label="Oblix (1 machine)") 55 | ax.set_xlabel("Load balancers") 56 | ax.set_ylabel("Throughput (reqs/sec)") 57 | #ax.set_yticks([20 * (2 ** 20), 40 * (2 ** 20), 60 * (2 ** 20), 80 * (2 ** 20), 100 * (2 ** 20)]) 58 | #ax.set_yticklabels(["20MB", "40MB", "60MB", "80MB", "100MB"]) 59 | #plt.legend() 60 | 61 | #ax.spines['left'].set_position("zero") 62 | ax.spines['bottom'].set_position("zero") 63 | 64 | print("HI") 65 | 66 | remove_chart_junk(plt,ax) 67 | custom_style.save_fig(fig, out_name, [3, 2.5]) 68 | -------------------------------------------------------------------------------- /scripts/fig/baselines.json: -------------------------------------------------------------------------------- 1 | { 2 | "oblix_latency": 0.0008669505119, 3 | "obladi_throughput": 6716 4 | } 5 | -------------------------------------------------------------------------------- /scripts/fig/config.py: -------------------------------------------------------------------------------- 1 | oblix_color = "#d95f02" 2 | obladi_color = "#7570b3" 3 | dumbo_color = "#1b9e77" 4 | redis_color = "#e7298a" 5 | dumbo_marker = "o" 6 | oblix_marker = "s" 7 | obladi_marker = "^" 8 | obladi_line = (0, (3, 1)) 9 | oblix_line = (0, (1, 1)) 10 | 11 | purple_sequence_colors = ["#b3cde3", "#8c96c6", "#88419d"] 12 | blue_sequence_colors = ["#a1dab4", "#41b6c4", "#225ea8"] 13 | pink_sequence_colors = ["#f768a1", "#c51b8a", "#7a0177"] 14 | red_sequence_colors = ["#feb24c", "#f03b20", "#e31a1c"] 15 | green_sequence_colors = ["#b2e2e2","#66c2a4","#238b45"] 16 | planner_colors = ["#377eb8","#4daf4a","#984ea3"] 17 | planner_markers = ["o", "^", "*"] 18 | -------------------------------------------------------------------------------- /scripts/fig/dumbo_figs.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/dumbo_figs.key -------------------------------------------------------------------------------- /scripts/fig/epoch_time.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | 9 | out_name = sys.argv[2] 10 | in_name = sys.argv[1] 11 | print(("Out: %s") % (out_name)) 12 | print(("In: %s") % (in_name)) 13 | block_sz = 160 14 | 15 | data = util.parseDataNew2(in_name) 16 | 17 | throughput = [] 18 | latency = [] 19 | 20 | for elem in data: 21 | if len(throughput) > 0 and (elem["throughput"] < throughput[len(throughput) - 1]): 22 | continue 23 | throughput.append(elem["throughput"]) 24 | latency.append(elem["mean_latency"]) 25 | 26 | print(throughput) 27 | print(latency) 28 | 29 | fig = plt.figure(figsize = (8,8)) 30 | ax = fig.add_subplot(111) 31 | ax.plot(throughput, latency, color=custom_style.hash_colors[0]) 32 | ax.set_xlabel("Throughput (reqs/sec)") 33 | ax.set_ylabel("Latency (ms)") 34 | #ax.set_yticks([100 * (2 ** 20), 200 * (2 ** 20), 300 * (2 ** 20), 400 * (2 ** 20), 500 * (2 ** 20)]) 35 | #ax.set_yticklabels(["100MB", "200MB", "300MB", "400MB", "500MB"]) 36 | 37 | remove_chart_junk(plt,ax) 38 | custom_style.save_fig(fig, out_name, [3, 2.5]) 39 | -------------------------------------------------------------------------------- /scripts/fig/load_balancer.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/load_balancer.graffle -------------------------------------------------------------------------------- /scripts/fig/load_balancer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/load_balancer.png -------------------------------------------------------------------------------- /scripts/fig/load_balancer_make_batches.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/load_balancer_make_batches.graffle -------------------------------------------------------------------------------- /scripts/fig/load_balancer_match_resps.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/load_balancer_match_resps.graffle -------------------------------------------------------------------------------- /scripts/fig/micro_balancer_make_batch.dat: -------------------------------------------------------------------------------- 1 | 1 64 999 2 | 1 128 800 3 | 1 256 1538 4 | 1 512 3540 5 | 1 1024 7966 6 | 1 2048 16149 7 | 1 4096 28817 8 | 1 8192 60451 9 | 1 16384 139748 10 | 2 64 1113 11 | 2 128 1103 12 | 2 256 1776 13 | 2 512 3473 14 | 2 1024 8318 15 | 2 2048 16347 16 | 2 4096 28785 17 | 2 8192 61907 18 | 2 16384 118463 19 | 3 64 1185 20 | 3 128 1180 21 | 3 256 1906 22 | 3 512 3609 23 | 3 1024 7508 24 | 3 2048 16855 25 | 3 4096 31292 26 | 3 8192 64916 27 | 3 16384 134938 28 | 4 64 1289 29 | 4 128 1293 30 | 4 256 2416 31 | 4 512 4058 32 | 4 1024 7891 33 | 4 2048 24471 34 | 4 4096 30316 35 | 4 8192 65246 36 | 4 16384 137626 37 | 5 64 2598 38 | 5 128 1373 39 | 5 256 2635 40 | 5 512 4450 41 | 5 1024 8465 42 | 5 2048 18390 43 | 5 4096 30290 44 | 5 8192 63417 45 | 5 16384 131415 46 | 6 64 1898 47 | 6 128 1544 48 | 6 256 2616 49 | 6 512 4394 50 | 6 1024 8389 51 | 6 2048 20119 52 | 6 4096 30569 53 | 6 8192 59310 54 | 6 16384 126360 55 | 7 64 1865 56 | 7 128 1658 57 | 7 256 2709 58 | 7 512 4487 59 | 7 1024 8417 60 | 7 2048 18264 61 | 7 4096 30212 62 | 7 8192 60662 63 | 7 16384 121958 64 | 8 64 2073 65 | 8 128 1994 66 | 8 256 3195 67 | 8 512 6021 68 | 8 1024 9410 69 | 8 2048 20311 70 | 8 4096 32113 71 | 8 8192 60642 72 | 8 16384 140546 73 | 9 64 2216 74 | 9 128 1800 75 | 9 256 3193 76 | 9 512 6113 77 | 9 1024 9934 78 | 9 2048 21327 79 | 9 4096 32656 80 | 9 8192 61469 81 | 9 16384 132412 82 | 10 64 2401 83 | 10 128 2052 84 | 10 256 3432 85 | 10 512 6334 86 | 10 1024 9882 87 | 10 2048 19848 88 | 10 4096 35499 89 | 10 8192 68006 90 | 10 16384 128982 91 | -------------------------------------------------------------------------------- /scripts/fig/micro_balancer_make_batch.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | from collections import defaultdict 5 | import sys 6 | import numpy as np 7 | import math 8 | import util 9 | 10 | out_name = sys.argv[2] 11 | in_name = sys.argv[1] 12 | 13 | print(("Out: %s") % (out_name)) 14 | print(("In: %s") % (in_name)) 15 | block_sz = 160 16 | 17 | reqs = defaultdict(list) 18 | micros = defaultdict(list) 19 | suborams = set() 20 | with open(in_name, 'r') as f: 21 | lines = f.readlines() 22 | for line in lines: 23 | arr = line.split() 24 | suboram = int(arr[0]) 25 | suborams.add(suboram) 26 | reqs[suboram].append(int(arr[1])) 27 | micros[suboram].append(float(int(arr[2])) / 1000.0) 28 | 29 | fig = plt.figure(figsize = (8,8)) 30 | ax = fig.add_subplot(111) 31 | 32 | index = 0 33 | ''' 34 | for suboram in suborams: 35 | ax.plot(reqs[suboram], micros[suboram], color=custom_style.hash_colors[index], label=("%d suborams") % (suboram)) 36 | print(suboram) 37 | print(reqs[suboram]) 38 | print(micros[suboram]) 39 | ''' 40 | ax.plot(reqs[1], micros[1], color=custom_style.hash_colors[0], marker='o') 41 | ax.set_xlabel("Requests") 42 | ax.set_ylabel("Time (ms)") 43 | #ax.set_yticks([20 * (2 ** 20), 40 * (2 ** 20), 60 * (2 ** 20), 80 * (2 ** 20), 100 * (2 ** 20)]) 44 | #ax.set_yticklabels(["20MB", "40MB", "60MB", "80MB", "100MB"]) 45 | 46 | remove_chart_junk(plt,ax) 47 | custom_style.save_fig(fig, out_name, [3, 2.5]) 48 | -------------------------------------------------------------------------------- /scripts/fig/micro_balancer_match_resps.dat: -------------------------------------------------------------------------------- 1 | 1 64 721 2 | 1 128 1219 3 | 1 256 2183 4 | 1 512 4335 5 | 1 1024 8995 6 | 1 2048 19001 7 | 1 4096 33897 8 | 1 8192 68540 9 | 1 16384 141054 10 | 2 64 1554 11 | 2 128 1412 12 | 2 256 2504 13 | 2 512 4960 14 | 2 1024 9530 15 | 2 2048 19272 16 | 2 4096 38871 17 | 2 8192 71996 18 | 2 16384 160020 19 | 3 64 1133 20 | 3 128 1510 21 | 3 256 3041 22 | 3 512 5315 23 | 3 1024 10313 24 | 3 2048 20315 25 | 3 4096 38665 26 | 3 8192 77382 27 | 3 16384 166892 28 | 4 64 1197 29 | 4 128 1881 30 | 4 256 3126 31 | 4 512 5583 32 | 4 1024 10340 33 | 4 2048 23512 34 | 4 4096 39156 35 | 4 8192 76569 36 | 4 16384 152047 37 | 5 64 1197 38 | 5 128 1988 39 | 5 256 3247 40 | 5 512 5703 41 | 5 1024 10472 42 | 5 2048 23410 43 | 5 4096 39156 44 | 5 8192 74658 45 | 5 16384 157095 46 | 6 64 1373 47 | 6 128 2022 48 | 6 256 3630 49 | 6 512 6227 50 | 6 1024 11332 51 | 6 2048 22310 52 | 6 4096 39819 53 | 6 8192 82448 54 | 6 16384 161032 55 | 7 64 1612 56 | 7 128 2009 57 | 7 256 3695 58 | 7 512 6837 59 | 7 1024 11578 60 | 7 2048 22702 61 | 7 4096 42899 62 | 7 8192 80921 63 | 7 16384 209695 64 | 8 64 1468 65 | 8 128 2230 66 | 8 256 3650 67 | 8 512 6892 68 | 8 1024 11213 69 | 8 2048 23564 70 | 8 4096 50613 71 | 8 8192 79773 72 | 8 16384 162739 73 | 9 64 1683 74 | 9 128 2146 75 | 9 256 3874 76 | 9 512 7498 77 | 9 1024 11893 78 | 9 2048 23821 79 | 9 4096 44007 80 | 9 8192 82883 81 | 9 16384 181011 82 | 10 64 1745 83 | 10 128 2315 84 | 10 256 4002 85 | 10 512 7482 86 | 10 1024 11863 87 | 10 2048 24971 88 | 10 4096 43134 89 | 10 8192 88467 90 | 10 16384 199611 91 | -------------------------------------------------------------------------------- /scripts/fig/micro_balancer_match_resps.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | from collections import defaultdict 5 | import sys 6 | import numpy as np 7 | import math 8 | import util 9 | 10 | out_name = sys.argv[2] 11 | in_name = sys.argv[1] 12 | 13 | print(("Out: %s") % (out_name)) 14 | print(("In: %s") % (in_name)) 15 | block_sz = 160 16 | 17 | reqs = defaultdict(list) 18 | micros = defaultdict(list) 19 | suborams = set() 20 | with open(in_name, 'r') as f: 21 | lines = f.readlines() 22 | for line in lines: 23 | arr = line.split() 24 | suboram = int(arr[0]) 25 | suborams.add(suboram) 26 | reqs[suboram].append(int(arr[1])) 27 | micros[suboram].append(float(int(arr[2])) / 1000.0) 28 | 29 | fig = plt.figure(figsize = (8,8)) 30 | ax = fig.add_subplot(111) 31 | 32 | index = 0 33 | ''' 34 | for suboram in suborams: 35 | ax.plot(reqs[suboram], micros[suboram], color=custom_style.hash_colors[index], label=("%d suborams") % (suboram)) 36 | print(suboram) 37 | print(reqs[suboram]) 38 | print(micros[suboram]) 39 | ''' 40 | ax.plot(reqs[1], micros[1], color=custom_style.hash_colors[0], marker='o'); 41 | ax.set_xlabel("Requests") 42 | ax.set_ylabel("Time (ms)") 43 | #ax.set_yticks([20 * (2 ** 20), 40 * (2 ** 20), 60 * (2 ** 20), 80 * (2 ** 20), 100 * (2 ** 20)]) 44 | #ax.set_yticklabels(["20MB", "40MB", "60MB", "80MB", "100MB"]) 45 | 46 | remove_chart_junk(plt,ax) 47 | custom_style.save_fig(fig, out_name, [3, 2.5]) 48 | -------------------------------------------------------------------------------- /scripts/fig/micro_suboram.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | from collections import defaultdict 5 | import sys 6 | import numpy as np 7 | import math 8 | import util 9 | 10 | out_name = sys.argv[2] 11 | in_name = sys.argv[1] 12 | 13 | print(("Out: %s") % (out_name)) 14 | print(("In: %s") % (in_name)) 15 | block_sz = 160 16 | 17 | algs = ["hash_table", "bucket_sort"] 18 | colors = [custom_style.hash_colors[0], custom_style.hash_colors[1]] 19 | labels = ["Hash table", "Bucket sort"] 20 | 21 | blocks = defaultdict(list) 22 | ms = defaultdict(list) 23 | with open(in_name, 'r') as f: 24 | lines = f.readlines() 25 | for line in lines: 26 | arr = line.split() 27 | alg = arr[0] 28 | blocks[alg].append(int(arr[1])) 29 | ms[alg].append(float(arr[2])) 30 | 31 | fig = plt.figure(figsize = (8,8)) 32 | ax = fig.add_subplot(111) 33 | 34 | index = 0 35 | ''' 36 | for suboram in suborams: 37 | ax.plot(reqs[suboram], micros[suboram], color=custom_style.hash_colors[index], label=("%d suborams") % (suboram)) 38 | print(suboram) 39 | print(reqs[suboram]) 40 | print(micros[suboram]) 41 | ''' 42 | for i, alg in enumerate(algs): 43 | ax.plot(blocks[alg], ms[alg], color=colors[i], label=labels[i], marker='o') 44 | ax.set_xlabel("Blocks") 45 | ax.set_ylabel("Time (ms)") 46 | #ax.set_xticks([500000, 1000000, 1500000]) 47 | #ax.set_xticklabels(["500K", "1M", "1.5M"]) 48 | plt.legend() 49 | 50 | remove_chart_junk(plt,ax) 51 | custom_style.save_fig(fig, out_name, [3, 2.5]) 52 | -------------------------------------------------------------------------------- /scripts/fig/parallel_legend.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | from matplotlib.lines import Line2D 12 | import pylab 13 | import config 14 | 15 | out_name = sys.argv[2] 16 | in_name = sys.argv[1] 17 | 18 | legend_labels= ["1 thread", "2 threads", "3 threads", "Adaptive"] 19 | colors = [config.pink_sequence_colors[0], config.pink_sequence_colors[1], config.pink_sequence_colors[2], config.green_sequence_colors[2]] 20 | markers = ["o", "o", "o", "^"] 21 | 22 | fig = plt.figure(figsize=(10,8)) 23 | 24 | legend_elements = [] 25 | for i in range(len(legend_labels)): 26 | legend_elements.append(Line2D([0],[0],color=colors[i], label=legend_labels[i], marker=markers[i])) 27 | 28 | fig.legend(bbox_to_anchor=(0, 0.0, 1, 1), mode='expand', 29 | handles=legend_elements, fontsize=8, ncol=4, loc="center", handlelength=1.5, borderpad=0.2, 30 | borderaxespad=0, labelspacing=1, columnspacing=1, handletextpad=0.7) 31 | 32 | custom_style.save_fig(fig, out_name, [3.3, 0.3]) 33 | plt.savefig("temp.pdf") 34 | -------------------------------------------------------------------------------- /scripts/fig/params_alphas.py: -------------------------------------------------------------------------------- 1 | import util 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import matplotlib.pyplot as plt 6 | 7 | out_name = sys.argv[2] 8 | in_name = sys.argv[1] 9 | 10 | def plot_alphas(n_suborams=10): 11 | """ 12 | x-axis: # total real requests received by LB 13 | y-axis: # total requests sent out by LB 14 | lines: ideal + varying secparam values 15 | """ 16 | secparams = [32, 64, 128] 17 | fig = plt.figure(figsize=(8,8)) 18 | ax = fig.add_subplot(111) 19 | targets = list(range(100, 50001, 100)) 20 | ax.plot(targets, [1/n_suborams] * len(targets), label="Ideal (no security)") 21 | ax.plot(targets, [1] * len(targets), label="Naive (replicate to all subORAMs)") 22 | for secparam in secparams: 23 | alphas = [] 24 | for target in targets: 25 | bound = util.f(target, n_suborams, secparam) 26 | alphas.append(bound / target) 27 | ax.plot(targets, alphas, label=r"Our bound ($\lambda=%d$)" % secparam) 28 | ax.set_xlabel("Total real requests (N)") 29 | ax.set_ylabel(r"Value of $\alpha$ in $f(N) = \alpha\cdot N$, S=%d" % n_suborams) 30 | plt.legend() 31 | remove_chart_junk(plt,ax) 32 | custom_style.save_fig(fig, out_name, [3, 2.5]) 33 | 34 | plot_alphas(10) 35 | -------------------------------------------------------------------------------- /scripts/fig/params_overheads.py: -------------------------------------------------------------------------------- 1 | import util 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import matplotlib.pyplot as plt 6 | import config 7 | 8 | out_name = sys.argv[2] 9 | in_name = sys.argv[1] 10 | 11 | colors = ["#3A63AD", "#3BB58F","#3AA5D1"] 12 | 13 | def plot_overheads(secparam=128): 14 | """ 15 | x-axis: # total real requests received by LB 16 | y-axis: # total requests sent out by LB 17 | lines: ideal + varying secparam values 18 | """ 19 | fig = plt.figure(figsize=(8,8)) 20 | #ax = fig.add_subplot(111) 21 | ax = fig.add_axes([0.25, 0.21, 0.7, 0.65]) 22 | suborams = [1, 10, 20] 23 | targets = list(range(100, 10001, 100)) 24 | for i, n_suborams in enumerate(suborams): 25 | overhead = [] 26 | for target in targets: 27 | bound = util.f(target, n_suborams, secparam) 28 | total_req = bound * n_suborams 29 | overhead.append(100 * (total_req - target) / target) 30 | label = "%d" % n_suborams 31 | ax.plot(targets, overhead, label=label, color=config.blue_sequence_colors[i]) 32 | ax.set_xlabel("Real requests") 33 | ax.set_ylabel(r"%% Overhead ($\lambda=%d$)" % secparam) 34 | ax.set_ylim(bottom=0, top=200) 35 | ax.set_xticks([0,5000,10000]) 36 | ax.set_xticklabels(["0", "5K", "10K"]) 37 | leg = fig.legend(bbox_to_anchor=(0.01, 0.91, 0.98, .1), ncol=3, loc='lower left', fontsize=8, handlelength=1.25, borderpad=0.2, 38 | borderaxespad=0, labelspacing=0, columnspacing=0.5, handletextpad=0.25, 39 | mode='expand', title="\# SubORAMs:", title_fontsize=8) 40 | custom_style.legend_title_left(leg) 41 | #plt.legend(bbox_to_anchor=(0.1, 0.75, 1., -.102), loc='lower left', ncol=1, borderaxespad=0., fontsize=7,labelspacing=0) 42 | remove_chart_junk(plt,ax) 43 | custom_style.save_fig(fig, out_name, [1.6,1.4]) 44 | plt.savefig("temp.pdf") 45 | 46 | plot_overheads() 47 | -------------------------------------------------------------------------------- /scripts/fig/params_scaling_capacity.py: -------------------------------------------------------------------------------- 1 | import util 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import matplotlib.pyplot as plt 6 | import config 7 | 8 | out_name = sys.argv[2] 9 | in_name = sys.argv[1] 10 | colors = ["#A86BD1","#3AA5D1","#E65F8E"] 11 | 12 | def plot_scaling_capacity(batchsize=1000): 13 | """ 14 | x-axis: # total real requests received by LB 15 | y-axis: # total requests sent out by LB 16 | lines: ideal + varying secparam values 17 | """ 18 | secparams = [80, 128] 19 | fig = plt.figure(figsize=(8,8)) 20 | ax = fig.add_axes([0.25, 0.21, 0.7, 0.65]) 21 | suborams = list(range(1, 21)) 22 | theoretical = [batchsize * s for s in suborams] 23 | ax.plot(suborams, theoretical, label="0 (no security)", color=config.purple_sequence_colors[0]) 24 | for i,secparam in enumerate(secparams): 25 | total_reqs = [] 26 | for n_suborams in suborams: 27 | total_req = util.max_requests(n_suborams, batchsize, secparam) 28 | total_reqs.append(total_req) 29 | ax.plot(suborams, total_reqs, label="%d$" % secparam,color=config.purple_sequence_colors[i+1]) 30 | ax.set_xlabel("SubORAMs") 31 | ax.set_ylabel("Real request capacity") 32 | ax.set_yticks([5000,10000,15000,20000]) 33 | ax.set_yticklabels(["5K", "10K", "15K", "20K"]) 34 | ax.set_xticks([0,10,20]) 35 | leg = fig.legend(bbox_to_anchor=(0.01, 0.91, 0.98, .1), ncol=3, loc='lower left', fontsize=8, handlelength=1, borderpad=0.2, 36 | borderaxespad=0, labelspacing=0, columnspacing=0.5, handletextpad=0.25, 37 | mode='expand', title="$\lambda$:", title_fontsize=8) 38 | custom_style.legend_title_left(leg) 39 | #plt.legend(bbox_to_anchor=(0.1, 1.0, 1., -.102), loc='lower left', ncol=1, borderaxespad=0., fontsize=7,labelspacing=0) 40 | #plt.legend(bbox_to_anchor=(0.1, 0.75, 1., -.102), loc='lower left', ncol=1, borderaxespad=0., fontsize=7,labelspacing=0) 41 | #plt.legend() 42 | remove_chart_junk(plt,ax) 43 | custom_style.save_fig(fig, out_name, [1.6, 1.4]) 44 | plt.savefig("temp.pdf") 45 | 46 | plot_scaling_capacity(1000) 47 | -------------------------------------------------------------------------------- /scripts/fig/params_varying_N.py: -------------------------------------------------------------------------------- 1 | import util 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import matplotlib.pyplot as plt 6 | 7 | out_name = sys.argv[2] 8 | in_name = sys.argv[1] 9 | 10 | def plot_bounds_varying_N(n_suborams=25): 11 | """ 12 | x-axis: # total real requests received by LB 13 | y-axis: # total requests sent out by LB 14 | lines: ideal + varying secparam values 15 | """ 16 | secparams = [32, 64, 128] 17 | fig = plt.figure(figsize=(8,8)) 18 | ax = fig.add_subplot(111) 19 | targets = list(range(100, 50001, 100)) 20 | ax.plot(targets, targets, label="Ideal (no security)") 21 | for secparam in secparams: 22 | totals = [] 23 | for target in targets: 24 | bound = util.f(target, n_suborams, secparam) 25 | totals.append(bound * n_suborams) 26 | ax.plot(targets, totals, label="Actual + Dummy (secparam=%d)" % secparam) 27 | ax.set_xlabel("Total real requests (N)") 28 | ax.set_ylabel("Total requests (f(N) * S, S=%d)" % n_suborams) 29 | plt.legend() 30 | remove_chart_junk(plt,ax) 31 | custom_style.save_fig(fig, out_name, [3, 2.5]) 32 | plt.savefig("temp.pdf") 33 | 34 | plot_bounds_varying_N(25) 35 | -------------------------------------------------------------------------------- /scripts/fig/planner_legend.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | from matplotlib.lines import Line2D 12 | import pylab 13 | import config 14 | 15 | out_name = sys.argv[2] 16 | in_name = sys.argv[1] 17 | 18 | labels = ["1M objects", "10K objects"] 19 | markers = ["o","^"] 20 | 21 | fig = plt.figure(figsize=(10,8)) 22 | 23 | legend_elements = [] 24 | for i in range(len(labels)): 25 | legend_elements.append(Line2D([0],[0],color='w',markerfacecolor=config.planner_colors[i], label=labels[i], marker=markers[i], markersize=7)) 26 | 27 | legend_elements.reverse() 28 | 29 | fig.legend(handles=legend_elements, fontsize=8, ncol=3, loc="center", labelspacing=0) 30 | 31 | custom_style.save_fig(fig, out_name, [5.0, 1.0]) 32 | 33 | -------------------------------------------------------------------------------- /scripts/fig/scale_breakdown_1024.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | import scipy.special 12 | from scipy.special import lambertw 13 | from scale_breakdown import makeBreakdownFig 14 | 15 | import argparse 16 | from util import parse_args 17 | 18 | parser = argparse.ArgumentParser(description='Plot scale breakdown.') 19 | args = parse_args(parser) 20 | in_name, out_name = args.input, args.output 21 | 22 | print("update") 23 | makeBreakdownFig(in_name, out_name, 2**10, "$2^{10}$ objects", args) 24 | -------------------------------------------------------------------------------- /scripts/fig/scale_breakdown_1048576.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | import scipy.special 12 | from scipy.special import lambertw 13 | from scale_breakdown import makeBreakdownFig 14 | 15 | import argparse 16 | from util import parse_args 17 | 18 | parser = argparse.ArgumentParser(description='Plot suborams vs. data size.') 19 | args = parse_args(parser) 20 | in_name, out_name = args.input, args.output 21 | 22 | print("update") 23 | makeBreakdownFig(in_name, out_name, 2**20, "$2^{20}$ objects", args) 24 | -------------------------------------------------------------------------------- /scripts/fig/scale_breakdown_32768.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | from matplotlib.ticker import FuncFormatter 7 | import math 8 | from collections import defaultdict 9 | from matplotlib.patches import Patch 10 | import scipy.special 11 | from scipy.special import lambertw 12 | from scale_breakdown import makeBreakdownFig 13 | 14 | import argparse 15 | from util import parse_args 16 | 17 | parser = argparse.ArgumentParser(description='Plot scale breakdown.') 18 | args = parse_args(parser) 19 | in_name, out_name = args.input, args.output 20 | 21 | print("update") 22 | makeBreakdownFig(in_name, out_name, 2**15, "$2^{15}$ objects", args) 23 | -------------------------------------------------------------------------------- /scripts/fig/scale_breakdown_legend.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | import pylab 12 | 13 | out_name = sys.argv[2] 14 | in_name = sys.argv[1] 15 | 16 | legend_labels= ["Load balancer\n(make batch)", "SubORAM\n(process batch)", "Load balancer\n(match responses)"] 17 | colors=["#FFCA3E","#FF6F50","#D03454"] 18 | 19 | fig = plt.figure(figsize=(10,8)) 20 | 21 | legend_elements = [] 22 | for i in range(len(legend_labels)): 23 | legend_elements.append(Patch(color=colors[i], label=legend_labels[i])) 24 | 25 | fig.legend(bbox_to_anchor=(0, 0.0, 1, 1), mode='expand', 26 | handles=legend_elements, fontsize=8, ncol=3, loc="center", handlelength=1.5, borderpad=0.2, 27 | borderaxespad=0, labelspacing=1, columnspacing=1, handletextpad=0.7) 28 | 29 | custom_style.save_fig(fig, out_name, [3.3, 0.3]) 30 | plt.savefig("temp.pdf") 31 | 32 | -------------------------------------------------------------------------------- /scripts/fig/scale_data.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | import config 9 | 10 | import argparse 11 | from util import parse_args 12 | 13 | parser = argparse.ArgumentParser(description='Plot suborams vs. data size.') 14 | args = parse_args(parser) 15 | in_name, out_name = args.input, args.output 16 | print(("Out: %s") % (out_name)) 17 | print(("In: %s") % (in_name)) 18 | block_sz = 160 19 | 20 | max_latency_ms = 160 21 | latency_types = ["mean_latency"] 22 | 23 | data = util.parseDataNew2(in_name) 24 | suborams = sorted(util.getListOfVals(data, "suborams")) 25 | datasize = [] 26 | for latency_type in latency_types: 27 | datasize.append([]) 28 | index = len(datasize) - 1 29 | for suboram in suborams: 30 | datasize[index].append(util.getMaxDataForNumSuborams(data, suboram, max_latency_ms, latency_type)) 31 | 32 | print(suborams) 33 | print(datasize) 34 | 35 | fig = plt.figure(figsize = (8,8)) 36 | ax = fig.add_subplot(111) 37 | for i in range(len(latency_types)): 38 | ax.plot(suborams, datasize[i], color=config.dumbo_color, marker=config.dumbo_marker, label="Snoopy") 39 | ax.set_xlabel("SubORAMs") 40 | ax.set_ylabel("Number of objects") 41 | #ax.set_yticks([0.5 * (10 ** 6), 1 * (10 ** 6), 1.5 * (10 ** 6), 2 * (10 ** 6), 2.5*10**6, 3*10**6]) 42 | #ax.set_yticklabels(["0.5M", "1M", "1.5M", "2M", "2.5M", "3M"]) 43 | ax.set_yticks([0, 1e6, 2e6, 3e6]) 44 | ax.set_yticklabels(["0", "1M", "2M", "3M"]) 45 | #plt.legend() 46 | 47 | remove_chart_junk(plt,ax, grid=True) 48 | if args.title: 49 | ax.set_title(args.title) 50 | if args.large: 51 | plt.legend() 52 | custom_style.save_fig(fig, out_name, [2.5, 2], pad=0.3) 53 | else: 54 | custom_style.save_fig(fig, out_name, [1.8, 1.5]) 55 | plt.savefig("temp.pdf") 56 | -------------------------------------------------------------------------------- /scripts/fig/sort_parallel.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | import config 9 | 10 | import argparse 11 | from util import parse_args 12 | 13 | parser = argparse.ArgumentParser(description='Plot suborams vs. data size.') 14 | args = parse_args(parser) 15 | in_name, out_name = args.input, args.output 16 | print(("Out: %s") % (out_name)) 17 | print(("In: %s") % (in_name)) 18 | 19 | colors = ["#62BEB6", "#0B9A8D", "#077368", "#ED5C8B"] 20 | 21 | thread1 = [] 22 | thread2 = [] 23 | thread4 = [] 24 | smart = [] 25 | blocks = [2**i for i in range(10,17)] 26 | 27 | with open(in_name, "r") as f: 28 | lines = f.readlines() 29 | for line in lines: 30 | times = line.split() 31 | thread1.append(float(times[0])) 32 | thread2.append(float(times[1])) 33 | thread4.append(float(times[2])) 34 | smart.append(float(times[3])) 35 | 36 | fig = plt.figure(figsize = (8,8)) 37 | ax = fig.add_subplot(111) 38 | ax.plot(blocks, thread1, color=config.pink_sequence_colors[0], label="1 thread", marker="o") 39 | ax.plot(blocks, thread2, color=config.pink_sequence_colors[1], label="2 threads", marker="o") 40 | ax.plot(blocks, thread4, color=config.pink_sequence_colors[2], label="4 threads", marker="o") 41 | ax.plot(blocks, smart, color=config.green_sequence_colors[2], label="Adaptive", marker="^") 42 | ax.set_xlabel("Objects") 43 | ax.set_ylabel("Sort Time (ms)") 44 | ax.set_xscale("log") 45 | ax.set_yscale("log") 46 | #plt.legend(bbox_to_anchor=(-0.3, 1.0, 1., -.102), loc='lower left', ncol=2, borderaxespad=0., fontsize=7,labelspacing=0) 47 | #plt.legend() 48 | ax.set_xticks([2**10, 2**12, 2**14, 2**16]) 49 | ax.set_xticklabels(["$2^{10}$", "$2^{12}$", "$2^{14}$", "$2^{16}$"]) 50 | ax.set_yticks([1,5,10,50,100]) 51 | ax.set_yticklabels(["1","5","10","50","100"]) 52 | 53 | remove_chart_junk(plt,ax, grid=True) 54 | if args.title: 55 | ax.set_title(args.title, y=1.5) 56 | if args.large: 57 | plt.legend(bbox_to_anchor=(0,1.02,1,0.2), loc="lower left", 58 | mode="expand", borderaxespad=0) 59 | custom_style.save_fig(fig, out_name, [2.5, 4], pad=0.3) 60 | else: 61 | custom_style.save_fig(fig, out_name, [1.8, 1.5]) 62 | plt.savefig("temp.pdf") 63 | 64 | -------------------------------------------------------------------------------- /scripts/fig/suboram.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/suboram.graffle -------------------------------------------------------------------------------- /scripts/fig/suboram_legend.py: -------------------------------------------------------------------------------- 1 | import re 2 | import custom_style 3 | from custom_style import setup_columns,col,remove_chart_junk 4 | import matplotlib.pyplot as plt 5 | import sys 6 | import numpy as np 7 | from matplotlib.ticker import FuncFormatter 8 | import math 9 | from collections import defaultdict 10 | from matplotlib.patches import Patch 11 | from matplotlib.lines import Line2D 12 | import pylab 13 | import config 14 | 15 | out_name = sys.argv[2] 16 | in_name = sys.argv[1] 17 | 18 | legend_labels= ["Snoopy", "Obladi (2 machines)", "Oblix (1 machine)"] 19 | colors = [config.dumbo_color, config.obladi_color, config.oblix_color] 20 | markers = ["o", "None", "None"] 21 | linestyles = ["-", config.obladi_line, config.oblix_line] 22 | 23 | fig = plt.figure(figsize=(10,8)) 24 | 25 | legend_elements = [] 26 | for i in range(len(legend_labels)): 27 | legend_elements.append(Line2D([0],[0],color=colors[i], label=legend_labels[i], marker=markers[i], linestyle=linestyles[i])) 28 | 29 | fig.legend(bbox_to_anchor=(0, 0.0, 1, 1), mode='expand', 30 | handles=legend_elements, fontsize=8, ncol=3, loc="center", handlelength=1.5, borderpad=0.2, 31 | borderaxespad=0, labelspacing=1, columnspacing=1, handletextpad=0.7) 32 | #fig.legend(handles=legend_elements, fontsize=8, ncol=3, loc="center", labelspacing=0, columnspacing=0.8, handlelength=1.5, handletextpad=0.5) 33 | 34 | custom_style.save_fig(fig, out_name, [3.3, 0.3]) 35 | plt.savefig("temp.pdf") 36 | -------------------------------------------------------------------------------- /scripts/fig/suboram_new.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/suboram_new.graffle -------------------------------------------------------------------------------- /scripts/fig/suboram_parallel.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import custom_style 3 | from custom_style import remove_chart_junk 4 | import sys 5 | import numpy as np 6 | import math 7 | import util 8 | import config 9 | 10 | import argparse 11 | from util import parse_args 12 | 13 | parser = argparse.ArgumentParser(description='Plot suborams vs. data size.') 14 | args = parse_args(parser) 15 | in_name, out_name = args.input, args.output 16 | print(("Out: %s") % (out_name)) 17 | print(("In: %s") % (in_name)) 18 | 19 | colors = ["#62BEB6", "#0B9A8D", "#077368"] 20 | 21 | block_size = 160 22 | 23 | thread1 = [] 24 | thread2 = [] 25 | thread3 = [] 26 | block_nums = [2**i for i in range(12,22)] 27 | print(block_nums) 28 | blocks = [(2**i) for i in range(12,22)] 29 | #data = [(2**i * block_size) / (2**20) for i in range(12,24)] 30 | print(blocks) 31 | 32 | with open(in_name, "r") as f: 33 | lines = f.readlines() 34 | for line in lines: 35 | times = line.split() 36 | thread1.append(float(times[0])) 37 | thread2.append(float(times[1])) 38 | thread3.append(float(times[2])) 39 | 40 | fig = plt.figure(figsize = (8,8)) 41 | ax = fig.add_subplot(111) 42 | ax.plot(blocks, thread1, color=config.pink_sequence_colors[0], label="1 enclave thread", marker="o") 43 | ax.plot(blocks, thread2, color=config.pink_sequence_colors[1], label="2 enclave threads", marker="o") 44 | ax.plot(blocks, thread3, color=config.pink_sequence_colors[2], label="3 enclave threads", marker="o") 45 | ax.set_xlabel("Objects") 46 | ax.set_ylabel("Process Batch Time (ms)") 47 | ax.set_xscale("log") 48 | ax.set_yscale("log") 49 | #plt.legend(bbox_to_anchor=(0.1, 1.0, 1., -.102), loc='lower left', ncol=1, borderaxespad=0., fontsize=7,labelspacing=0) 50 | #plt.legend() 51 | ax.set_xticks([2**i for i in range(12,22,3)]) 52 | ax.set_xticklabels(["$2^{12}$", "$2^{15}$", "$2^{18}$", "$2^{21}$"]) 53 | ax.set_yticks([125,250,500,1000]) 54 | ax.set_yticklabels(["125","250","500","1,000"]) 55 | 56 | remove_chart_junk(plt,ax,grid=True) 57 | if args.title: 58 | ax.set_title(args.title, y=1.5) 59 | if args.large: 60 | plt.legend(bbox_to_anchor=(0,1.02,1,0.2), loc="lower left", 61 | mode="expand", borderaxespad=0) 62 | custom_style.save_fig(fig, out_name, [2.5, 4], pad=0.3) 63 | else: 64 | custom_style.save_fig(fig, out_name, [1.8, 1.5]) 65 | plt.savefig("temp.pdf") 66 | -------------------------------------------------------------------------------- /scripts/fig/system_architecture.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/system_architecture.graffle -------------------------------------------------------------------------------- /scripts/fig/system_steps.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/fig/system_steps.graffle -------------------------------------------------------------------------------- /scripts/fig/tufte.py: -------------------------------------------------------------------------------- 1 | 2 | import matplotlib 3 | def tuftestyle(ax): 4 | """Styles an axes object to have minimalist graph features""" 5 | #ax.grid(True, 'major', color='w', linestyle='-', linewidth=1.5,alpha=0.6) 6 | #ax.patch.set_facecolor('white') 7 | 8 | ax.set_axisbelow(True) 9 | 10 | ax.spines["right"].set_visible(False) 11 | ax.spines["top"].set_visible(False) 12 | ax.spines["bottom"].set_visible(False) 13 | ax.spines["left"].set_visible(False) 14 | #ax.yaxis.set_major_locator(MultipleLocator( (ax.get_yticks()[-1]-ax.get_yticks()[0]) / 0.1 )) 15 | #ax.get_xaxis().tick_bottom() 16 | #ax.get_yaxis().tick_left() 17 | 18 | #restyle the tick lines 19 | for line in ax.get_xticklines() + ax.get_yticklines(): 20 | line.set_markersize(5) 21 | line.set_color("black") 22 | line.set_markeredgewidth(0) 23 | 24 | for line in ax.xaxis.get_ticklines(minor=True) + ax.yaxis.get_ticklines(minor=True): 25 | line.set_markersize(0) 26 | 27 | matplotlib.rcParams['xtick.direction'] = 'out' 28 | matplotlib.rcParams['ytick.direction'] = 'in' 29 | ax.xaxis.set_ticks_position('bottom') 30 | ax.yaxis.set_ticks_position('left') 31 | 32 | -------------------------------------------------------------------------------- /scripts/figure11.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | python3 runExperiment.py -sr --config config/balancerMakeBatch.json 5 | python3 runExperiment.py -sr --config config/balancerMatchResponses.json 6 | python3 runExperiment.py -sr --config config/suboramProcessBatch.json 7 | 8 | cp ../experiments/results/balancer_match_responses/latest/final_results.dat ../experiments/results/balancer_make_batch/latest/micro_balancer_match_resps.dat 9 | cp ../experiments/results/balancer_make_batch/latest/final_results.dat ../experiments/results/balancer_make_batch/latest/micro_balancer_make_batch.dat 10 | cp ../experiments/results/suboram_process_batch/latest/final_results.dat ../experiments/results/balancer_make_batch/latest/micro_suboram_batch_sz.dat 11 | 12 | cp fig/scale_breakdown*.py fig/custom_style.py fig/tufte.py fig/util.py ../experiments/results/balancer_make_batch/latest 13 | 14 | cd ../experiments/results/balancer_make_batch/latest/ 15 | python3 scale_breakdown_1024.py -l -t "Artifact Evaluation" 1024 ../../../artifact_figures/artifact/11a.pdf 16 | python3 scale_breakdown_32768.py -l -t "Artifact Evaluation" 32768 ../../../artifact_figures/artifact/11b.pdf 17 | python3 scale_breakdown_1048576.py -l -t "Artifact Evaluation" 1048576 ../../../artifact_figures/artifact/11c.pdf 18 | 19 | cd ../../../../scripts/fig 20 | python3 scale_breakdown_1024.py -l -t "Paper Figure 11a" 1024 ../../experiments/artifact_figures/paper/11a.pdf 21 | python3 scale_breakdown_32768.py -l -t "Paper Figure 11b" 32768 ../../experiments/artifact_figures/paper/11b.pdf 22 | python3 scale_breakdown_1048576.py -l -t "Paper Figure 11c" 1048576 ../../experiments/artifact_figures/paper/11c.pdf 23 | 24 | cd ../../experiments/artifact_figures 25 | pdfjam --landscape --nup 2x1 artifact/11a.pdf paper/11a.pdf --outfile 11a.pdf 26 | pdfjam --landscape --nup 2x1 artifact/11b.pdf paper/11b.pdf --outfile 11b.pdf 27 | pdfjam --landscape --nup 2x1 artifact/11c.pdf paper/11c.pdf --outfile 11c.pdf 28 | -------------------------------------------------------------------------------- /scripts/figure13.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | python3 runExperiment.py --config="config/adaptiveScaleThroughputOblix.json" -sr 5 | python3 runExperiment.py --config="config/adaptiveScaleThroughputOblix_500.json" -sr 6 | python3 runExperiment.py --config="config/adaptiveScaleThroughputOblix_300.json" -sr 7 | 8 | cp ../experiments/results/oblix_adaptive_scale_throughput_500/latest/final_results.dat ../experiments/results/oblix_adaptive_scale_throughput_1000/latest/final_results.dat_500 9 | cp ../experiments/results/oblix_adaptive_scale_throughput_300/latest/final_results.dat ../experiments/results/oblix_adaptive_scale_throughput_1000/latest/final_results.dat_300 10 | 11 | python3 runExperiment.py -g -f 13 12 | -------------------------------------------------------------------------------- /scripts/figure14.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | cd ../planner 5 | 6 | cp ../experiments/results/balancer_make_batch/latest/micro_*.dat bench 7 | 8 | python3 plannerBenchmark.py 9 | 10 | cd ../scripts 11 | python3 fig/planner_config.py -l -t "Artifact Evaluation" ../planner/scale_throughput_config.dat ../experiments/artifact_figures/artifact/14a.pdf 12 | python3 fig/planner_cost.py -l -t "Artifact Evaluation" ../planner/scale_throughput_cost.dat ../experiments/artifact_figures/artifact/14b.pdf 13 | 14 | python3 fig/planner_config.py -l -t "Paper Figure 14a" ../experiments/artifact_figures/paper/planner_config.dat ../experiments/artifact_figures/paper/14a.pdf 15 | python3 fig/planner_cost.py -l -t "Paper Figure 14b" ../experiments/artifact_figures/paper/planner_cost.dat ../experiments/artifact_figures/paper/14b.pdf 16 | 17 | cd ../experiments/artifact_figures 18 | pdfjam --landscape --nup 2x1 artifact/14a.pdf paper/14a.pdf --outfile 14a.pdf 19 | pdfjam --landscape --nup 2x1 artifact/14b.pdf paper/14b.pdf --outfile 14b.pdf 20 | -------------------------------------------------------------------------------- /scripts/figure9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | python3 runExperiment.py -sr -f 9_1000 5 | python3 runExperiment.py -sr -f 9_500 6 | python3 runExperiment.py -sr -f 9_300 7 | 8 | cp ../experiments/results/adaptive_scale_throughput_500/latest/final_results.dat ../experiments/results/adaptive_scale_throughput_1000/latest/final_results.dat_500 9 | cp ../experiments/results/adaptive_scale_throughput_300/latest/final_results.dat ../experiments/results/adaptive_scale_throughput_1000/latest/final_results.dat_300 10 | 11 | python3 runExperiment.py -g -f 9 12 | -------------------------------------------------------------------------------- /scripts/get_baselines.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | 4 | from pathlib import Path 5 | 6 | def main(): 7 | parser = argparse.ArgumentParser(description='Generate baselines.json') 8 | parser.add_argument('obladi_dir', type=str, help='obladi directory') 9 | parser.add_argument('oblix_dir', type=str, help='oblix directory') 10 | parser.add_argument('out_file', type=str, help='output json file') 11 | args = parser.parse_args() 12 | 13 | results = {} 14 | obladi_file = Path(args.obladi_dir) / "results.dat" 15 | with open(obladi_file, "r") as f: 16 | for line in f.readlines(): 17 | if not line: 18 | continue 19 | obladi_througput = float(line.strip().split(" ")[-1]) 20 | obladi_latency = float(line.strip().split(" ")[1]) 21 | results["obladi_throughput"] = obladi_througput 22 | results["obladi_latency"] = obladi_latency 23 | 24 | oblix_file = Path(args.oblix_dir) / "final_results.json" 25 | with open(oblix_file, "r") as f: 26 | oblix_latency = json.load(f) 27 | results["oblix_latency"] = oblix_latency 28 | 29 | with open(args.out_file, "w") as f: 30 | json.dump(results, f, indent=2) 31 | 32 | 33 | if __name__ == '__main__': 34 | main() 35 | -------------------------------------------------------------------------------- /scripts/oblix/config/machines.json: -------------------------------------------------------------------------------- 1 | { 2 | "oblix_ips": [ 3 | "52.168.15.126" 4 | ], 5 | "oblix_private_ips": [ 6 | "52.168.15.126" 7 | ] 8 | } -------------------------------------------------------------------------------- /scripts/oblix/config/oblix_benchmark.json: -------------------------------------------------------------------------------- 1 | { 2 | "experiment_dir": "results/oblix_benchmark/2021:08:16:23:41", 3 | "experiment_name": "oblix_benchmark", 4 | "image_path": "resourceGroups/scalable_oram/providers/Microsoft.Compute/galleries/artifact_evaluation/images/oblix/versions/0.0.1", 5 | "instance_types": { 6 | "oblix": "Standard_DC4s_v2" 7 | }, 8 | "local_project_dir": "/home/azureuser/snoopy/experiments", 9 | "local_src_dir": "/home/azureuser/snoopy", 10 | "location": "eastus", 11 | "machines": { 12 | "oblix_ips": [ 13 | "52.168.15.126" 14 | ], 15 | "oblix_private_ips": [ 16 | "52.168.15.126" 17 | ] 18 | }, 19 | "nbBlockSizes": [ 20 | 160 21 | ], 22 | "nbBlocks": [ 23 | 10, 24 | 100, 25 | 1000, 26 | 10000, 27 | 100000, 28 | 1000000, 29 | 2000000 30 | ], 31 | "num_instances": { 32 | "oblix": 1 33 | }, 34 | "remote_project_dir": "/home/azureuser/snoopy/experiments", 35 | "ssh_key_file": "~/.ssh/scalable_oram.pem", 36 | "ssh_key_pub": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkRPpE2bKwHmOW/gsG1mOHcz8T7JdGlIjz3YU7/RW8sRFaikUiA240Z+1SIsw+QbHFAbyhy9+OLOLQRN8CF9/cS+DU3BKXECGJP1dkiSPVs9tk9+Gfx2TILdHnY3tD0ylFKQYftNgin6OABUsTS//DFjEYbmGSDU+DGIvWSOirByWq0sQChX/SOueFAHWE2iO+ohINoZnFwAhYmwpV2feb7J3dK6DWVyne0JpNplodvhOaFA3hCRUnrJeAPb+WUrCsTdProkMLZOV1dpqq2N++VUWv690VUxZ+gzqGo7JkG2Vh02DuQlCarQ5AmY9o6Ws4O7fUS/CJ08hPISMy6brX", 37 | "username": "azureuser" 38 | } 39 | -------------------------------------------------------------------------------- /scripts/process_baselines.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | python3 get_baselines.py ../experiments/results/diff-clients-base-oram-par-server-1/latest ../experiments/results/oblix_benchmark/latest ../experiments/artifact_figures/artifact/baselines.json 5 | 6 | python3 update_config.py -o="../experiments/results/oblix_benchmark/latest" config/adaptiveScaleThroughputOblix.json -------------------------------------------------------------------------------- /scripts/provision_machines.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | python3 runExperiment.py -p -f 9 5 | 6 | python3 update_config.py -m="config/machines.json" config/adaptiveScaleThroughput_300.json 7 | python3 update_config.py -m="config/machines.json" config/adaptiveScaleThroughput_500.json 8 | python3 update_config.py -m="config/machines.json" config/adaptiveScaleThroughputOblix.json 9 | python3 update_config.py -m="config/machines.json" config/adaptiveScaleThroughputOblix_500.json 10 | python3 update_config.py -m="config/machines.json" config/adaptiveScaleThroughputOblix_300.json 11 | python3 update_config.py -m="config/machines.json" config/scaleData.json 12 | python3 update_config.py -m="config/machines.json" config/scaleDataLatency.json 13 | python3 update_config.py -m="config/machines.json" config/balancerMakeBatch.json 14 | python3 update_config.py -m="config/machines.json" config/balancerMatchResponses.json 15 | python3 update_config.py -m="config/machines.json" config/suboramSort.json 16 | python3 update_config.py -m="config/machines.json" config/suboramProcessBatch.json 17 | python3 update_config.py -m="config/machines.json" config/suboramProcessBatchThreads.json 18 | -------------------------------------------------------------------------------- /scripts/update_config.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | 4 | from pathlib import Path 5 | 6 | def main(): 7 | parser = argparse.ArgumentParser(description='Update config with oblix baselines or new machines') 8 | parser.add_argument('-m', '--machine_file', 9 | help='update machines for an experiment') 10 | parser.add_argument('-o', '--oblix_dir', type=str, help='oblix directory') 11 | parser.add_argument('config', type=str, help='config to update') 12 | args = parser.parse_args() 13 | 14 | with open(args.config, "r") as f: 15 | config = json.load(f) 16 | 17 | if args.oblix_dir: 18 | oblix_file = Path(args.oblix_dir) / "final_results.json" 19 | with open(oblix_file, "r") as f: 20 | oblix_latency = json.load(f) 21 | config["oblix_baseline"] = oblix_latency 22 | 23 | if args.machine_file: 24 | with open(args.machine_file, "r") as f: 25 | machines = json.load(f) 26 | config["machines"] = machines 27 | config.pop("client_ips", None) 28 | config.pop("client_private_ips", None) 29 | config.pop("balancer_ips", None) 30 | config.pop("balancer_private_ips", None) 31 | config.pop("suboram_ips", None) 32 | config.pop("suboram_private_ips", None) 33 | 34 | with open(args.config, "w") as f: 35 | json.dump(config, f, indent=2) 36 | 37 | if __name__ == '__main__': 38 | main() -------------------------------------------------------------------------------- /scripts/util_py3/.ec2_util.py.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/util_py3/.ec2_util.py.swp -------------------------------------------------------------------------------- /scripts/util_py3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucbrise/snoopy/da4c98e3876c10cf52aa51ece3b62c5e8b8e335a/scripts/util_py3/__init__.py -------------------------------------------------------------------------------- /scripts/util_py3/prop_util.py: -------------------------------------------------------------------------------- 1 | ### Natacha Crooks - 2014 2 | ### Contains utility functions related to 3 | ### dealing with property files 4 | ############################################ 5 | 6 | import json 7 | import os 8 | import subprocess 9 | from pprint import pprint 10 | 11 | 12 | def writePropFile(propertyFile, properties): 13 | with open(propertyFile, 'w') as fp: 14 | json.dump(properties, fp, indent=2, sort_keys=True) 15 | 16 | 17 | ## Returns property file as 18 | ## a python dictionary. 19 | ## Throws an exception if 20 | ## file does note xist and returns 21 | ## empty dict 22 | def loadPropertyFile(pFileName): 23 | data = {} 24 | try: 25 | json_data = open(pFileName) 26 | except: 27 | print("File does not exist " + pFileName) 28 | try: 29 | data = json.load(json_data) 30 | except: 31 | print("Incorrect JSON Format " + pFileName) 32 | raise 33 | return data 34 | 35 | ## Prints Content of Json 36 | ## property file 37 | 38 | def printPropertyFile(pFileName): 39 | try: 40 | json_data = open(pFileName) 41 | data = json.loads(json_data) 42 | pprint(data) 43 | json_data.close() 44 | except: 45 | print("File does not exist") 46 | 47 | ## Generates a property file 48 | ## with corresponding file name 49 | ## from directionary 50 | def generatePropertyFile(dic, filename): 51 | with open(filename,'wb') as f: 52 | json.dump(dic,f) 53 | 54 | def toBool(st): 55 | if st == "true": 56 | return True 57 | else: 58 | return False 59 | 60 | ## Get GIT Revision Hash 61 | def getGitHash(projectpath): 62 | currentdir = os.getcwd(); 63 | os.chdir(projectpath) 64 | hash = subprocess.check_output(['git', 'rev-parse', 'HEAD']) 65 | os.chdir(currentdir) 66 | return hash 67 | -------------------------------------------------------------------------------- /suboram/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(enc) 5 | add_subdirectory(host) 6 | 7 | add_custom_target(suboram DEPENDS suboram_host suboram_enc 8 | suboram_sign_enc) 9 | -------------------------------------------------------------------------------- /suboram/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | all: build 5 | 6 | build: 7 | $(MAKE) -C enc 8 | $(MAKE) -C host 9 | 10 | clean: 11 | $(MAKE) -C enc clean 12 | $(MAKE) -C host clean 13 | 14 | run: 15 | host/suboram_host ./enc/suboram_enc.signed -port:12342 -num_blocks:128 16 | -------------------------------------------------------------------------------- /suboram/enc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | # Use the edger8r to generate C bindings from the EDL file. 4 | add_custom_command( 5 | OUTPUT suboram_t.h suboram_t.c suboram_args.h 6 | DEPENDS ${CMAKE_SOURCE_DIR}/suboram/suboram.edl 7 | COMMAND 8 | openenclave::oeedger8r --trusted ${CMAKE_SOURCE_DIR}/suboram/suboram.edl 9 | --search-path ${OE_INCLUDEDIR} --search-path 10 | ${OE_INCLUDEDIR}/openenclave/edl/sgx) 11 | 12 | add_custom_target(suboram_hdrs DEPENDS suboram_t.h suboram_t.c suboram_args.h) 13 | 14 | #add_subdirectory(oblix) 15 | 16 | 17 | # Sign enclave and generate a header file for server's MRENCLAVE 18 | add_custom_command( 19 | OUTPUT suboram_enc.signed suboram_enc_mrenclave.h 20 | DEPENDS suboram_enc enc.conf ${CMAKE_SOURCE_DIR}/suboram/enc/private.pem 21 | ${CMAKE_SOURCE_DIR}/gen_mrenclave_header.sh 22 | COMMAND 23 | openenclave::oesign sign -e $ -c 24 | ${CMAKE_SOURCE_DIR}/suboram/enc/enc.conf -k 25 | ${CMAKE_SOURCE_DIR}/suboram/enc/private.pem 26 | COMMAND openenclave::oesign dump -e suboram_enc.signed > temp.dmp 27 | COMMAND bash ${CMAKE_SOURCE_DIR}/gen_mrenclave_header.sh 28 | ${CMAKE_SOURCE_DIR}/common/suboram_enc_mrenclave.h temp.dmp 29 | COMMAND ${CMAKE_COMMAND} -E sleep 1 30 | COMMAND ${CMAKE_COMMAND} -E remove temp.dmp) 31 | 32 | add_executable( 33 | suboram_enc 34 | suboram.cpp 35 | ecalls.cpp 36 | cert_verify_config.cpp 37 | ../../common/verify_callback.cpp 38 | ../../common/utility.cpp 39 | ../../common/openssl_utility.cpp 40 | ../../common/crypto.cpp 41 | ../../common/block.cpp 42 | ../../common/bucket_sort.cpp 43 | ../../common/par_obl_primitives.cpp 44 | ${CMAKE_CURRENT_BINARY_DIR}/suboram_t.c) 45 | 46 | if (WIN32) 47 | maybe_build_using_clangw(suboram_enc) 48 | endif () 49 | 50 | target_compile_definitions(suboram_enc PUBLIC OE_API_VERSION=2) 51 | 52 | target_include_directories( 53 | suboram_enc 54 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 55 | ${CMAKE_BINARY_DIR}/suboram/enc) 56 | 57 | target_link_libraries( 58 | suboram_enc log_enc openenclave::oeenclave openenclave::oecryptoopenssl 59 | openenclave::oelibcxx openenclave::oehostsock openenclave::oehostresolver) 60 | 61 | add_custom_target(suboram_sign_enc ALL DEPENDS suboram_enc.signed 62 | suboram_enc_mrenclave.h) 63 | -------------------------------------------------------------------------------- /suboram/enc/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | include ../../config.mk 5 | 6 | CFLAGS=$(shell pkg-config oeenclave-$(C_COMPILER) --cflags) 7 | CXXFLAGS=$(shell pkg-config oeenclave-$(CXX_COMPILER) --cflags) 8 | LDFLAGS=$(shell pkg-config oeenclave-$(CXX_COMPILER) --libs) 9 | INCDIR=$(shell pkg-config oeenclave-$(C_COMPILER) --variable=includedir) 10 | CRYPTO_LDFLAGS=$(shell pkg-config oeenclave-$(COMPILER) --variable=${OE_CRYPTO_LIB}libs) 11 | 12 | .PHONY: all build clean run 13 | 14 | SRC_FILES = ecalls.cpp cert_verify_config.cpp ../../common/verify_callback.cpp ../../common/utility.cpp ../../common/openssl_utility.cpp ../../common/crypto.cpp ../../common/block.cpp oblix/AES.cpp oblix/Bid.cpp oblix/LocalRAMStore.cpp oblix/ORAM.cpp oblix/ObliviousOperations.cpp oblix/OMAP.cpp oblix/AVLTree.cpp 15 | OBJ_FILES = ecalls.o cert_verify_config.o verify_callback.o utility.o openssl_utility.o crypto.o block.o aes.o bid.o local_ram_store.o oram.o oblivious_operations.o omap.o avltree.o suboram_t.o 16 | 17 | all: 18 | $(MAKE) build 19 | $(MAKE) sign 20 | 21 | build: 22 | @ echo "Compilers used: $(CC), $(CXX)" 23 | oeedger8r ../suboram.edl --trusted \ 24 | --trusted-dir . \ 25 | --search-path $(INCDIR) \ 26 | --search-path $(INCDIR)/openenclave/edl/sgx 27 | 28 | 29 | $(CXX) -g -c $(CXXFLAGS) $(INCLUDES) -I. -std=c++11 ${SRC_FILES} 30 | $(CC) -c $(CFLAGS) $(CINCLUDES) -I. suboram_t.c 31 | $(CXX) -o suboram_enc $(OBJ_FILES) $(LDFLAGS) $(CRYPTO_LDFLAGS) -loehostsock -loehostresolver 32 | 33 | sign: 34 | oesign sign -e suboram_enc -c enc.conf -k private.pem 35 | oesign dump -e suboram_enc.signed > temp.dmp 36 | chmod u+x ../../gen_mrenclave_header.sh 37 | ../../gen_mrenclave_header.sh ../../common/suboram_enc_mrenclave.h temp.dmp 38 | rm temp.dmp 39 | 40 | clean: 41 | rm -f *.o suboram_enc suboram_enc.signed suboram_enc.signed.so suboram_t.* suboram_args.h yy ../../common/suboram_enc_mrenclave.h 42 | -------------------------------------------------------------------------------- /suboram/enc/_log.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef OE_SAMPLES_ATTESTATION_ENC_LOG_H 5 | #define OE_SAMPLES_ATTESTATION_ENC_LOG_H 6 | 7 | #include 8 | 9 | #define TRACE_ENCLAVE(fmt, ...) \ 10 | \ 11 | printf("Enclave: ***%s(%d): " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__) 12 | 13 | #endif // OE_SAMPLES_ATTESTATION_ENC_LOG_H 14 | -------------------------------------------------------------------------------- /suboram/enc/cert_verify_config.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | #include "cert_verify_config.h" 4 | 5 | /* On the server side, we can't verify claim. During the build process, 6 | CLIENT_ENCLAVE_MRENCLAVE is not available as client image is built later. 7 | We can only verify the claim value of server or client, but not both. 8 | `verify_claim_value` always returns OE_OK so that it can work with common 9 | code in identity_verifier.cpp */ 10 | 11 | oe_result_t verify_claim_value(const oe_claim_t* claim) 12 | { 13 | oe_result_t result = OE_OK; 14 | printf("\nverify unique_id:\n"); 15 | for (size_t i = 0; i < claim->value_size; i++) 16 | printf("0x%x ", (uint8_t)claim->value[i]); 17 | printf("\n"); 18 | return result; 19 | } 20 | -------------------------------------------------------------------------------- /suboram/enc/cert_verify_config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef ATTLESTED_TLS_ENCLAVE_CONFIG 5 | #define ATTLESTED_TLS_ENCLAVE_CONFIG 6 | 7 | #include 8 | #include 9 | #include "../../common/common.h" 10 | #include "../../common/load_balancer_client_enc_pubkey.h" 11 | #include "../../common/empty_server_pubkey.h" 12 | #define TLS_ENCLAVE TLS_SERVER 13 | 14 | oe_result_t verify_claim_value(const oe_claim_t* claim); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /suboram/enc/enc.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | # Enclave settings: 5 | Debug=1 6 | # 32 * 1024 * 4KB 7 | #NumHeapPages=524288 8 | #NumHeapPages=65536 9 | NumHeapPages=131072 10 | #NumHeapPages=32768 11 | #NumStackPages=65536 12 | NumStackPages=1024 13 | NumTCS=4 14 | ProductID=1 15 | SecurityVersion=1 16 | -------------------------------------------------------------------------------- /suboram/enc/oblix_suboram.cpp: -------------------------------------------------------------------------------- 1 | #include "suboram.h" 2 | 3 | #include "oblix/ORAM.hpp" 4 | #include "oblix/OMAP.h" 5 | #include "oblix/Bid.h" 6 | 7 | void uint_to_oblixpp_id(unsigned int id, byte_t *arr) { 8 | for (int i = 0; i < ID_SIZE; i++) { 9 | if (id == 0) { 10 | break; 11 | } 12 | arr[i] = (byte_t) id & 0xff; 13 | id = id >> 8; 14 | } 15 | } 16 | 17 | int SuboramDispatcher::local_oblix_init() { 18 | printf("Oblix init\n"); 19 | std::array tmp_key{0}; 20 | OMAP *omap = new OMAP(num_local_blocks, tmp_key); 21 | printf("Finished OMAP constructor\n"); 22 | 23 | uint8_t *block_key = (uint8_t *) "0123456789123456"; // TODO: Change keys 24 | EVP_CIPHER_CTX *suboram_hash_key = EVP_CIPHER_CTX_new(); 25 | EVP_EncryptInit_ex(suboram_hash_key, EVP_aes_128_ecb(), NULL, block_key, NULL); 26 | 27 | map pairs; 28 | uint8_t empty_block[16]; 29 | //uint8_t empty_block[BLOCK_LEN]; 30 | memset(empty_block, 0, 16); 31 | //memset(empty_block, 0, BLOCK_LEN); 32 | //std::string empty_block_str((char *)empty_block, BLOCK_LEN); 33 | std::string empty_block_str((char *)empty_block, 16); 34 | for (unsigned long long i = 1; i <= num_total_blocks; i++) { 35 | if ((get_suboram_for_req(suboram_hash_key, i, num_suborams) == suboram_id)) { 36 | //byte_t id[ID_SIZE] = { 0 }; 37 | //uint_to_oblixpp_id(i, id); 38 | Bid id(i); 39 | pairs[id] = empty_block_str; 40 | omap->insert(id, empty_block_str); 41 | } 42 | } 43 | printf("going to batch insert\n"); 44 | //omap->batchInsert(pairs); 45 | printf("Finished OMAP batch insert\n"); 46 | 47 | free(suboram_hash_key); 48 | printf("Finished oblix init\n"); 49 | 50 | int rv = init(NULL); 51 | printf("Did dispatcher init\n"); 52 | return rv; 53 | } 54 | -------------------------------------------------------------------------------- /suboram/enc/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /suboram/enc/public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /suboram/host/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | add_custom_command( 5 | OUTPUT suboram_u.h suboram_u.c suboram_args.h 6 | DEPENDS ${CMAKE_SOURCE_DIR}/suboram/suboram.edl 7 | COMMAND 8 | openenclave::oeedger8r --untrusted 9 | ${CMAKE_SOURCE_DIR}/suboram/suboram.edl --search-path ${OE_INCLUDEDIR} 10 | --search-path ${OE_INCLUDEDIR}/openenclave/edl/sgx) 11 | 12 | add_executable(suboram_host host.cpp ../../common/crypto.cpp 13 | ../../common/block.cpp 14 | ../enc/suboram.cpp 15 | ../../common/bucket_sort.cpp 16 | ../../common/par_obl_primitives.cpp 17 | oblix/RAMStore.cpp oblix/Utilities.cpp 18 | ${CMAKE_CURRENT_BINARY_DIR}/suboram_u.c) 19 | 20 | include_directories(${PROTOBUF_INCLUDE_DIRS} ${PROTO_GRPC_DIR}) 21 | 22 | target_include_directories(suboram_host PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} 23 | ${CMAKE_CURRENT_BINARY_DIR}) 24 | 25 | target_link_libraries(suboram_host 26 | PRIVATE log 27 | openenclave::oehost 28 | oram_grpc_proto 29 | ${_REFLECTION} 30 | ${_GRPC_GRPCPP} 31 | ${_PROTOBUF_LIBPROTOBUF}) 32 | -------------------------------------------------------------------------------- /suboram/host/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Open Enclave SDK contributors. 2 | # Licensed under the MIT License. 3 | 4 | include ../../config.mk 5 | 6 | CFLAGS=$(shell pkg-config oehost-$(C_COMPILER) --cflags) 7 | CXXFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --cflags) 8 | LDFLAGS=$(shell pkg-config oehost-$(CXX_COMPILER) --libs) 9 | INCDIR=$(shell pkg-config oehost-$(C_COMPILER) --variable=includedir) 10 | 11 | all: build 12 | 13 | build: 14 | @ echo "Compilers used: $(CC), $(CXX)" 15 | oeedger8r ../suboram.edl --untrusted \ 16 | --search-path $(INCDIR) \ 17 | --search-path $(INCDIR)/openenclave/edl/sgx 18 | $(CC) -c $(CFLAGS) $(CINCLUDES) suboram_u.c 19 | $(CXX) -c $(CXXFLAGS) $(INCLUDES) host.cpp ../../common/crypto.cpp ../../common/block.cpp oblix/RAMStore.cpp oblix/Utilities.cpp 20 | $(CXX) -o suboram_host host.o crypto.o block.o ram_store.o utilities.o suboram_u.o $(LDFLAGS) 21 | 22 | clean: 23 | rm -f suboram_host* *.o suboram_u.* suboram_args.h 24 | -------------------------------------------------------------------------------- /suboram/host/host.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../common/block.h" 5 | #include "../../common/bucket_sort.h" 6 | #include "../../common/ring_buffer.h" 7 | #include "suboram_u.h" 8 | #include "../enc/suboram.h" 9 | 10 | #include "../../common/json.hpp" 11 | 12 | using json = nlohmann::json; 13 | 14 | class SuboramHost { 15 | private: 16 | int num_blocks; 17 | int num_local_blocks; 18 | int num_balancers; 19 | int num_suborams; 20 | int suboram_id; 21 | int num_buckets; 22 | int blocks_per_bucket = BLOCKS_PER_BUCKET; 23 | std::vector> block_ct; 24 | shared_sort_state s; 25 | BucketCT buf[BLOCK_BUF_BUCKETS]; 26 | 27 | HostBucketSorter sorter; 28 | 29 | SuboramDispatcher mock_suboram; 30 | int num_threads; 31 | json oblix_baseline; 32 | 33 | double oblix_access_time = 0; 34 | 35 | public: 36 | oe_enclave_t *enclave; 37 | int ret; 38 | std::string protocol; 39 | std::string sort_type; 40 | std::string mode; 41 | 42 | SuboramHost(int num_blocks, int num_balancers, int num_suborams, int 43 | suboram_id, std::string protocol, std::string sort_type, std::string mode, 44 | int num_threads, json oblix_baseline) : 45 | ret(OKAY), num_blocks(num_blocks), 46 | num_balancers(num_balancers), num_suborams(num_suborams), 47 | suboram_id(suboram_id), protocol(protocol), sort_type(sort_type), mode(mode), 48 | num_threads(num_threads), oblix_baseline(oblix_baseline) { 49 | s.host_q.resize(BLOCK_BUF_BUCKETS*8); 50 | s.sgx_q.resize(BLOCK_BUF_BUCKETS*8); 51 | } 52 | 53 | oe_enclave_t* create_enclave(const char* enclave_path); 54 | void init_enclave(); 55 | void terminate_enclave(); 56 | 57 | void mock_init_enclave(); 58 | 59 | void fill_block_ct(); 60 | void fetch_from_queue(); 61 | 62 | void run_buffered_bucket_sort(); 63 | void run_shuffle(); 64 | void run_process_batch(uint8_t *in_ct, uint8_t *in_iv, uint8_t *in_tag, uint8_t *out_ct, uint8_t *out_iv, uint8_t *out_tag, int batch_sz, uint32_t balancer_id); 65 | void run_mock_process_batch(uint8_t *in_ct, uint8_t *in_iv, uint8_t *in_tag, uint8_t *out_ct, uint8_t *out_iv, uint8_t *out_tag, int batch_sz, uint32_t balancer_id); 66 | void run_mock_buffered_bucket_sort(); 67 | void run_parallel_bitonic_sort(); 68 | void run_parallel_bitonic_sort_nonadaptive(); 69 | 70 | void bench_sort(int num_trials); 71 | void bench_scan_blocks(int num_trials); 72 | void bench_mock_enclave_buffered_bucket_sort(int num_trials); 73 | void bench_process_batch(int num_trials); 74 | 75 | double get_time_for_b(int b); 76 | 77 | int calc_oblix(int n, int ctr, int b, double access_time); 78 | }; 79 | 80 | -------------------------------------------------------------------------------- /suboram/host/oblix/RAMStore.cpp: -------------------------------------------------------------------------------- 1 | #include "RAMStore.hpp" 2 | 3 | RAMStore::RAMStore(size_t count, size_t ram_size, bool simul) 4 | : store(count), size(ram_size), buffer(10000*ram_size) { 5 | this->simulation = simul; 6 | } 7 | 8 | RAMStore::~RAMStore() { 9 | } 10 | 11 | block_oblix RAMStore::Read(long long pos) { 12 | if (simulation) { 13 | return store[0]; 14 | } else { 15 | return store[pos]; 16 | } 17 | } 18 | 19 | void RAMStore::Write(long long pos, block_oblix b) { 20 | if (!simulation) { 21 | store[pos] = b; 22 | } else { 23 | store[0] = b; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /suboram/host/oblix/RAMStore.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | using byte_t = uint8_t; 9 | using block_oblix = std::vector; 10 | 11 | class RAMStore { 12 | std::vector store; 13 | size_t size; 14 | bool simulation; 15 | 16 | 17 | public: 18 | std::vector buffer; 19 | 20 | RAMStore(size_t num, size_t size, bool simulation); 21 | ~RAMStore(); 22 | 23 | block_oblix Read(long long pos); 24 | void Write(long long pos, block_oblix b); 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /suboram/host/oblix/RAMStoreEnclaveInterface.h: -------------------------------------------------------------------------------- 1 | #ifndef RAMSTOREENCLAVEINTERFACE_H 2 | #define RAMSTOREENCLAVEINTERFACE_H 3 | #include "RAMStore.hpp" 4 | #include "suboram_u.h" 5 | 6 | static RAMStore* store = NULL; 7 | 8 | char *ocall_setup_ramStore(size_t num, int size) { 9 | if (size != -1) { 10 | store = new RAMStore(num, size, false); 11 | } else { 12 | store = new RAMStore(num, size, true); 13 | } 14 | return store->buffer.data(); 15 | } 16 | 17 | void ocall_nwrite_ramStore(size_t blockCount, long long* indexes, size_t len) { 18 | //printf("[write] blockCount: %d, len: %d\n", blockCount, len); 19 | assert(len % blockCount == 0); 20 | size_t eachSize = len / blockCount; 21 | for (unsigned int i = 0; i < blockCount; i++) { 22 | block_oblix ciphertext(store->buffer.data() + (i * eachSize), store->buffer.data() + (i + 1) * eachSize); 23 | store->Write(indexes[i], ciphertext); 24 | } 25 | } 26 | 27 | size_t ocall_nread_ramStore(size_t blockCount, long long* indexes, size_t len) { 28 | assert(len % blockCount == 0); 29 | size_t resLen = -1; 30 | for (unsigned int i = 0; i < blockCount; i++) { 31 | block_oblix ciphertext = store->Read(indexes[i]); 32 | resLen = ciphertext.size(); 33 | std::memcpy(&store->buffer[i * resLen], ciphertext.data(), ciphertext.size()); 34 | /* 35 | printf("[read] index: %d\n", indexes[i]); 36 | for (auto val : ciphertext) { 37 | printf("\\x%.2x", val); 38 | } 39 | printf("\n"); 40 | printf("[read] (blk) index: %d\n", indexes[i]); 41 | for (int _i = i*resLen; _i < (i+1)*resLen; _i++) { 42 | printf("\\x%.2x", store->buffer[_i]); 43 | } 44 | printf("\n"); 45 | */ 46 | } 47 | //printf("[read] blockCount: %d, len: %d, resLen: %d\n", blockCount, len, resLen); 48 | return resLen; 49 | } 50 | 51 | int* testdata = NULL; 52 | 53 | void ocall_test_memory_setup(int size) { 54 | testdata = new int[size]; 55 | for (int i = 0; i < size; i++) { 56 | testdata[i] = i; 57 | } 58 | } 59 | 60 | void ocall_test_memory_read(int* indexes, int *data) { 61 | // for (int i = 0; i < 1; i++) { 62 | // int index = indexes[i]; 63 | // std::memcpy(&data[i], &testdata[index], sizeof(int)); 64 | // } 65 | for (int i = 0; i < 300; i++) { 66 | int index = indexes[i]; 67 | std::memcpy(&data[i], &testdata[index], sizeof (int)); 68 | } 69 | } 70 | 71 | void ocall_initialize_ramStore(long long begin, long long end, size_t len) { 72 | block_oblix ciphertext(store->buffer.begin(), store->buffer.end()); 73 | for (long long i = begin; i < end; i++) { 74 | store->Write(i, ciphertext); 75 | } 76 | } 77 | 78 | void ocall_write_ramStore(long long index, size_t len) { 79 | block_oblix ciphertext(store->buffer.data(), &store->buffer[len]); 80 | store->Write(index, ciphertext); 81 | } 82 | #endif /* RAMSTOREENCLAVEINTERFACE_H */ 83 | 84 | -------------------------------------------------------------------------------- /suboram/host/oblix/Utilities.cpp: -------------------------------------------------------------------------------- 1 | #include "Utilities.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "sys/types.h" 7 | #include "sys/sysinfo.h" 8 | #include "stdlib.h" 9 | #include "stdio.h" 10 | #include "string.h" 11 | #include "../../../common/block.h" 12 | 13 | std::map> Utilities::m_begs; 14 | std::map timehist; 15 | 16 | Utilities::Utilities() { 17 | } 18 | 19 | Utilities::~Utilities() { 20 | } 21 | 22 | void Utilities::startTimer(int id) { 23 | std::chrono::time_point m_beg = std::chrono::high_resolution_clock::now(); 24 | m_begs[id] = m_beg; 25 | 26 | } 27 | 28 | double Utilities::stopTimer(int id) { 29 | double t = (double) std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - m_begs[id]).count(); 30 | timehist.erase(id); 31 | timehist[id] = t; 32 | return t; 33 | } 34 | 35 | std::string Utilities::XOR(std::string value, std::string key) { 36 | std::string retval(value); 37 | 38 | auto klen = key.length(); 39 | auto vlen = value.length(); 40 | unsigned int k = 0; 41 | if (klen < vlen) { 42 | for (long unsigned int i = klen; i < vlen; i++) { 43 | key += " "; 44 | } 45 | } else { 46 | for (long unsigned int i = vlen; i < klen; i++) { 47 | value += " "; 48 | } 49 | } 50 | klen = vlen; 51 | 52 | for (unsigned int v = 0; v < vlen; v++) { 53 | retval[v] = value[v]^key[k]; 54 | k = (++k < klen ? k : 0); 55 | } 56 | 57 | return retval; 58 | } 59 | 60 | std::array Utilities::convertToArray(std::string addr) { 61 | std::array res; 62 | for (int i = 0; i < BLOCK_LEN; i++) { 63 | res[i] = addr[i]; 64 | } 65 | return res; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /suboram/host/oblix/Utilities.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILITIES_H 2 | #define UTILITIES_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "../../../common/block.h" 14 | 15 | using namespace std; 16 | 17 | class Utilities { 18 | private: 19 | static int parseLine(char* line); 20 | public: 21 | Utilities(); 22 | static std::string XOR(std::string value, std::string key); 23 | static void startTimer(int id); 24 | static double stopTimer(int id); 25 | static std::map > m_begs; 26 | static std::array convertToArray(std::string value); 27 | virtual ~Utilities(); 28 | }; 29 | 30 | #endif /* UTILITIES_H */ 31 | 32 | -------------------------------------------------------------------------------- /suboram/suboram.edl: -------------------------------------------------------------------------------- 1 | // Copyright (c) Open Enclave SDK contributors. 2 | // Licensed under the MIT License. 3 | 4 | enclave { 5 | from "openenclave/edl/syscall.edl" import *; 6 | from "platform.edl" import *; 7 | 8 | trusted { 9 | public int set_params(int num_total_blocks, int blocks_per_bucket, int num_balancers, int num_suborams, int suboram_id, int *num_local_blocks, int num_sort_threads); 10 | public int init(void *s); 11 | public int init_bench_sort(void *s); 12 | public int buffered_bucket_sort(int thread_idx); 13 | public int shuffle_blocks(); 14 | public int scan_blocks(); 15 | public int insecure_sort(); 16 | public int bitonic_sort(); 17 | public int parallel_bitonic_sort(int thread_id); 18 | public int parallel_bitonic_sort_nonadaptive(int thread_id); 19 | public int bucket_sort(); 20 | public void prefetch_bucket_sort(); 21 | public int melbourne_sort(); 22 | public int verify_sorted(); 23 | public void process_batch(int *ret, uint8_t *in_ct, uint8_t *in_iv, uint8_t *in_tag, uint8_t *out_ct, uint8_t *out_iv, uint8_t *out_tag, uint32_t batch_sz, int32_t balancer_id); 24 | public void table_process_batch_parallel(int *ret, uint8_t *in_ct, uint8_t *in_iv, uint8_t 25 | *in_tag, uint8_t *out_ct, uint8_t *out_iv, uint8_t *out_tag, uint32_t 26 | batch_sz, int32_t balancer_id, int thread_id); 27 | 28 | // Oblix ecalls 29 | public int oblix_init(); 30 | public void oblix_process_batch(int *ret, uint8_t *in_ct, uint8_t *in_iv, uint8_t *in_tag, uint8_t *out_ct, uint8_t *out_iv, uint8_t *out_tag, uint32_t batch_sz, int32_t balancer_id); 31 | }; 32 | 33 | untrusted { 34 | // Oblix ocalls 35 | char *ocall_setup_ramStore(size_t num, int size); 36 | size_t ocall_nread_ramStore(size_t blockCount,[in,count=blockCount]long long* indexes,size_t len); 37 | void ocall_nwrite_ramStore(size_t blockCount,[in,count=blockCount]long long* indexes,size_t len); 38 | void ocall_initialize_ramStore(long long begin,long long end, size_t len); 39 | void ocall_write_ramStore(long long pos, size_t len); 40 | }; 41 | }; 42 | --------------------------------------------------------------------------------