eapol/eapol_framework/eapol_common/am/include/eap_am_crypto_md4.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    23 #define _EAP_AM_CRYPTO_MD4_H_
    23 #define _EAP_AM_CRYPTO_MD4_H_
    24 
    24 
    25 #include "eap_am_types.h"
    25 #include "eap_am_types.h"
    26 #include "eap_variable_data.h"
    26 #include "eap_variable_data.h"
    27 #include "eap_am_export.h"
    27 #include "eap_am_export.h"
       
    28 // Start: added by script change_export_macros.sh.
       
    29 #if defined(EAP_NO_EXPORT_EAP_AM_CRYPTO_MD4_H)
       
    30 	#define EAP_CLASS_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_NONSHARABLE 
       
    31 	#define EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H 
       
    32 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H 
       
    33 	#define EAP_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H 
       
    34 	#define EAP_C_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H 
       
    35 #elif defined(EAP_EXPORT_EAP_AM_CRYPTO_MD4_H)
       
    36 	#define EAP_CLASS_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_EXPORT 
       
    37 	#define EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_FUNC_EXPORT 
       
    38 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_C_FUNC_EXPORT 
       
    39 	#define EAP_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H EAP_FUNC_EXPORT 
       
    40 	#define EAP_C_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H EAP_C_FUNC_EXPORT 
       
    41 #else
       
    42 	#define EAP_CLASS_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_IMPORT 
       
    43 	#define EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_FUNC_IMPORT 
       
    44 	#define EAP_C_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H EAP_C_FUNC_IMPORT 
       
    45 	#define EAP_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H 
       
    46 	#define EAP_C_FUNC_EXPORT_EAP_AM_CRYPTO_MD4_H 
       
    47 #endif
       
    48 // End: added by script change_export_macros.sh.
    28 #include "eap_am_tools.h"
    49 #include "eap_am_tools.h"
    29 
    50 
    30 
    51 
    31 //--------------------------------------------------
    52 //--------------------------------------------------
    32 
    53 
    33 /// The eap_am_crypto_md4_c class includes the state of 
    54 /// The eap_am_crypto_md4_c class includes the state of 
    34 /// one instance of MD4 algorithm.
    55 /// one instance of MD4 algorithm.
    35 class EAP_EXPORT eap_am_crypto_md4_c
    56 class EAP_CLASS_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_am_crypto_md4_c
    36 {
    57 {
    37 
    58 
    38 private:
    59 private:
    39 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    60 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    40 
    61 
   150 		);
   171 		);
   151 
   172 
   152 	/// @param W is an array of 16 input 32-bit unsigned integers
   173 	/// @param W is an array of 16 input 32-bit unsigned integers
   153 	/// in host order.
   174 	/// in host order.
   154 	/// @param W_count is count of integers in W array.
   175 	/// @param W_count is count of integers in W array.
   155 	EAP_FUNC_IMPORT eap_status_e eap_md4_transform_host_order(
   176 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e eap_md4_transform_host_order(
   156 		const u32_t * const W,
   177 		const u32_t * const W,
   157 		const u32_t W_count
   178 		const u32_t W_count
   158 		);
   179 		);
   159 
   180 
   160 	/// @param W is an array of 16 input 32-bit unsigned integers
   181 	/// @param W is an array of 16 input 32-bit unsigned integers
   161 	/// in network order.
   182 	/// in network order.
   162 	/// @param W_count is count of integers in W array.
   183 	/// @param W_count is count of integers in W array.
   163 	EAP_FUNC_IMPORT eap_status_e eap_md4_process_data(
   184 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e eap_md4_process_data(
   164 		const u32_t * const W,
   185 		const u32_t * const W,
   165 		const u32_t W_count
   186 		const u32_t W_count
   166 		);
   187 		);
   167 
   188 
   168 	/**
   189 	/**
   169 	 * This function cleans up the MD4 context.
   190 	 * This function cleans up the MD4 context.
   170 	 */
   191 	 */
   171 	EAP_FUNC_IMPORT eap_status_e hash_cleanup();
   192 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e hash_cleanup();
   172 
   193 
   173 	/**
   194 	/**
   174 	 * This function copies the message digest to output buffer.
   195 	 * This function copies the message digest to output buffer.
   175 	 */
   196 	 */
   176 	EAP_FUNC_IMPORT eap_status_e copy_message_digest(
   197 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e copy_message_digest(
   177 		void * const output,
   198 		void * const output,
   178 		u32_t * const max_output_size);
   199 		u32_t * const max_output_size);
   179 
   200 
   180 
   201 
   181 	/**
   202 	/**
   182 	 * The set_is_invalid() function sets the state of the eap_am_crypto_md4_c
   203 	 * The set_is_invalid() function sets the state of the eap_am_crypto_md4_c
   183 	 * object invalid. 
   204 	 * object invalid. 
   184 	 * The eap_am_crypto_md4_c object calls this function after it is
   205 	 * The eap_am_crypto_md4_c object calls this function after it is
   185 	 * initialized.
   206 	 * initialized.
   186 	 */
   207 	 */
   187 	EAP_FUNC_IMPORT void set_is_invalid();
   208 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H void set_is_invalid();
   188 
   209 
   189 	/**
   210 	/**
   190 	 * The set_is_valid() function sets the state of the eap_am_crypto_md4_c
   211 	 * The set_is_valid() function sets the state of the eap_am_crypto_md4_c
   191 	 * object valid. 
   212 	 * object valid. 
   192 	 * The eap_am_crypto_md4_c object calls this function after it is
   213 	 * The eap_am_crypto_md4_c object calls this function after it is
   193 	 * initialized.
   214 	 * initialized.
   194 	 */
   215 	 */
   195 	EAP_FUNC_IMPORT void set_is_valid();
   216 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H void set_is_valid();
   196 
   217 
   197 	/**
   218 	/**
   198 	 * This function copies the context of MD4.
   219 	 * This function copies the context of MD4.
   199 	 */
   220 	 */
   200 	EAP_FUNC_IMPORT eap_status_e copy_context(
   221 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e copy_context(
   201 		const eap_variable_data_c * const saved_data,
   222 		const eap_variable_data_c * const saved_data,
   202 		const u64_t full_hashed_data_length,
   223 		const u64_t full_hashed_data_length,
   203 		const u32_t * const H,
   224 		const u32_t * const H,
   204 		const u32_t * const W_in_host_order);
   225 		const u32_t * const W_in_host_order);
   205 
   226 
   208 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   229 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   209 
   230 
   210 	/**
   231 	/**
   211 	 * Destructor does nothing special.
   232 	 * Destructor does nothing special.
   212 	 */
   233 	 */
   213 	EAP_FUNC_IMPORT virtual ~eap_am_crypto_md4_c();
   234 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H virtual ~eap_am_crypto_md4_c();
   214 
   235 
   215 	/**
   236 	/**
   216 	 * Constructor initializes the member attributes.
   237 	 * Constructor initializes the member attributes.
   217 	 */
   238 	 */
   218 	EAP_FUNC_IMPORT eap_am_crypto_md4_c(abs_eap_am_tools_c * const tools);
   239 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_am_crypto_md4_c(abs_eap_am_tools_c * const tools);
   219 
   240 
   220 	/**
   241 	/**
   221 	 * The get_is_valid() function returns the status of the
   242 	 * The get_is_valid() function returns the status of the
   222 	 * eap_am_crypto_md4_c object. 
   243 	 * eap_am_crypto_md4_c object. 
   223 	 * True indicates the object is allocated successfully.
   244 	 * True indicates the object is allocated successfully.
   224 	 */
   245 	 */
   225 	EAP_FUNC_IMPORT bool get_is_valid();
   246 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H bool get_is_valid();
   226 
   247 
   227 	/**
   248 	/**
   228 	 * This function returns the size of message digest of HASH-algorithm.
   249 	 * This function returns the size of message digest of HASH-algorithm.
   229 	 */
   250 	 */
   230 	EAP_FUNC_IMPORT u32_t get_digest_length();
   251 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H u32_t get_digest_length();
   231 
   252 
   232 	/**
   253 	/**
   233 	 * This function returns the size of block of HASH-algorithm.
   254 	 * This function returns the size of block of HASH-algorithm.
   234 	 */
   255 	 */
   235 	EAP_FUNC_IMPORT u32_t get_block_size();
   256 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H u32_t get_block_size();
   236 
   257 
   237 	/**
   258 	/**
   238 	 * This function initializes the context of MD4-algorithm.
   259 	 * This function initializes the context of MD4-algorithm.
   239 	 */
   260 	 */
   240 	EAP_FUNC_IMPORT eap_status_e hash_init();
   261 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e hash_init();
   241 
   262 
   242 	/**
   263 	/**
   243 	 * This function updates the context of MD4-algorithm with data.
   264 	 * This function updates the context of MD4-algorithm with data.
   244 	 */
   265 	 */
   245 	EAP_FUNC_IMPORT eap_status_e hash_update(
   266 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e hash_update(
   246 		const void * const data,
   267 		const void * const data,
   247 		const u32_t data_length);
   268 		const u32_t data_length);
   248 
   269 
   249 	/**
   270 	/**
   250 	 * This function writes the message digest to buffer.
   271 	 * This function writes the message digest to buffer.
   251 	 * @param Length is set if md_length_or_null is non-NULL.
   272 	 * @param Length is set if md_length_or_null is non-NULL.
   252 	 */
   273 	 */
   253 	EAP_FUNC_IMPORT eap_status_e hash_final(
   274 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_status_e hash_final(
   254 		void * const message_digest,
   275 		void * const message_digest,
   255 		u32_t *md_length_or_null);
   276 		u32_t *md_length_or_null);
   256 
   277 
   257 	/**
   278 	/**
   258 	 * This function copies the context of MD4.
   279 	 * This function copies the context of MD4.
   259 	 */
   280 	 */
   260 	EAP_FUNC_IMPORT eap_am_crypto_md4_c * copy();
   281 	EAP_FUNC_VISIBILITY_EAP_AM_CRYPTO_MD4_H eap_am_crypto_md4_c * copy();
   261 };
   282 };
   262 
   283 
   263 //--------------------------------------------------
   284 //--------------------------------------------------
   264 
   285 
   265 #endif //#if !defined( _EAP_AM_CRYPTO_OPENSSL_H_ )
   286 #endif //#if !defined( _EAP_AM_CRYPTO_OPENSSL_H_ )