1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "se_tcrypto_common.h"
- #include <openssl/sha.h>
- #include <openssl/err.h>
- #include "sgx_tcrypto.h"
- sgx_status_t sgx_sha256_msg(const uint8_t *p_src, uint32_t src_len, sgx_sha256_hash_t *p_hash)
- {
- if ((p_src == NULL) || (p_hash == NULL))
- {
- return SGX_ERROR_INVALID_PARAMETER;
- }
- sgx_status_t retval = SGX_ERROR_UNEXPECTED;
- CLEAR_OPENSSL_ERROR_QUEUE;
- do {
-
- if (SHA256((const unsigned char *)p_src, src_len, (unsigned char *)p_hash) == NULL) {
- GET_LAST_OPENSSL_ERROR;
- break;
- }
- retval = SGX_SUCCESS;
- } while(0);
- return retval;
- }
|