Skip to content

Commit

Permalink
Moved from BN_CTX_new to sysenv->big_ctx. Testing deprecated function…
Browse files Browse the repository at this point in the history
…s in...
  • Loading branch information
Sergio Chica committed May 7, 2024
1 parent 6a176da commit 0d0b2c7
Show file tree
Hide file tree
Showing 28 changed files with 269 additions and 403 deletions.
12 changes: 1 addition & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,4 @@ if (HW)
endif ()
add_subdirectory (${CMAKE_SOURCE_DIR}/src/groupsig)
add_subdirectory (${PROJECT_SOURCE_DIR}/src/tools)

# create an executable "demos" to run the basic tests (without compiling gtest)
add_executable(demos src/test/basic/demos.c src/test/basic/kty04.c src/test/basic/ps16.c src/test/basic/utils.c)
target_include_directories(demos PUBLIC src/test/basic)
# if -DHW present, then load PYNQ dependencies as well
# We need to export LD_LIBRARY_PATH with the path to mcl -> export LD_LIBRARY_PATH=$PWD/external/lib/:$LD_LIBRARY_PATH
if (HW)
target_link_libraries(demos kty04 ps16 crypto pynq groupsig cma pthread)
else ()
target_link_libraries(demos kty04 ps16 groupsig)
endif ()
add_subdirectory (${CMAKE_SOURCE_DIR}/src/test/basic)
2 changes: 1 addition & 1 deletion src/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# libgcrypto
add_library (gcrypto STATIC spk.c prf.c)
add_library (gcrypto spk.c prf.c)
target_link_libraries (gcrypto PRIVATE ${OPENSSL_LIBRARIES})
68 changes: 0 additions & 68 deletions src/crypto/prf.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,71 +148,3 @@ int prf_compute(byte_t **out, uint64_t *outlen, prf_key_t *key,
return IOK;

}

/* int prf_compute(byte_t **out, uint64_t *outlen, prf_key_t *key, */
/* byte_t *data, uint64_t len) { */

/* EVP_MAC *mac; */
/* EVP_MAC_CTX *mac_ctx; */
/* byte_t _out[EVP_MAX_MD_SIZE]; */
/* size_t _len; */

/* if (!out || !outlen || !key || !data || !len) { */
/* LOG_EINVAL(&logger, __FILE__, "_dl20_compute_seq", __LINE__, LOGERROR); */
/* return IERROR; */
/* } */

/* /\* Initialize hmac *\/ */
/* if(!(mac = EVP_MAC_fetch(NULL, HASH_BLAKE2_NAME, NULL))) { */
/* LOG_ERRORCODE_MSG(&logger, __FILE__, "prf_compute", __LINE__, EDQUOT, */
/* "OpenSSL: Unknown hash algorithm", LOGERROR); */
/* return IERROR; */
/* } */

/* /\* Initialize ctx *\/ */
/* if(!(mac_ctx = EVP_MAC_CTX_new(mac))) { */
/* LOG_ERRORCODE_MSG(&logger, __FILE__, "prf_compute", __LINE__, EDQUOT, */
/* "OpenSSL: HMAC_CTX_new", LOGERROR); */
/* return IERROR; */
/* } */


/* /\* Compute the HMAC *\/ */
/* if(!(EVP_MAC_init(mac_ctx, key->bytes, key->len, NULL))) { */
/* LOG_ERRORCODE_MSG(&logger, __FILE__, "prf_compute", __LINE__, EDQUOT, */
/* "OpenSSL: EVP_MAC_init", LOGERROR); */
/* EVP_MAC_CTX_free(mac_ctx); */
/* return IERROR; */
/* } */

/* if(!(EVP_MAC_update(mac_ctx, data, (int) len))) { */
/* LOG_ERRORCODE_MSG(&logger, __FILE__, "prf_compute", __LINE__, EDQUOT, */
/* "OpenSSL: EVP_MAC_update", LOGERROR); */
/* EVP_MAC_CTX_free(mac_ctx); */
/* return IERROR; */
/* } */

/* memset(_out, 0, EVP_MAX_MD_SIZE); */
/* if(!(EVP_MAC_final(mac_ctx, _out, &_len, EVP_MAX_MD_SIZE))) { */
/* LOG_ERRORCODE_MSG(&logger, __FILE__, "prf_compute", __LINE__, EDQUOT, */
/* "OpenSSL: HMAC_Final", LOGERROR); */
/* EVP_MAC_CTX_free(mac_ctx); */
/* return IERROR; */
/* } */

/* if (!*out) { */
/* if(!(*out = (byte_t *) mem_malloc(sizeof(byte_t)*_len))) { */
/* LOG_ERRORCODE(&logger, __FILE__, "prf_compute", __LINE__, errno, LOGERROR); */
/* return IERROR; */
/* } */
/* memcpy(*out, _out, _len); */
/* } else { */
/* memcpy(*out, _out, _len); */
/* } */

/* *outlen = (uint64_t) _len; */
/* EVP_MAC_CTX_free(mac_ctx); */

/* return IOK; */

/* } */
4 changes: 2 additions & 2 deletions src/groupsig/cpy06/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include_directories ("${PROJECT_SOURCE_DIR}/src/include"
"${PROJECT_SOURCE_DIR}/src/global")
if (HW)
add_library (cpy06 STATIC grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
add_library (cpy06 grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
mem_key.h signature.c signature.h setup.c
join_mem.c join_mgr.c open.c reveal.c trace.c claim.c
claim_verify.c gml.c gml.h
crl.c crl.h proof.c proof.h identity.c identity.h trapdoor.c trapdoor.h)
else ()
add_library (cpy06 STATIC grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
add_library (cpy06 grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
mem_key.h signature.c signature.h setup.c
join_mem.c join_mgr.c sign.c verify.c open.c reveal.c trace.c claim.c
claim_verify.c prove_equality.c prove_equality_verify.c gml.c gml.h
Expand Down
7 changes: 0 additions & 7 deletions src/groupsig/groupsig.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,6 @@ int groupsig_sign(groupsig_signature_t *sig,

const groupsig_t *gs;

if (!sig) return IERROR;
if (!msg) return IERROR;
if (!memkey) return IERROR;
if (!grpkey) return IERROR;
if (sig->scheme != memkey->scheme) return IERROR;
if (memkey->scheme != grpkey->scheme) return IERROR;

if(!sig || !msg || !memkey || !grpkey ||
sig->scheme != memkey->scheme || memkey->scheme != grpkey->scheme) {
LOG_EINVAL(&logger, __FILE__, "groupsig_sign", __LINE__, LOGERROR);
Expand Down
4 changes: 2 additions & 2 deletions src/groupsig/kty04/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include_directories ("${PROJECT_SOURCE_DIR}/src/include"
"${PROJECT_SOURCE_DIR}/src/global")
if (HW)
add_library (kty04 STATIC grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
add_library (kty04 grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
mem_key.h signature.c signature.h sphere.c sphere.h setup.c
join_mem.c join_mgr.c sign_hw.c verify_hw.c open.c reveal.c trace.c claim.c
claim_verify.c prove_equality_hw.c prove_equality_verify_hw.c gml.c gml.h
crl.c crl.h proof.c proof.h identity.c identity.h trapdoor.c trapdoor.h)
else ()
add_library (kty04 STATIC grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
add_library (kty04 grp_key.c grp_key.h mgr_key.c mgr_key.h mem_key.c
mem_key.h signature.c signature.h sphere.c sphere.h setup.c
join_mem.c join_mgr.c sign.c verify.c open.c reveal.c trace.c claim.c
claim_verify.c prove_equality.c prove_equality_verify.c gml.c gml.h
Expand Down
4 changes: 2 additions & 2 deletions src/hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (HW3)
endif ()

if (HW3)
add_library (shahw STATIC file_hw.c sha3_hw.c mmio.c)
add_library (shahw file_hw.c sha3_hw.c mmio.c)
else ()
add_library (shahw STATIC file_hw.c sha2_hw.c mmio.c)
add_library (shahw file_hw.c sha2_hw.c mmio.c)
endif ()
Loading

0 comments on commit 0d0b2c7

Please sign in to comment.