SKALE-1512 change automake settings

parent 20b54803
......@@ -104,6 +104,8 @@ add_custom_target(sgxd COMMAND make all
secure_enclave/secure_enclave.c
secure_enclave/secure_enclave_t.c
secure_enclave/secure_enclave_t.h
secure_enclave/DKGUtils.h
secure_enclave/DKGUtils.cpp
create_enclave.c
create_enclave.h
oc_alloc.c
......
This diff is collapsed.
/usr/share/automake-1.15/compile
\ No newline at end of file
/usr/share/automake-1.16/compile
\ No newline at end of file
/usr/share/automake-1.15/depcomp
\ No newline at end of file
/usr/share/automake-1.16/depcomp
\ No newline at end of file
/usr/share/automake-1.15/install-sh
\ No newline at end of file
/usr/share/automake-1.16/install-sh
\ No newline at end of file
/usr/share/automake-1.15/missing
\ No newline at end of file
/usr/share/automake-1.16/missing
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
secure_enclave.o: secure_enclave.c secure_enclave_t.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdint.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/stdint.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/cdefs.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/_types.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/wchar.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stddef.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_edger8r.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_defs.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_error.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_eid.h \
/home/kladko/sgxwallet/tgmp-build/include/sgx_tgmp.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/limits.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/limits.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdlib.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tcrypto.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_attributes.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_key.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_report.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tseal.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tcrypto.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_trts.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/math.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/float.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/string.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdio.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdarg.h \
../intel-sgx-ssl/Linux/package/include/openssl/ec.h \
../intel-sgx-ssl/Linux/package/include/openssl/opensslconf.h \
../intel-sgx-ssl/Linux/package/include/openssl/opensslv.h \
../intel-sgx-ssl/Linux/package/include/openssl/asn1.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/time.h \
../intel-sgx-ssl/Linux/package/include/openssl/e_os2.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/inttypes.h \
../intel-sgx-ssl/Linux/package/include/openssl/bio.h \
../intel-sgx-ssl/Linux/package/include/openssl/crypto.h \
../intel-sgx-ssl/Linux/package/include/openssl/safestack.h \
../intel-sgx-ssl/Linux/package/include/openssl/stack.h \
../intel-sgx-ssl/Linux/package/include/openssl/ossl_typ.h \
../intel-sgx-ssl/Linux/package/include/openssl/cryptoerr.h \
../intel-sgx-ssl/Linux/package/include/openssl/symhacks.h \
../intel-sgx-ssl/Linux/package/include/pthread.h \
../intel-sgx-ssl/Linux/package/include/openssl/bioerr.h \
../intel-sgx-ssl/Linux/package/include/openssl/asn1err.h \
../intel-sgx-ssl/Linux/package/include/openssl/bn.h \
../intel-sgx-ssl/Linux/package/include/openssl/bnerr.h \
../intel-sgx-ssl/Linux/package/include/openssl/ecerr.h \
../intel-sgx-ssl/Linux/package/include/openssl/evp.h \
../intel-sgx-ssl/Linux/package/include/openssl/evperr.h \
../intel-sgx-ssl/Linux/package/include/openssl/objects.h \
../intel-sgx-ssl/Linux/package/include/openssl/obj_mac.h \
../intel-sgx-ssl/Linux/package/include/openssl/objectserr.h \
../intel-sgx-ssl/Linux/package/include/openssl/err.h \
../intel-sgx-ssl/Linux/package/include/openssl/lhash.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/errno.h \
../intel-sgx-ssl/Linux/package/include/openssl/rand.h \
../intel-sgx-ssl/Linux/package/include/openssl/randerr.h \
../intel-sgx-ssl/Linux/package/include/tSgxSSL_api.h \
../sgxwallet_common.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/unistd.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/types.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/endian.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdbool.h
secure_enclave_t.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdint.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/stdint.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/cdefs.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/_types.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/wchar.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stddef.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_edger8r.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_defs.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_error.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_eid.h:
/home/kladko/sgxwallet/tgmp-build/include/sgx_tgmp.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/limits.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/limits.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdlib.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tcrypto.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_attributes.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_key.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_report.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tseal.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_tcrypto.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_trts.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/math.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/float.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/string.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdio.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdarg.h:
../intel-sgx-ssl/Linux/package/include/openssl/ec.h:
../intel-sgx-ssl/Linux/package/include/openssl/opensslconf.h:
../intel-sgx-ssl/Linux/package/include/openssl/opensslv.h:
../intel-sgx-ssl/Linux/package/include/openssl/asn1.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/time.h:
../intel-sgx-ssl/Linux/package/include/openssl/e_os2.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/inttypes.h:
../intel-sgx-ssl/Linux/package/include/openssl/bio.h:
../intel-sgx-ssl/Linux/package/include/openssl/crypto.h:
../intel-sgx-ssl/Linux/package/include/openssl/safestack.h:
../intel-sgx-ssl/Linux/package/include/openssl/stack.h:
../intel-sgx-ssl/Linux/package/include/openssl/ossl_typ.h:
../intel-sgx-ssl/Linux/package/include/openssl/cryptoerr.h:
../intel-sgx-ssl/Linux/package/include/openssl/symhacks.h:
../intel-sgx-ssl/Linux/package/include/pthread.h:
../intel-sgx-ssl/Linux/package/include/openssl/bioerr.h:
../intel-sgx-ssl/Linux/package/include/openssl/asn1err.h:
../intel-sgx-ssl/Linux/package/include/openssl/bn.h:
../intel-sgx-ssl/Linux/package/include/openssl/bnerr.h:
../intel-sgx-ssl/Linux/package/include/openssl/ecerr.h:
../intel-sgx-ssl/Linux/package/include/openssl/evp.h:
../intel-sgx-ssl/Linux/package/include/openssl/evperr.h:
../intel-sgx-ssl/Linux/package/include/openssl/objects.h:
../intel-sgx-ssl/Linux/package/include/openssl/obj_mac.h:
../intel-sgx-ssl/Linux/package/include/openssl/objectserr.h:
../intel-sgx-ssl/Linux/package/include/openssl/err.h:
../intel-sgx-ssl/Linux/package/include/openssl/lhash.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/errno.h:
../intel-sgx-ssl/Linux/package/include/openssl/rand.h:
../intel-sgx-ssl/Linux/package/include/openssl/randerr.h:
../intel-sgx-ssl/Linux/package/include/tSgxSSL_api.h:
../sgxwallet_common.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/unistd.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/types.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/endian.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdbool.h:
secure_enclave_t.o: secure_enclave_t.c secure_enclave_t.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdint.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/stdint.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/cdefs.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/_types.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/wchar.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stddef.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_edger8r.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_defs.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_error.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_eid.h \
/home/kladko/sgxwallet/tgmp-build/include/sgx_tgmp.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/limits.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/limits.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdlib.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_trts.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_lfence.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/errno.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/mbusafecrt.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/string.h \
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdarg.h
secure_enclave_t.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdint.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/stdint.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/cdefs.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/_types.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/wchar.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stddef.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_edger8r.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_defs.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_error.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_eid.h:
/home/kladko/sgxwallet/tgmp-build/include/sgx_tgmp.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/limits.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/sys/limits.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdlib.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_trts.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/sgx_lfence.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/errno.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/mbusafecrt.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/string.h:
/home/kladko/sgxwallet/sgx-sdk-build/sgxsdk/include/tlibc/stdarg.h:
......@@ -131,4 +131,3 @@ bool sign(const char *_keyString, const char* _hashXString, const char* _hashYSt
//
// Created by kladko on 9/5/19.
//
#include "DKGUtils.h"
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <../trusted_libff/libff/algebra/fields/fp.hpp>
#include "../sgxwallet_common.h"
std::string stringFromFr(libff::alt_bn128_Fr& _el) {
mpz_t t;
mpz_init(t);
_el.as_bigint().to_mpz(t);
char arr[mpz_sizeinbase(t, 10) + 2];
char *tmp = mpz_get_str(arr, 10, t);
mpz_clear(t);
return std::string(tmp);
}
void gen_dkg_poly( char secret[BUF_LEN], unsigned len, unsigned _t ){
libff::init_alt_bn128_params();
std::string result;
for (size_t i = 0; i < _t; ++i) {
libff::alt_bn128_Fr cur_coef = 1;//libff::alt_bn128_Fr::random_element();
/* while (i == _t - 1 && cur_coef == libff::alt_bn128_Fr::zero()) {
cur_coef = libff::alt_bn128_Fr::random_element();
}*/
result += stringFromFr(cur_coef);
if ( i < _t - 1) result += ":";
}
strncpy(secret, result.c_str(), BUF_LEN);
len = result.length();
}
\ No newline at end of file
//
// Created by kladko on 9/5/19.
//
#ifndef SGXD_DKGUTILS_H
#define SGXD_DKGUTILS_H
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
EXTERNC void gen_dkg_poly( char* secret, unsigned len, unsigned _t);
#endif //SGXD_DKGUTILS_H
......@@ -85,7 +85,7 @@ CLEANFILES+= secure_enclave_t.c secure_enclave_t.h
secure_enclave_SOURCES = secure_enclave_t.c secure_enclave_t.h \
secure_enclave.c \
BLSUtils.cpp ../trusted_libff/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \
DKGUtils.cpp BLSUtils.cpp ../trusted_libff/libff/algebra/fields/fp.hpp ../trusted_libff/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \
../trusted_libff/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp $(ENCLAVE_KEY) $(ENCLAVE_CONFIG)
......
This diff is collapsed.
......@@ -287,6 +287,8 @@ void ecdsa_sign_message(int *err_status, char *err_string, uint8_t *encrypted_k
//strncpy(signature, ecdsaSig, MAX_SIG_LEN);
......@@ -343,3 +345,31 @@ void ecdsa_sign_message(int *err_status, char *err_string, uint8_t *encrypted_k
*err_status = 0;
}
void gen_dkg_secret (int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, size_t _t){
size_t len = 0;
char dkg_secret[BUF_LEN];
gen_dkg_poly( dkg_secret, len, _t);
char poly[BUF_LEN];
memset(poly, 0, BUF_LEN);
strncpy(poly, dkg_secret, len);
memset(encrypted_dkg_secret, 0, BUF_LEN);
uint32_t sealedLen = sgx_calc_sealed_data_size(0, sizeof(poly));
sgx_status_t status = sgx_seal_data(0, NULL, BUF_LEN, (uint8_t*)dkg_secret, sealedLen,(sgx_sealed_data_t*)encrypted_dkg_secret);
if ( poly[0] != '1'){
snprintf(err_string, BUF_LEN,"wrong poly");
}
if( status != SGX_SUCCESS) {
snprintf(err_string, BUF_LEN,"SGX seal data failed");
}
}
\ No newline at end of file
......@@ -56,6 +56,12 @@ enclave {
uint32_t enc_len,
[in, count = 1024] uint8_t* hash,
[out, count = 1024] char* signature);
public void gen_dkg_secret (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[out, count = 1024] uint8_t* encrypted_dkg_secret,
size_t _t);
};
......
......@@ -43,7 +43,6 @@ void usage() {
}
sgx_launch_token_t token = {0};
sgx_enclave_id_t eid;
sgx_status_t status;
int updated;
......
......@@ -114,6 +114,24 @@ TEST_CASE( "DKG gen test", "[dkg-gen]" ) {
init_all();
// put your test here
uint8_t* encrypted_dkg_secret = (uint8_t*) calloc(1024, 1);
//char* Array = (char*) calloc(128, 1);
char* errMsg = (char*) calloc(1024,1);
int err_status = 0;
// unsigned int enc_len = 0;
//(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, size_t _t)
status = gen_dkg_secret (eid, &err_status, errMsg, encrypted_dkg_secret, 1);
REQUIRE(status == SGX_SUCCESS);
printf("gen_dkg_secret completed with status: %d %s \n", err_status, errMsg);
printf(" Encrypted key len %d\n", sizeof(encrypted_dkg_secret));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment