diff -r bad0cc58d154 -r c74b3d9f6b9e eapol/eapol_framework/eapol_common/am/common/DSS_random/dss_random.cpp --- a/eapol/eapol_framework/eapol_common/am/common/DSS_random/dss_random.cpp Tue Aug 31 15:16:37 2010 +0300 +++ b/eapol/eapol_framework/eapol_common/am/common/DSS_random/dss_random.cpp Wed Sep 01 12:23:57 2010 +0100 @@ -16,7 +16,7 @@ */ /* -* %version: 10.1.5 % +* %version: 12 % */ // This is enumeration of EAPOL source code. @@ -46,7 +46,6 @@ static const u32_t DEBUG_BUFFER_SIZE = 80; - /** * dss_random_G() implements the G() function using modified SHA-1. * @code @@ -74,7 +73,7 @@ * X= 47c27eb6 16dba413 91e5165b e9c5e397 7e39a15d * @endcode */ -eap_status_e dss_random_G(abs_eap_am_tools_c * const m_am_tools, u8_t *out, u32_t out_length, u8_t *c, u32_t c_length) +void dss_random_G(abs_eap_am_tools_c * const m_am_tools, u8_t *out, u32_t out_length, u8_t *c, u32_t c_length) { u32_t *out_array = reinterpret_cast(out); @@ -93,25 +92,12 @@ ); if (status != eap_status_ok) { - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_EAP_AM_CRYPTO, (EAPL("ERROR: eap_sha1_dss_G_function(): status = %d"), + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_EAP_AM_CRYPTO, (EAPL("eap_sha1_dss_G_function(): status = %d"), status)); } - - return status; } } -#define CLEAN_OPENSSL_BN(ctx) \ - { \ - BN_free(&bn_mod); \ - BN_free(&bn_tmp); \ - BN_free(&bn_xkey); \ - BN_free(&bn_xj); \ - BN_free(&bn_one); \ - BN_free(&bn_160); \ - BN_CTX_free(ctx); \ - } - /** * dss_pseudo_random() implements pseudo random function for key genearation of EAP/SIM. * @code @@ -177,16 +163,7 @@ u8_t debug_buffer[DEBUG_BUFFER_SIZE]; EAP_UNREFERENCED_PARAMETER(debug_buffer); - eap_status_e status = dss_random_G(m_am_tools, &(out[ind*BLOCK_SIZE]), BLOCK_SIZE, tmp_xkey, BLOCK_SIZE); - if (status != eap_status_ok) - { - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_EAP_AM_CRYPTO, (EAPL("ERROR: dss_random_G(): status = %d"), - status)); - - CLEAN_OPENSSL_BN(ctx); - - return status; - } + dss_random_G(m_am_tools, &(out[ind*BLOCK_SIZE]), BLOCK_SIZE, tmp_xkey, BLOCK_SIZE); EAP_TRACE_FORMAT(m_am_tools, (debug_buffer, DEBUG_BUFFER_SIZE, EAPL("w[%d] "), ind)); EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_EAP_AM_CRYPTO, (EAPL("dss_pseudo_random(): %s = G(xkey[%d])\n"), @@ -227,7 +204,14 @@ tmp_xkey, sizeof(tmp_xkey))); } - CLEAN_OPENSSL_BN(ctx); + BN_free(&bn_mod); + BN_free(&bn_tmp); + BN_free(&bn_xkey); + BN_free(&bn_xj); + BN_free(&bn_one); + BN_free(&bn_160); + + BN_CTX_free(ctx); return eap_status_ok; }