1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /*
- * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
- // Enclave2.cpp : Defines the exported functions for the DLL application
- #include "sgx_eid.h"
- #include "sgx_tcrypto.h"
- #include "Decryptor_t.h"
- #include "EnclaveMessageExchange.h"
- #include "error_codes.h"
- #include "Utility_Decryptor.h"
- #include "sgx_thread.h"
- #include "sgx_dh.h"
- #include <map>
- #define UNUSED(val) (void)(val)
- //Function that is used to verify the trust of the other enclave
- //Each enclave can have its own way verifying the peer enclave identity
- extern "C" uint32_t verify_peer_enclave_trust(__attribute__((unused)) sgx_dh_session_enclave_identity_t* peer_enclave_identity)
- {
- if(!peer_enclave_identity)
- {
- return INVALID_PARAMETER_ERROR;
- }
- // sgx_measurement_t actual_mr_enclave = peer_enclave_identity->mr_enclave;
- // sgx_measurement_t actual_mr_signer = peer_enclave_identity->mr_signer;
- // verifier's mrsigner
- // uint8_t expected_mr_signer[32] ={0xdf, 0xd7, 0x3b, 0x93, 0xea, 0x39, 0x02, 0x02, 0x3c, 0xd0, 0x52, 0x1a, 0xbd, 0x00, 0xaf, 0xb9, 0xa6, 0x54, 0x57, 0x3e, 0xe5, 0xef, 0x36, 0xf4, 0x8c, 0xc2, 0x4d, 0x92, 0x70, 0xae, 0xd4, 0x7c};
- // int count;
- // for(count=0; count<SGX_HASH_SIZE; count++)
- // {
- /* if( actual_mr_enclave.m[count] != expected_mr_enclave[count] )
- {
- return ENCLAVE_TRUST_ERROR;
- }
- if( actual_mr_signer.m[count] != expected_mr_signer[count] )
- {
- return ENCLAVE_TRUST_ERROR; // TODO: Different error here.
- }*/
- // }
- return SGX_SUCCESS;
- //}
- /* if(peer_enclave_identity->isv_prod_id != 0 || !(peer_enclave_identity->attributes.flags & SGX_FLAGS_INITTED))
- {
- return ENCLAVE_TRUST_ERROR;
- }
- else
- {
- return SUCCESS;
- }*/
- return SUCCESS; //ENCLAVE_TRUST_ERROR;
- }
- uint32_t foo()
- {
- return 0;
- }
|