Selaa lähdekoodia

Commented out open context function in ecc256.cpp and successive calls in proc_msg1. Works on Apache.

dettanym 6 vuotta sitten
vanhempi
commit
add91777cd
2 muutettua tiedostoa jossa 11 lisäystä ja 9 poistoa
  1. 7 5
      sdk/ec_dh_lib/ec_dh.cpp
  2. 4 4
      sdk/tlibcrypto/ipp/sgx_ecc256.cpp

+ 7 - 5
sdk/ec_dh_lib/ec_dh.cpp

@@ -142,7 +142,7 @@ static sgx_status_t dh_generate_message1(sgx_dh_msg1_t *msg1, sgx_internal_dh_se
     return SGX_SUCCESS;
 }
 
-static sgx_status_t dh_generate_message2(const sgx_dh_msg1_t *msg1,
+__attribute__((unused)) static sgx_status_t dh_generate_message2(const sgx_dh_msg1_t *msg1,
                                       const sgx_ec256_public_t *g_b, 
                                       const sgx_key_128bit_t *dh_smk,
                                       sgx_dh_msg2_t *msg2)
@@ -493,8 +493,8 @@ sgx_status_t sgx_dh_initiator_proc_msg1(const sgx_dh_msg1_t* msg1, sgx_dh_msg2_t
 {
     sgx_status_t se_ret;
 
-    sgx_ec256_public_t pub_key;
-    sgx_ec256_private_t priv_key;
+//    sgx_ec256_public_t pub_key;
+//    sgx_ec256_private_t priv_key;
     sgx_ec256_dh_shared_t shared_key;
     sgx_key_128bit_t dh_smk;
 
@@ -534,7 +534,8 @@ sgx_status_t sgx_dh_initiator_proc_msg1(const sgx_dh_msg1_t* msg1, sgx_dh_msg2_t
     {
         goto error;
     }
-    // generate private key and public key
+
+/*    // generate private key and public key
     se_ret = sgx_ecc256_create_key_pair((sgx_ec256_private_t*)&priv_key, 
                                        (sgx_ec256_public_t*)&pub_key, 
                                         ecc_state);
@@ -588,7 +589,7 @@ sgx_status_t sgx_dh_initiator_proc_msg1(const sgx_dh_msg1_t* msg1, sgx_dh_msg2_t
     }
 
     session->initiator.state = SGX_DH_SESSION_INITIATOR_WAIT_M3;
-    return SGX_SUCCESS;
+*/    return SGX_SUCCESS;
 
 error:
     sgx_ecc256_close_context(ecc_state);
@@ -604,6 +605,7 @@ error:
     INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret)
 
     return se_ret;
+
 }
 
 //sgx_dh_responder_proc_msg2 processes M2 message, generates M3 message, and returns the session key AEK.

+ 4 - 4
sdk/tlibcrypto/ipp/sgx_ecc256.cpp

@@ -40,9 +40,9 @@
 * Parameters:
 *   Return: sgx_status_t  - SGX_SUCCESS or failure as defined sgx_error.h
 *   Output: sgx_ecc_state_handle_t *p_ecc_handle - Pointer to the handle of ECC crypto system  */
-sgx_status_t sgx_ecc256_open_context(sgx_ecc_state_handle_t* p_ecc_handle)
+sgx_status_t sgx_ecc256_open_context(__attribute__((unused))sgx_ecc_state_handle_t* p_ecc_handle)
 {
-    IppStatus ipp_ret = ippStsNoErr;
+/*    IppStatus ipp_ret = ippStsNoErr;
     IppsECCPState* p_ecc_state = NULL;
     // default use 256r1 parameter
     int ctx_size = 0;
@@ -52,7 +52,7 @@ sgx_status_t sgx_ecc256_open_context(sgx_ecc_state_handle_t* p_ecc_handle)
     ipp_ret = ippsECCPGetSize(256, &ctx_size);
     if (ipp_ret != ippStsNoErr)
         return SGX_ERROR_UNEXPECTED;
-    p_ecc_state = (IppsECCPState*)(malloc(ctx_size));
+    p_ecc_state = (IppsECCPState*)(malloc(10));
     if (p_ecc_state == NULL)
         return SGX_ERROR_OUT_OF_MEMORY;
     ipp_ret = ippsECCPInit(256, p_ecc_state);
@@ -70,7 +70,7 @@ sgx_status_t sgx_ecc256_open_context(sgx_ecc_state_handle_t* p_ecc_handle)
         return SGX_ERROR_UNEXPECTED;
     }
     *p_ecc_handle = p_ecc_state;
-    return SGX_SUCCESS;
+*/    return SGX_SUCCESS;
 }
 
 /* Cleans up ecc context