eapol/eapol_framework/eapol_common/include/eap_crypto_api.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    23 #define _EAP_CRYPTO_API_H_
    23 #define _EAP_CRYPTO_API_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_CRYPTO_API_H)
       
    30 	#define EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H EAP_NONSHARABLE 
       
    31 	#define EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H 
       
    32 	#define EAP_C_FUNC_VISIBILITY_EAP_CRYPTO_API_H 
       
    33 	#define EAP_FUNC_EXPORT_EAP_CRYPTO_API_H 
       
    34 	#define EAP_C_FUNC_EXPORT_EAP_CRYPTO_API_H 
       
    35 #elif defined(EAP_EXPORT_EAP_CRYPTO_API_H)
       
    36 	#define EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H EAP_EXPORT 
       
    37 	#define EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H EAP_FUNC_EXPORT 
       
    38 	#define EAP_C_FUNC_VISIBILITY_EAP_CRYPTO_API_H EAP_C_FUNC_EXPORT 
       
    39 	#define EAP_FUNC_EXPORT_EAP_CRYPTO_API_H EAP_FUNC_EXPORT 
       
    40 	#define EAP_C_FUNC_EXPORT_EAP_CRYPTO_API_H EAP_C_FUNC_EXPORT 
       
    41 #else
       
    42 	#define EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H EAP_IMPORT 
       
    43 	#define EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H EAP_FUNC_IMPORT 
       
    44 	#define EAP_C_FUNC_VISIBILITY_EAP_CRYPTO_API_H EAP_C_FUNC_IMPORT 
       
    45 	#define EAP_FUNC_EXPORT_EAP_CRYPTO_API_H 
       
    46 	#define EAP_C_FUNC_EXPORT_EAP_CRYPTO_API_H 
       
    47 #endif
       
    48 // End: added by script change_export_macros.sh.
    28 #include "abs_eap_am_crypto.h"
    49 #include "abs_eap_am_crypto.h"
    29 #include "eap_array.h"
    50 #include "eap_array.h"
    30 
    51 
    31 #if defined(des_set_key)
    52 #if defined(des_set_key)
    32 // OpenSSL defines this.
    53 // OpenSSL defines this.
    40 const u32_t HMAC_MD5_128_SIZE = 16u; // bytes = 128 bits
    61 const u32_t HMAC_MD5_128_SIZE = 16u; // bytes = 128 bits
    41 
    62 
    42 const u32_t WPA_PSK_LENGTH = 32;
    63 const u32_t WPA_PSK_LENGTH = 32;
    43 
    64 
    44 /// The abs_crypto_block_algorithm_c class describes interface of CBC block encryption algorithm.
    65 /// The abs_crypto_block_algorithm_c class describes interface of CBC block encryption algorithm.
    45 class EAP_EXPORT abs_crypto_cbc_block_algorithm_c
    66 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_cbc_block_algorithm_c
    46 {
    67 {
    47 
    68 
    48 	// - - - - - - - - - - - - - - - - - - - - - - - -
    69 	// - - - - - - - - - - - - - - - - - - - - - - - -
    49 private:
    70 private:
    50 	// - - - - - - - - - - - - - - - - - - - - - - - -
    71 	// - - - - - - - - - - - - - - - - - - - - - - - -
    52 
    73 
    53 	// - - - - - - - - - - - - - - - - - - - - - - - -
    74 	// - - - - - - - - - - - - - - - - - - - - - - - -
    54 public:
    75 public:
    55 	// - - - - - - - - - - - - - - - - - - - - - - - -
    76 	// - - - - - - - - - - - - - - - - - - - - - - - -
    56 
    77 
    57 	EAP_FUNC_IMPORT virtual ~abs_crypto_cbc_block_algorithm_c();
    78 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~abs_crypto_cbc_block_algorithm_c();
    58 
    79 
    59 	/**
    80 	/**
    60 	 * The set_is_valid() function sets the state of the
    81 	 * The set_is_valid() function sets the state of the
    61 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
    82 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
    62 	 * calls this function after it is initialized.
    83 	 * calls this function after it is initialized.
   215 };
   236 };
   216 
   237 
   217 
   238 
   218 
   239 
   219 /// The abs_crypto_block_algorithm_c class describes interface of block encryption algorithm.
   240 /// The abs_crypto_block_algorithm_c class describes interface of block encryption algorithm.
   220 class EAP_EXPORT abs_crypto_block_algorithm_c
   241 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_block_algorithm_c
   221 {
   242 {
   222 
   243 
   223 	// - - - - - - - - - - - - - - - - - - - - - - - -
   244 	// - - - - - - - - - - - - - - - - - - - - - - - -
   224 private:
   245 private:
   225 	// - - - - - - - - - - - - - - - - - - - - - - - -
   246 	// - - - - - - - - - - - - - - - - - - - - - - - -
   227 
   248 
   228 	// - - - - - - - - - - - - - - - - - - - - - - - -
   249 	// - - - - - - - - - - - - - - - - - - - - - - - -
   229 public:
   250 public:
   230 	// - - - - - - - - - - - - - - - - - - - - - - - -
   251 	// - - - - - - - - - - - - - - - - - - - - - - - -
   231 
   252 
   232 	EAP_FUNC_IMPORT virtual ~abs_crypto_block_algorithm_c();
   253 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~abs_crypto_block_algorithm_c();
   233 
   254 
   234 	/**
   255 	/**
   235 	 * The set_is_valid() function sets the state of the
   256 	 * The set_is_valid() function sets the state of the
   236 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
   257 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
   237 	 * calls this function after it is initialized.
   258 	 * calls this function after it is initialized.
   300 };
   321 };
   301 
   322 
   302 
   323 
   303 
   324 
   304 /// The abs_crypto_stream_algorithm_c class describes interface of stream encryption algorithm.
   325 /// The abs_crypto_stream_algorithm_c class describes interface of stream encryption algorithm.
   305 class EAP_EXPORT abs_crypto_stream_algorithm_c
   326 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_stream_algorithm_c
   306 {
   327 {
   307 
   328 
   308 	// - - - - - - - - - - - - - - - - - - - - - - - -
   329 	// - - - - - - - - - - - - - - - - - - - - - - - -
   309 private:
   330 private:
   310 	// - - - - - - - - - - - - - - - - - - - - - - - -
   331 	// - - - - - - - - - - - - - - - - - - - - - - - -
   312 
   333 
   313 	// - - - - - - - - - - - - - - - - - - - - - - - -
   334 	// - - - - - - - - - - - - - - - - - - - - - - - -
   314 public:
   335 public:
   315 	// - - - - - - - - - - - - - - - - - - - - - - - -
   336 	// - - - - - - - - - - - - - - - - - - - - - - - -
   316 
   337 
   317 	EAP_FUNC_IMPORT virtual ~abs_crypto_stream_algorithm_c();
   338 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~abs_crypto_stream_algorithm_c();
   318 
   339 
   319 	/**
   340 	/**
   320 	 * The set_is_valid() function sets the state of the
   341 	 * The set_is_valid() function sets the state of the
   321 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
   342 	 * abs_crypto_block_algorithm_c object valid. The abs_crypto_block_algorithm_c object 
   322 	 * calls this function after it is initialized.
   343 	 * calls this function after it is initialized.
   376 };
   397 };
   377 
   398 
   378 
   399 
   379 
   400 
   380 /// The abs_crypto_hash_algorithm_c class describes interface the MAC algorithm.
   401 /// The abs_crypto_hash_algorithm_c class describes interface the MAC algorithm.
   381 class EAP_EXPORT abs_crypto_hash_algorithm_c
   402 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hash_algorithm_c
   382 {
   403 {
   383 
   404 
   384 	// - - - - - - - - - - - - - - - - - - - - - - - -
   405 	// - - - - - - - - - - - - - - - - - - - - - - - -
   385 private:
   406 private:
   386 	// - - - - - - - - - - - - - - - - - - - - - - - -
   407 	// - - - - - - - - - - - - - - - - - - - - - - - -
   388 
   409 
   389 	// - - - - - - - - - - - - - - - - - - - - - - - -
   410 	// - - - - - - - - - - - - - - - - - - - - - - - -
   390 public:
   411 public:
   391 	// - - - - - - - - - - - - - - - - - - - - - - - -
   412 	// - - - - - - - - - - - - - - - - - - - - - - - -
   392 
   413 
   393 	EAP_FUNC_IMPORT virtual ~abs_crypto_hash_algorithm_c();
   414 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~abs_crypto_hash_algorithm_c();
   394 
   415 
   395 	/**
   416 	/**
   396 	 * The set_is_valid() function sets the state of the
   417 	 * The set_is_valid() function sets the state of the
   397 	 * abs_crypto_hash_algorithm_c object valid. The abs_crypto_hash_algorithm_c object 
   418 	 * abs_crypto_hash_algorithm_c object valid. The abs_crypto_hash_algorithm_c object 
   398 	 * calls this function after it is initialized.
   419 	 * calls this function after it is initialized.
   455 
   476 
   456 //------------------------------------------------------------
   477 //------------------------------------------------------------
   457 
   478 
   458 
   479 
   459 /// The abs_crypto_mac_algorithm_c class describes interface the HMAC algorithm.
   480 /// The abs_crypto_mac_algorithm_c class describes interface the HMAC algorithm.
   460 class EAP_EXPORT abs_crypto_hmac_algorithm_c
   481 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hmac_algorithm_c
   461 {
   482 {
   462 
   483 
   463 	// - - - - - - - - - - - - - - - - - - - - - - - -
   484 	// - - - - - - - - - - - - - - - - - - - - - - - -
   464 private:
   485 private:
   465 	// - - - - - - - - - - - - - - - - - - - - - - - -
   486 	// - - - - - - - - - - - - - - - - - - - - - - - -
   467 
   488 
   468 	// - - - - - - - - - - - - - - - - - - - - - - - -
   489 	// - - - - - - - - - - - - - - - - - - - - - - - -
   469 public:
   490 public:
   470 	// - - - - - - - - - - - - - - - - - - - - - - - -
   491 	// - - - - - - - - - - - - - - - - - - - - - - - -
   471 
   492 
   472 	EAP_FUNC_IMPORT virtual ~abs_crypto_hmac_algorithm_c();
   493 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~abs_crypto_hmac_algorithm_c();
   473 
   494 
   474 	/**
   495 	/**
   475 	 * The set_is_valid() function sets the state of the
   496 	 * The set_is_valid() function sets the state of the
   476 	 * abs_crypto_mac_algorithm_c object valid. The abs_crypto_mac_algorithm_c object 
   497 	 * abs_crypto_mac_algorithm_c object valid. The abs_crypto_mac_algorithm_c object 
   477 	 * calls this function after it is initialized.
   498 	 * calls this function after it is initialized.
   524 
   545 
   525 //------------------------------------------------------------
   546 //------------------------------------------------------------
   526 
   547 
   527 
   548 
   528 /// The crypto_hmac_c class describes HMAC algorithm.
   549 /// The crypto_hmac_c class describes HMAC algorithm.
   529 class EAP_EXPORT crypto_hmac_c
   550 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_hmac_c
   530 : public abs_crypto_hmac_algorithm_c
   551 : public abs_crypto_hmac_algorithm_c
   531 {
   552 {
   532 
   553 
   533 	// - - - - - - - - - - - - - - - - - - - - - - - -
   554 	// - - - - - - - - - - - - - - - - - - - - - - - -
   534 private:
   555 private:
   554 
   575 
   555 	/// This object must free m_crypto_hash_algorithm when this value is true.
   576 	/// This object must free m_crypto_hash_algorithm when this value is true.
   556 	bool m_free_crypto_hash_algorithm;
   577 	bool m_free_crypto_hash_algorithm;
   557 
   578 
   558 
   579 
   559 	EAP_FUNC_IMPORT eap_status_e initialize_pad(
   580 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e initialize_pad(
   560 		eap_variable_data_c * const p_pad,
   581 		eap_variable_data_c * const p_pad,
   561 		const u8_t pad_value);
   582 		const u8_t pad_value);
   562 
   583 
   563 	// - - - - - - - - - - - - - - - - - - - - - - - -
   584 	// - - - - - - - - - - - - - - - - - - - - - - - -
   564 public:
   585 public:
   565 	// - - - - - - - - - - - - - - - - - - - - - - - -
   586 	// - - - - - - - - - - - - - - - - - - - - - - - -
   566 
   587 
   567 	/**
   588 	/**
   568 	 * Destructor resets the used internal buffers.
   589 	 * Destructor resets the used internal buffers.
   569 	 */
   590 	 */
   570 	EAP_FUNC_IMPORT virtual ~crypto_hmac_c();
   591 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_hmac_c();
   571 
   592 
   572 	/**
   593 	/**
   573 	 * Constructor initializes the used internal buffers.
   594 	 * Constructor initializes the used internal buffers.
   574 	 */
   595 	 */
   575 	EAP_FUNC_IMPORT crypto_hmac_c(
   596 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_hmac_c(
   576 		abs_eap_am_tools_c * const tools,
   597 		abs_eap_am_tools_c * const tools,
   577 		abs_crypto_hash_algorithm_c * const crypto_hash_algorithm,
   598 		abs_crypto_hash_algorithm_c * const crypto_hash_algorithm,
   578 		const bool free_crypto_hash_algorithm);
   599 		const bool free_crypto_hash_algorithm);
   579 
   600 
   580 	/**
   601 	/**
   581 	 * The set_is_valid() function sets the state of the
   602 	 * The set_is_valid() function sets the state of the
   582 	 * abs_crypto_mac_algorithm_c object valid. The abs_crypto_mac_algorithm_c object 
   603 	 * abs_crypto_mac_algorithm_c object valid. The abs_crypto_mac_algorithm_c object 
   583 	 * calls this function after it is initialized.
   604 	 * calls this function after it is initialized.
   584 	 */
   605 	 */
   585 	EAP_FUNC_IMPORT void set_is_valid();
   606 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
   586 
   607 
   587 	/**
   608 	/**
   588 	 * The get_is_valid() function returns the status of the abs_crypto_mac_algorithm_c object.
   609 	 * The get_is_valid() function returns the status of the abs_crypto_mac_algorithm_c object.
   589 	 * True indicates the object is initialized.
   610 	 * True indicates the object is initialized.
   590 	 */
   611 	 */
   591 	EAP_FUNC_IMPORT bool get_is_valid();
   612 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
   592 
   613 
   593 	// - - - - - - - - - - - - - - - - - - - - - - - -
   614 	// - - - - - - - - - - - - - - - - - - - - - - - -
   594 
   615 
   595 	/**
   616 	/**
   596 	 * This function returns the size of message digest of HMAC-algorithm.
   617 	 * This function returns the size of message digest of HMAC-algorithm.
   597 	 */
   618 	 */
   598 	EAP_FUNC_IMPORT u32_t get_digest_length();
   619 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_digest_length();
   599 
   620 
   600 	/**
   621 	/**
   601 	 * This function sets the mode to encryption, 
   622 	 * This function sets the mode to encryption, 
   602 	 * sets the initialization vector and the encryption key.
   623 	 * sets the initialization vector and the encryption key.
   603 	 */
   624 	 */
   604 	EAP_FUNC_IMPORT eap_status_e hmac_set_key(
   625 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hmac_set_key(
   605 		const eap_variable_data_c * const hmac_key);
   626 		const eap_variable_data_c * const hmac_key);
   606 
   627 
   607 	/**
   628 	/**
   608 	 * This function updates the context of HMAC-algorithm with data.
   629 	 * This function updates the context of HMAC-algorithm with data.
   609 	 */
   630 	 */
   610 	EAP_FUNC_IMPORT eap_status_e hmac_update(
   631 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hmac_update(
   611 		const void * const data,
   632 		const void * const data,
   612 		const u32_t data_length);
   633 		const u32_t data_length);
   613 
   634 
   614 	/**
   635 	/**
   615 	 * This function writes the message digest to buffer. 
   636 	 * This function writes the message digest to buffer. 
   616 	 * Length is set if md_length_or_null is non-NULL.
   637 	 * Length is set if md_length_or_null is non-NULL.
   617 	 */
   638 	 */
   618 	EAP_FUNC_IMPORT eap_status_e hmac_final(
   639 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hmac_final(
   619 		void * const message_digest,
   640 		void * const message_digest,
   620 		u32_t *md_length_or_null);
   641 		u32_t *md_length_or_null);
   621 
   642 
   622 	/**
   643 	/**
   623 	 * This function writes the message digest of HMAC of 128 bits in length to buffer. 
   644 	 * This function writes the message digest of HMAC of 128 bits in length to buffer. 
   624 	 * Length is set if md_length_or_null is non-NULL.
   645 	 * Length is set if md_length_or_null is non-NULL.
   625 	 */
   646 	 */
   626 	EAP_FUNC_IMPORT eap_status_e hmac_128_final(
   647 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hmac_128_final(
   627 		void * const message_digest,
   648 		void * const message_digest,
   628 		u32_t *md_length_or_null);
   649 		u32_t *md_length_or_null);
   629 
   650 
   630 	/**
   651 	/**
   631 	 * This function cleans up the HMAC context.
   652 	 * This function cleans up the HMAC context.
   632 	 */
   653 	 */
   633 	EAP_FUNC_IMPORT eap_status_e hmac_cleanup();
   654 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hmac_cleanup();
   634 
   655 
   635 	// - - - - - - - - - - - - - - - - - - - - - - - -
   656 	// - - - - - - - - - - - - - - - - - - - - - - - -
   636 };
   657 };
   637 
   658 
   638 
   659 
   639 //------------------------------------------------------------
   660 //------------------------------------------------------------
   640 
   661 
   641 /// The crypto_cbc_c class includes the state of 
   662 /// The crypto_cbc_c class includes the state of 
   642 /// one instance of CBC block encryption algorithm.
   663 /// one instance of CBC block encryption algorithm.
   643 class EAP_EXPORT crypto_cbc_c
   664 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_cbc_c
   644 : public abs_crypto_cbc_block_algorithm_c
   665 : public abs_crypto_cbc_block_algorithm_c
   645 {
   666 {
   646 
   667 
   647 	// - - - - - - - - - - - - - - - - - - - - - - - -
   668 	// - - - - - - - - - - - - - - - - - - - - - - - -
   648 private:
   669 private:
   681 
   702 
   682 	bool m_free_crypto_block_algorithm;
   703 	bool m_free_crypto_block_algorithm;
   683 
   704 
   684 	// - - - - - - - - - - - - - - - - - - - - - - - -
   705 	// - - - - - - - - - - - - - - - - - - - - - - - -
   685 
   706 
   686 	EAP_FUNC_IMPORT void reset();
   707 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void reset();
   687 
   708 
   688 	/**
   709 	/**
   689 	 * Run xor to data and IV block.
   710 	 * Run xor to data and IV block.
   690 	 */
   711 	 */
   691 	EAP_FUNC_IMPORT void cbc_xor_block(
   712 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void cbc_xor_block(
   692 		const void * const encryption_IV,
   713 		const void * const encryption_IV,
   693 		void * const data_block,
   714 		void * const data_block,
   694 		const u32_t block_size,
   715 		const u32_t block_size,
   695 		const u32_t key_length);
   716 		const u32_t key_length);
   696 
   717 
   697 	/**
   718 	/**
   698 	 * Copies source to target.
   719 	 * Copies source to target.
   699 	 */
   720 	 */
   700 	EAP_FUNC_IMPORT void cbc_copy_block(
   721 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void cbc_copy_block(
   701 		void * const target,
   722 		void * const target,
   702 		const void * const source,
   723 		const void * const source,
   703 		const u32_t block_size,
   724 		const u32_t block_size,
   704 		const u32_t key_length);
   725 		const u32_t key_length);
   705 
   726 
   706 	/**
   727 	/**
   707 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
   728 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
   708 	 * Note the length of the data must be aligned to block size of the cipher.
   729 	 * Note the length of the data must be aligned to block size of the cipher.
   709 	 */
   730 	 */
   710 	EAP_FUNC_IMPORT eap_status_e internal_encrypt_data(
   731 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e internal_encrypt_data(
   711 		const void * const data_in,
   732 		const void * const data_in,
   712 		void * const data_out,
   733 		void * const data_out,
   713 		const u32_t data_length);
   734 		const u32_t data_length);
   714 
   735 
   715 	/**
   736 	/**
   716 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
   737 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
   717 	 * Note the length of the data must be aligned to block size of the cipher.
   738 	 * Note the length of the data must be aligned to block size of the cipher.
   718 	 */
   739 	 */
   719 	EAP_FUNC_IMPORT eap_status_e internal_decrypt_data(
   740 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e internal_decrypt_data(
   720 		const void * const data_in,
   741 		const void * const data_in,
   721 		void * const data_out,
   742 		void * const data_out,
   722 		const u32_t data_length);
   743 		const u32_t data_length);
   723 
   744 
   724 
   745 
   727 	// - - - - - - - - - - - - - - - - - - - - - - - -
   748 	// - - - - - - - - - - - - - - - - - - - - - - - -
   728 
   749 
   729 	/**
   750 	/**
   730 	 * Destructor resets the used internal buffers.
   751 	 * Destructor resets the used internal buffers.
   731 	 */
   752 	 */
   732 	EAP_FUNC_IMPORT virtual ~crypto_cbc_c();
   753 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_cbc_c();
   733 
   754 
   734 	/**
   755 	/**
   735 	 * Constructor initializes the used internal buffers.
   756 	 * Constructor initializes the used internal buffers.
   736 	 */
   757 	 */
   737 	EAP_FUNC_IMPORT crypto_cbc_c(
   758 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_cbc_c(
   738 		abs_eap_am_tools_c * const tools,
   759 		abs_eap_am_tools_c * const tools,
   739 		abs_crypto_block_algorithm_c * const crypto_block_algorithm,
   760 		abs_crypto_block_algorithm_c * const crypto_block_algorithm,
   740 		const bool free_crypto_block_algorithm);
   761 		const bool free_crypto_block_algorithm);
   741 
   762 
   742 	/**
   763 	/**
   743 	 * The get_encrypts() function returns true when encryption is initialized.
   764 	 * The get_encrypts() function returns true when encryption is initialized.
   744 	 * It returns false when decryption is initialized.
   765 	 * It returns false when decryption is initialized.
   745 	 */
   766 	 */
   746 	EAP_FUNC_IMPORT virtual bool get_encrypts();
   767 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual bool get_encrypts();
   747 
   768 
   748 	/**
   769 	/**
   749 	 * This function returns the length of CBC key in bytes.
   770 	 * This function returns the length of CBC key in bytes.
   750 	 */
   771 	 */
   751 	EAP_FUNC_IMPORT virtual u32_t get_key_length();
   772 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual u32_t get_key_length();
   752 
   773 
   753 	/**
   774 	/**
   754 	 * This function returns the length of CBC block size in bytes.
   775 	 * This function returns the length of CBC block size in bytes.
   755 	 */
   776 	 */
   756 	EAP_FUNC_IMPORT virtual u32_t get_block_size();
   777 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual u32_t get_block_size();
   757 
   778 
   758 	/**
   779 	/**
   759 	 * The set_is_valid() function sets the state of the
   780 	 * The set_is_valid() function sets the state of the
   760 	 * crypto_cbc_c object valid. The crypto_cbc_c object 
   781 	 * crypto_cbc_c object valid. The crypto_cbc_c object 
   761 	 * calls this function after it is initialized.
   782 	 * calls this function after it is initialized.
   762 	 */
   783 	 */
   763 	EAP_FUNC_IMPORT void set_is_valid();
   784 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
   764 
   785 
   765 	/**
   786 	/**
   766 	 * The get_is_valid() function returns the status of the crypto_cbc_c object.
   787 	 * The get_is_valid() function returns the status of the crypto_cbc_c object.
   767 	 * True indicates the object is initialized.
   788 	 * True indicates the object is initialized.
   768 	 */
   789 	 */
   769 	EAP_FUNC_IMPORT bool get_is_valid();
   790 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
   770 
   791 
   771 	/**
   792 	/**
   772 	 * This function returns the internally stored initialization vector.
   793 	 * This function returns the internally stored initialization vector.
   773 	 * The last encrypted and decrypted block is stored to this buffer 
   794 	 * The last encrypted and decrypted block is stored to this buffer 
   774 	 * between subsequent encryption and decryption calls. 
   795 	 * between subsequent encryption and decryption calls. 
   775 	 * User of crypto_cbc_c object could get the last stored block calling this function.
   796 	 * User of crypto_cbc_c object could get the last stored block calling this function.
   776 	 */
   797 	 */
   777 	EAP_FUNC_IMPORT const eap_variable_data_c * get_tmp_IV();
   798 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H const eap_variable_data_c * get_tmp_IV();
   778 
   799 
   779 	// - - - - - - - - - - - - - - - - - - - - - - - -
   800 	// - - - - - - - - - - - - - - - - - - - - - - - -
   780 
   801 
   781 	/**
   802 	/**
   782 	 * Calculates the data length aligned to block size.
   803 	 * Calculates the data length aligned to block size.
   783 	 */
   804 	 */
   784 	EAP_FUNC_IMPORT u32_t aligned_data_length(
   805 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t aligned_data_length(
   785 		u32_t data_length);
   806 		u32_t data_length);
   786 
   807 
   787 	/**
   808 	/**
   788 	 * This function adds count padding bytes to buffer. All padding bytes are zero (0x00).
   809 	 * This function adds count padding bytes to buffer. All padding bytes are zero (0x00).
   789 	 */
   810 	 */
   790 	EAP_FUNC_IMPORT eap_status_e add_padding_bytes(
   811 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e add_padding_bytes(
   791 		void * const buffer,
   812 		void * const buffer,
   792 		const u32_t buffer_length,
   813 		const u32_t buffer_length,
   793 		const u8_t padding_byte);
   814 		const u8_t padding_byte);
   794 
   815 
   795 	/**
   816 	/**
   796 	 * This function checks the count padding bytes of buffer are zero (0x00).
   817 	 * This function checks the count padding bytes of buffer are zero (0x00).
   797 	 */
   818 	 */
   798 	EAP_FUNC_IMPORT eap_status_e check_padding_bytes(
   819 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e check_padding_bytes(
   799 		const void * const buffer,
   820 		const void * const buffer,
   800 		const u32_t buffer_length,
   821 		const u32_t buffer_length,
   801 		const u8_t padding_byte);
   822 		const u8_t padding_byte);
   802 
   823 
   803 	/**
   824 	/**
   804 	 * This function sets the mode to encryption, 
   825 	 * This function sets the mode to encryption, 
   805 	 * sets the initialization vector and the encryption key.
   826 	 * sets the initialization vector and the encryption key.
   806 	 */
   827 	 */
   807 	EAP_FUNC_IMPORT eap_status_e set_encryption_key(
   828 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_encryption_key(
   808 		const void * const encryption_IV,
   829 		const void * const encryption_IV,
   809 		const u32_t encryption_IV_length,
   830 		const u32_t encryption_IV_length,
   810 		const void * const key,
   831 		const void * const key,
   811 		const u32_t key_length);
   832 		const u32_t key_length);
   812 
   833 
   813 	/**
   834 	/**
   814 	 * This function sets the mode to decryption, 
   835 	 * This function sets the mode to decryption, 
   815 	 * sets the initialization vector and the decryption key.
   836 	 * sets the initialization vector and the decryption key.
   816 	 */
   837 	 */
   817 	EAP_FUNC_IMPORT eap_status_e set_decryption_key(
   838 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_decryption_key(
   818 		const void * const encryption_IV,
   839 		const void * const encryption_IV,
   819 		const u32_t encryption_IV_length,
   840 		const u32_t encryption_IV_length,
   820 		const void * const key,
   841 		const void * const key,
   821 		const u32_t key_length);
   842 		const u32_t key_length);
   822 
   843 
   823 	/**
   844 	/**
   824 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
   845 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
   825 	 * Note the length of the data must be aligned to block size of the cipher.
   846 	 * Note the length of the data must be aligned to block size of the cipher.
   826 	 */
   847 	 */
   827 	EAP_FUNC_IMPORT eap_status_e encrypt_data(
   848 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_data(
   828 		const void * const data_in,
   849 		const void * const data_in,
   829 		void * const data_out,
   850 		void * const data_out,
   830 		const u32_t data_length);
   851 		const u32_t data_length);
   831 
   852 
   832 	/**
   853 	/**
   833 	 * This function encrypts continuous data bytes in data_in_out buffer. 
   854 	 * This function encrypts continuous data bytes in data_in_out buffer. 
   834 	 * Note the length of the data must be aligned to block size of the cipher.
   855 	 * Note the length of the data must be aligned to block size of the cipher.
   835 	 */
   856 	 */
   836 	EAP_FUNC_IMPORT eap_status_e encrypt_data(
   857 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_data(
   837 		void * const data_in_out,
   858 		void * const data_in_out,
   838 		const u32_t data_length);
   859 		const u32_t data_length);
   839 
   860 
   840 	/**
   861 	/**
   841 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
   862 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
   842 	 * Note the length of the data must be aligned to block size of the cipher.
   863 	 * Note the length of the data must be aligned to block size of the cipher.
   843 	 */
   864 	 */
   844 	EAP_FUNC_IMPORT eap_status_e decrypt_data(
   865 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_data(
   845 		const void * const data_in,
   866 		const void * const data_in,
   846 		void * const data_out,
   867 		void * const data_out,
   847 		const u32_t data_length);
   868 		const u32_t data_length);
   848 
   869 
   849 	/**
   870 	/**
   850 	 * This function decrypts continuous data bytes in data_in_out buffer. 
   871 	 * This function decrypts continuous data bytes in data_in_out buffer. 
   851 	 * Note the length of the data must be aligned to block size of the cipher.
   872 	 * Note the length of the data must be aligned to block size of the cipher.
   852 	 */
   873 	 */
   853 	EAP_FUNC_IMPORT eap_status_e decrypt_data(
   874 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_data(
   854 		void * const data_in_out,
   875 		void * const data_in_out,
   855 		const u32_t data_length);
   876 		const u32_t data_length);
   856 
   877 
   857 	// - - - - - - - - - - - - - - - - - - - - - - - -
   878 	// - - - - - - - - - - - - - - - - - - - - - - - -
   858 
   879 
   864 	 * aligned to CBC-block size. Only the sum of whole data must be aligned to CBC-block size.
   885 	 * aligned to CBC-block size. Only the sum of whole data must be aligned to CBC-block size.
   865 	 * This version takes pointers to input and output buffers as a parameter. 
   886 	 * This version takes pointers to input and output buffers as a parameter. 
   866 	 * Those buffers must be fully separated. Some optimizations are used 
   887 	 * Those buffers must be fully separated. Some optimizations are used 
   867 	 * taking advance from separate buffers. 
   888 	 * taking advance from separate buffers. 
   868 	 */
   889 	 */
   869 	EAP_FUNC_IMPORT eap_status_e update_non_aligned(
   890 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e update_non_aligned(
   870 		const void * const msg_in,
   891 		const void * const msg_in,
   871 		void * const msg_out,
   892 		void * const msg_out,
   872 		const u32_t msg_size);
   893 		const u32_t msg_size);
   873 
   894 
   874 	// - - - - - - - - - - - - - - - - - - - - - - - -
   895 	// - - - - - - - - - - - - - - - - - - - - - - - -
   879 	 * depends of the initialized context. NOTE the length of data feed in 
   900 	 * depends of the initialized context. NOTE the length of data feed in 
   880 	 * separate calls of update_non_aligned() does not need to be 
   901 	 * separate calls of update_non_aligned() does not need to be 
   881 	 * aligned to CBC-block size. Only the sum of whole data must be aligned to CBC-block size.
   902 	 * aligned to CBC-block size. Only the sum of whole data must be aligned to CBC-block size.
   882 	 * This version takes one pointer to buffer. The buffer is used for input and output data. 
   903 	 * This version takes one pointer to buffer. The buffer is used for input and output data. 
   883 	 */
   904 	 */
   884 	EAP_FUNC_IMPORT eap_status_e update_non_aligned(
   905 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e update_non_aligned(
   885 		void * const msg_in_out,
   906 		void * const msg_in_out,
   886 		const u32_t msg_size);
   907 		const u32_t msg_size);
   887 
   908 
   888 	// - - - - - - - - - - - - - - - - - - - - - - - -
   909 	// - - - - - - - - - - - - - - - - - - - - - - - -
   889 
   910 
   890 	/**
   911 	/**
   891 	 * The finalize_non_aligned() finalizes the CBC-context. 
   912 	 * The finalize_non_aligned() finalizes the CBC-context. 
   892 	 * The sum of length of feed data must be aligned to CBC-block size 
   913 	 * The sum of length of feed data must be aligned to CBC-block size 
   893 	 * before this function is called.
   914 	 * before this function is called.
   894 	 */
   915 	 */
   895 	EAP_FUNC_IMPORT eap_status_e finalize_non_aligned();
   916 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e finalize_non_aligned();
   896 
   917 
   897 	// - - - - - - - - - - - - - - - - - - - - - - - -
   918 	// - - - - - - - - - - - - - - - - - - - - - - - -
   898 };
   919 };
   899 
   920 
   900 
   921 
   901 //------------------------------------------------------------
   922 //------------------------------------------------------------
   902 
   923 
   903 /// The crypto_aes_c class includes the state of 
   924 /// The crypto_aes_c class includes the state of 
   904 /// one instance of AES block encryption algorithm.
   925 /// one instance of AES block encryption algorithm.
   905 class EAP_EXPORT crypto_aes_c
   926 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_aes_c
   906 : public abs_crypto_block_algorithm_c
   927 : public abs_crypto_block_algorithm_c
   907 {
   928 {
   908 
   929 
   909 	// - - - - - - - - - - - - - - - - - - - - - - - -
   930 	// - - - - - - - - - - - - - - - - - - - - - - - -
   910 private:
   931 private:
   935 	// - - - - - - - - - - - - - - - - - - - - - - - -
   956 	// - - - - - - - - - - - - - - - - - - - - - - - -
   936 
   957 
   937 	/**
   958 	/**
   938 	 * Destructor resets the used internal buffers.
   959 	 * Destructor resets the used internal buffers.
   939 	 */
   960 	 */
   940 	EAP_FUNC_IMPORT virtual ~crypto_aes_c();
   961 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_aes_c();
   941 
   962 
   942 	/**
   963 	/**
   943 	 * Constructor initializes the used internal buffers.
   964 	 * Constructor initializes the used internal buffers.
   944 	 */
   965 	 */
   945 	EAP_FUNC_IMPORT crypto_aes_c(abs_eap_am_tools_c * const tools);
   966 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_aes_c(abs_eap_am_tools_c * const tools);
   946 
   967 
   947 	EAP_FUNC_IMPORT bool get_encrypts();
   968 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_encrypts();
   948 
   969 
   949 	/**
   970 	/**
   950 	 * The set_is_valid() function sets the state of the
   971 	 * The set_is_valid() function sets the state of the
   951 	 * crypto_aes_c object valid. The crypto_aes_c object 
   972 	 * crypto_aes_c object valid. The crypto_aes_c object 
   952 	 * calls this function after it is initialized.
   973 	 * calls this function after it is initialized.
   953 	 */
   974 	 */
   954 	EAP_FUNC_IMPORT void set_is_valid();
   975 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
   955 
   976 
   956 	/**
   977 	/**
   957 	 * The get_is_valid() function returns the status of the crypto_aes_c object.
   978 	 * The get_is_valid() function returns the status of the crypto_aes_c object.
   958 	 * True indicates the object is initialized.
   979 	 * True indicates the object is initialized.
   959 	 */
   980 	 */
   960 	EAP_FUNC_IMPORT bool get_is_valid();
   981 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
   961 
   982 
   962 	/**
   983 	/**
   963 	 * This function returns the length of AES key in bytes.
   984 	 * This function returns the length of AES key in bytes.
   964 	 */
   985 	 */
   965 	EAP_FUNC_IMPORT u32_t get_key_length();
   986 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_key_length();
   966 
   987 
   967 	/**
   988 	/**
   968 	 * This function returns the length of AES block size in bytes.
   989 	 * This function returns the length of AES block size in bytes.
   969 	 */
   990 	 */
   970 	EAP_FUNC_IMPORT u32_t get_block_size();
   991 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
   971 
   992 
   972 
   993 
   973 	/**
   994 	/**
   974 	 * This function sets the mode to encryption, 
   995 	 * This function sets the mode to encryption, 
   975 	 * sets the initialization vector and the encryption key.
   996 	 * sets the initialization vector and the encryption key.
   976 	 */
   997 	 */
   977 	EAP_FUNC_IMPORT eap_status_e set_encryption_key(
   998 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_encryption_key(
   978 		const void * const key,
   999 		const void * const key,
   979 		const u32_t key_length);
  1000 		const u32_t key_length);
   980 
  1001 
   981 	/**
  1002 	/**
   982 	 * This function sets the mode to decryption, 
  1003 	 * This function sets the mode to decryption, 
   983 	 * sets the initialization vector and the decryption key.
  1004 	 * sets the initialization vector and the decryption key.
   984 	 */
  1005 	 */
   985 	EAP_FUNC_IMPORT eap_status_e set_decryption_key(
  1006 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_decryption_key(
   986 		const void * const key,
  1007 		const void * const key,
   987 		const u32_t key_length);
  1008 		const u32_t key_length);
   988 
  1009 
   989 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1010 	// - - - - - - - - - - - - - - - - - - - - - - - -
   990 
  1011 
   991 	/**
  1012 	/**
   992 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
  1013 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
   993 	 * Note the length of the data must be aligned to block size of the cipher.
  1014 	 * Note the length of the data must be aligned to block size of the cipher.
   994 	 */
  1015 	 */
   995 	EAP_FUNC_IMPORT eap_status_e encrypt_block(
  1016 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_block(
   996 		const void * const data_in,
  1017 		const void * const data_in,
   997 		void * const data_out,
  1018 		void * const data_out,
   998 		const u32_t data_length);
  1019 		const u32_t data_length);
   999 
  1020 
  1000 	/**
  1021 	/**
  1001 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1022 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1002 	 * Note the length of the data must be aligned to block size of the cipher.
  1023 	 * Note the length of the data must be aligned to block size of the cipher.
  1003 	 */
  1024 	 */
  1004 	EAP_FUNC_IMPORT eap_status_e decrypt_block(
  1025 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_block(
  1005 		const void * const data_in,
  1026 		const void * const data_in,
  1006 		void * const data_out,
  1027 		void * const data_out,
  1007 		const u32_t data_length);
  1028 		const u32_t data_length);
  1008 
  1029 
  1009 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1030 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1012 
  1033 
  1013 //------------------------------------------------------------
  1034 //------------------------------------------------------------
  1014 
  1035 
  1015 /// The crypto_3des_ede_c class includes the state of 
  1036 /// The crypto_3des_ede_c class includes the state of 
  1016 /// one instance of 3DES-EDE block encryption algorithm.
  1037 /// one instance of 3DES-EDE block encryption algorithm.
  1017 class EAP_EXPORT crypto_3des_ede_c
  1038 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_3des_ede_c
  1018 : public abs_crypto_block_algorithm_c
  1039 : public abs_crypto_block_algorithm_c
  1019 {
  1040 {
  1020 
  1041 
  1021 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1042 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1022 private:
  1043 private:
  1047 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1068 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1048 
  1069 
  1049 	/**
  1070 	/**
  1050 	 * Destructor resets the used internal buffers.
  1071 	 * Destructor resets the used internal buffers.
  1051 	 */
  1072 	 */
  1052 	EAP_FUNC_IMPORT virtual ~crypto_3des_ede_c();
  1073 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_3des_ede_c();
  1053 
  1074 
  1054 	/**
  1075 	/**
  1055 	 * Constructor initializes the used internal buffers.
  1076 	 * Constructor initializes the used internal buffers.
  1056 	 */
  1077 	 */
  1057 	EAP_FUNC_IMPORT crypto_3des_ede_c(abs_eap_am_tools_c * const tools);
  1078 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_3des_ede_c(abs_eap_am_tools_c * const tools);
  1058 
  1079 
  1059 	EAP_FUNC_IMPORT bool get_encrypts();
  1080 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_encrypts();
  1060 
  1081 
  1061 	/**
  1082 	/**
  1062 	 * The set_is_valid() function sets the state of the
  1083 	 * The set_is_valid() function sets the state of the
  1063 	 * crypto_3des_ede_c object valid. The crypto_3des_ede_c object 
  1084 	 * crypto_3des_ede_c object valid. The crypto_3des_ede_c object 
  1064 	 * calls this function after it is initialized.
  1085 	 * calls this function after it is initialized.
  1065 	 */
  1086 	 */
  1066 	EAP_FUNC_IMPORT void set_is_valid();
  1087 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1067 
  1088 
  1068 	/**
  1089 	/**
  1069 	 * The get_is_valid() function returns the status of the crypto_3des_ede_c object.
  1090 	 * The get_is_valid() function returns the status of the crypto_3des_ede_c object.
  1070 	 * True indicates the object is initialized.
  1091 	 * True indicates the object is initialized.
  1071 	 */
  1092 	 */
  1072 	EAP_FUNC_IMPORT bool get_is_valid();
  1093 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1073 
  1094 
  1074 	/**
  1095 	/**
  1075 	 * This function returns the length of 3DES-EDE key in bytes.
  1096 	 * This function returns the length of 3DES-EDE key in bytes.
  1076 	 */
  1097 	 */
  1077 	EAP_FUNC_IMPORT u32_t get_key_length();
  1098 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_key_length();
  1078 
  1099 
  1079 	/**
  1100 	/**
  1080 	 * This function returns the length of 3DES-EDE block size in bytes.
  1101 	 * This function returns the length of 3DES-EDE block size in bytes.
  1081 	 */
  1102 	 */
  1082 	EAP_FUNC_IMPORT u32_t get_block_size();
  1103 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1083 
  1104 
  1084 
  1105 
  1085 	/**
  1106 	/**
  1086 	 * This function sets the mode to encryption, 
  1107 	 * This function sets the mode to encryption, 
  1087 	 * sets the initialization vector and the encryption key.
  1108 	 * sets the initialization vector and the encryption key.
  1088 	 */
  1109 	 */
  1089 	EAP_FUNC_IMPORT eap_status_e set_encryption_key(
  1110 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_encryption_key(
  1090 		const void * const key,
  1111 		const void * const key,
  1091 		const u32_t key_length);
  1112 		const u32_t key_length);
  1092 
  1113 
  1093 	/**
  1114 	/**
  1094 	 * This function sets the mode to decryption, 
  1115 	 * This function sets the mode to decryption, 
  1095 	 * sets the initialization vector and the decryption key.
  1116 	 * sets the initialization vector and the decryption key.
  1096 	 */
  1117 	 */
  1097 	EAP_FUNC_IMPORT eap_status_e set_decryption_key(
  1118 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_decryption_key(
  1098 		const void * const key,
  1119 		const void * const key,
  1099 		const u32_t key_length);
  1120 		const u32_t key_length);
  1100 
  1121 
  1101 	/**
  1122 	/**
  1102 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
  1123 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
  1103 	 * Note the length of the data must be aligned to block size of the cipher.
  1124 	 * Note the length of the data must be aligned to block size of the cipher.
  1104 	 */
  1125 	 */
  1105 	EAP_FUNC_IMPORT eap_status_e encrypt_block(
  1126 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_block(
  1106 		const void * const data_in,
  1127 		const void * const data_in,
  1107 		void * const data_out,
  1128 		void * const data_out,
  1108 		const u32_t data_length);
  1129 		const u32_t data_length);
  1109 
  1130 
  1110 	/**
  1131 	/**
  1111 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1132 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1112 	 * Note the length of the data must be aligned to block size of the cipher.
  1133 	 * Note the length of the data must be aligned to block size of the cipher.
  1113 	 */
  1134 	 */
  1114 	EAP_FUNC_IMPORT eap_status_e decrypt_block(
  1135 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_block(
  1115 		const void * const data_in,
  1136 		const void * const data_in,
  1116 		void * const data_out,
  1137 		void * const data_out,
  1117 		const u32_t data_length);
  1138 		const u32_t data_length);
  1118 
  1139 
  1119 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1140 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1129 
  1150 
  1130 const u64_t EAP_CRYPTO_AES_WRAP_BLOCK_SIZE = sizeof(u64_t);
  1151 const u64_t EAP_CRYPTO_AES_WRAP_BLOCK_SIZE = sizeof(u64_t);
  1131 
  1152 
  1132 
  1153 
  1133 /// The crypto_aes_wrap_c class describes interface of block encryption algorithm.
  1154 /// The crypto_aes_wrap_c class describes interface of block encryption algorithm.
  1134 class EAP_EXPORT crypto_aes_wrap_c
  1155 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_aes_wrap_c
  1135 {
  1156 {
  1136 
  1157 
  1137 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1158 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1138 private:
  1159 private:
  1139 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1160 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1155 
  1176 
  1156 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1177 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1157 public:
  1178 public:
  1158 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1179 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1159 
  1180 
  1160 	EAP_FUNC_IMPORT virtual ~crypto_aes_wrap_c();
  1181 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_aes_wrap_c();
  1161 
  1182 
  1162 	/**
  1183 	/**
  1163 	 * Constructor initializes the used internal buffers.
  1184 	 * Constructor initializes the used internal buffers.
  1164 	 */
  1185 	 */
  1165 	EAP_FUNC_IMPORT crypto_aes_wrap_c(abs_eap_am_tools_c * const tools);
  1186 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_aes_wrap_c(abs_eap_am_tools_c * const tools);
  1166 
  1187 
  1167 	/**
  1188 	/**
  1168 	 * The set_is_valid() function sets the state of the
  1189 	 * The set_is_valid() function sets the state of the
  1169 	 * crypto_aes_wrap_c object valid. The crypto_aes_wrap_c object 
  1190 	 * crypto_aes_wrap_c object valid. The crypto_aes_wrap_c object 
  1170 	 * calls this function after it is initialized.
  1191 	 * calls this function after it is initialized.
  1171 	 */
  1192 	 */
  1172 	EAP_FUNC_IMPORT void set_is_valid();
  1193 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1173 
  1194 
  1174 	/**
  1195 	/**
  1175 	 * The get_is_valid() function returns the status of the crypto_aes_wrap_c object.
  1196 	 * The get_is_valid() function returns the status of the crypto_aes_wrap_c object.
  1176 	 * True indicates the object is initialized.
  1197 	 * True indicates the object is initialized.
  1177 	 */
  1198 	 */
  1178 	EAP_FUNC_IMPORT bool get_is_valid();
  1199 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1179 
  1200 
  1180 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1201 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1181 
  1202 
  1182 	/**
  1203 	/**
  1183 	 * The get_encrypts() function returns true when encryption is initialized.
  1204 	 * The get_encrypts() function returns true when encryption is initialized.
  1184 	 * It returns false when decryption is initialized.
  1205 	 * It returns false when decryption is initialized.
  1185 	 */
  1206 	 */
  1186 	EAP_FUNC_IMPORT bool get_encrypts();
  1207 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_encrypts();
  1187 
  1208 
  1188 	/**
  1209 	/**
  1189 	 * This function returns the length of key in bytes.
  1210 	 * This function returns the length of key in bytes.
  1190 	 */
  1211 	 */
  1191 	EAP_FUNC_IMPORT u32_t get_key_length();
  1212 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_key_length();
  1192 
  1213 
  1193 	/**
  1214 	/**
  1194 	 * This function returns the length of block size in bytes.
  1215 	 * This function returns the length of block size in bytes.
  1195 	 */
  1216 	 */
  1196 	EAP_FUNC_IMPORT u32_t get_block_size();
  1217 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1197 
  1218 
  1198 	/**
  1219 	/**
  1199 	 * This function sets the mode to encryption, 
  1220 	 * This function sets the mode to encryption, 
  1200 	 * sets the initialization vector and the encryption key.
  1221 	 * sets the initialization vector and the encryption key.
  1201 	 */
  1222 	 */
  1202 	EAP_FUNC_IMPORT eap_status_e set_encryption_key(
  1223 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_encryption_key(
  1203 		const void * const key,
  1224 		const void * const key,
  1204 		const u32_t key_length);
  1225 		const u32_t key_length);
  1205 
  1226 
  1206 	/**
  1227 	/**
  1207 	 * This function sets the mode to decryption, 
  1228 	 * This function sets the mode to decryption, 
  1208 	 * sets the initialization vector and the decryption key.
  1229 	 * sets the initialization vector and the decryption key.
  1209 	 */
  1230 	 */
  1210 	EAP_FUNC_IMPORT eap_status_e set_decryption_key(
  1231 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_decryption_key(
  1211 		const void * const key,
  1232 		const void * const key,
  1212 		const u32_t key_length);
  1233 		const u32_t key_length);
  1213 
  1234 
  1214 	/**
  1235 	/**
  1215 	 * This function adds buffer_length padding bytes to buffer.
  1236 	 * This function adds buffer_length padding bytes to buffer.
  1216 	 */
  1237 	 */
  1217 	EAP_FUNC_IMPORT eap_status_e add_padding_bytes(
  1238 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e add_padding_bytes(
  1218 		void * const buffer,
  1239 		void * const buffer,
  1219 		const u32_t buffer_length);
  1240 		const u32_t buffer_length);
  1220 
  1241 
  1221 	/**
  1242 	/**
  1222 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
  1243 	 * This function encrypts continuous data bytes from data_in to data_out buffer. 
  1223 	 * Note the length of the data must be aligned to block size of the cipher.
  1244 	 * Note the length of the data must be aligned to block size of the cipher.
  1224 	 */
  1245 	 */
  1225 	EAP_FUNC_IMPORT eap_status_e encrypt_block(
  1246 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_block(
  1226 		const void * const data_in,
  1247 		const void * const data_in,
  1227 		const u32_t data_in_length,
  1248 		const u32_t data_in_length,
  1228 		void * const data_out,
  1249 		void * const data_out,
  1229 		const u32_t data_out_length);
  1250 		const u32_t data_out_length);
  1230 
  1251 
  1231 	/**
  1252 	/**
  1232 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1253 	 * This function decrypts continuous data bytes from data_in to data_out buffer. 
  1233 	 * Note the length of the data must be aligned to block size of the cipher.
  1254 	 * Note the length of the data must be aligned to block size of the cipher.
  1234 	 */
  1255 	 */
  1235 	EAP_FUNC_IMPORT eap_status_e decrypt_block(
  1256 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_block(
  1236 		const void * const data_in,
  1257 		const void * const data_in,
  1237 		const u32_t data_in_length,
  1258 		const u32_t data_in_length,
  1238 		void * const data_out,
  1259 		void * const data_out,
  1239 		const u32_t data_out_length);
  1260 		const u32_t data_out_length);
  1240 
  1261 
  1245 
  1266 
  1246 //------------------------------------------------------------
  1267 //------------------------------------------------------------
  1247 
  1268 
  1248 /// The crypto_random_c class includes the state of 
  1269 /// The crypto_random_c class includes the state of 
  1249 /// one instance of random generator.
  1270 /// one instance of random generator.
  1250 class EAP_EXPORT crypto_random_c
  1271 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_random_c
  1251 {
  1272 {
  1252 
  1273 
  1253 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1274 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1254 private:
  1275 private:
  1255 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1276 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1265 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1286 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1266 
  1287 
  1267 	/**
  1288 	/**
  1268 	 * Destructor does nothing special.
  1289 	 * Destructor does nothing special.
  1269 	 */
  1290 	 */
  1270 	EAP_FUNC_IMPORT virtual ~crypto_random_c();
  1291 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_random_c();
  1271 
  1292 
  1272 	/**
  1293 	/**
  1273 	 * Constructor initializes the object.
  1294 	 * Constructor initializes the object.
  1274 	 */
  1295 	 */
  1275 	EAP_FUNC_IMPORT crypto_random_c(abs_eap_am_tools_c * const tools);
  1296 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_random_c(abs_eap_am_tools_c * const tools);
  1276 
  1297 
  1277 	/**
  1298 	/**
  1278 	 * The set_is_valid() function sets the state of the crypto_random_c object valid. 
  1299 	 * The set_is_valid() function sets the state of the crypto_random_c object valid. 
  1279 	 * The crypto_random_c object calls this function after it is initialized.
  1300 	 * The crypto_random_c object calls this function after it is initialized.
  1280 	 */
  1301 	 */
  1281 	EAP_FUNC_IMPORT void set_is_valid();
  1302 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1282 
  1303 
  1283 	/**
  1304 	/**
  1284 	 * The get_is_valid() function returns the status of the crypto_random_c object. 
  1305 	 * The get_is_valid() function returns the status of the crypto_random_c object. 
  1285 	 * True indicates the object is initialized.
  1306 	 * True indicates the object is initialized.
  1286 	 */
  1307 	 */
  1287 	EAP_FUNC_IMPORT bool get_is_valid();
  1308 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1288 
  1309 
  1289 	/**
  1310 	/**
  1290 	 * This function copies count random bytes to buffer.
  1311 	 * This function copies count random bytes to buffer.
  1291 	 */
  1312 	 */
  1292 	EAP_FUNC_IMPORT eap_status_e get_rand_bytes(
  1313 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e get_rand_bytes(
  1293 		void * const buffer,
  1314 		void * const buffer,
  1294 		const u32_t count);
  1315 		const u32_t count);
  1295 
  1316 
  1296 	/**
  1317 	/**
  1297 	 * This function copies count random bytes to buffer.
  1318 	 * This function copies count random bytes to buffer.
  1298 	 */
  1319 	 */
  1299 	EAP_FUNC_IMPORT eap_status_e get_rand_bytes(
  1320 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e get_rand_bytes(
  1300 		eap_variable_data_c * const buffer,
  1321 		eap_variable_data_c * const buffer,
  1301 		const u32_t count);
  1322 		const u32_t count);
  1302 
  1323 
  1303 	/**
  1324 	/**
  1304 	 * This function creates random integer value between minimum and maximum inclusively.
  1325 	 * This function creates random integer value between minimum and maximum inclusively.
  1305 	 */
  1326 	 */
  1306 	EAP_FUNC_IMPORT u32_t get_rand_integer(
  1327 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_rand_integer(
  1307 		const u32_t minimum,
  1328 		const u32_t minimum,
  1308 		const u32_t maximum);
  1329 		const u32_t maximum);
  1309 
  1330 
  1310 	/**
  1331 	/**
  1311 	 * This function seeds the random generator with count bytes from buffer. 
  1332 	 * This function seeds the random generator with count bytes from buffer. 
  1312 	 * User could call this function as many times as is needed and at any time.
  1333 	 * User could call this function as many times as is needed and at any time.
  1313 	 */
  1334 	 */
  1314 	EAP_FUNC_IMPORT eap_status_e add_rand_seed(
  1335 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e add_rand_seed(
  1315 		const void * const buffer,
  1336 		const void * const buffer,
  1316 		const u32_t count);
  1337 		const u32_t count);
  1317 
  1338 
  1318 	/**
  1339 	/**
  1319 	 * This function seeds random generator with the hardware ticks. 
  1340 	 * This function seeds random generator with the hardware ticks. 
  1320 	 * User could call this function as many times as is needed and at any time.
  1341 	 * User could call this function as many times as is needed and at any time.
  1321 	 */
  1342 	 */
  1322 	EAP_FUNC_IMPORT eap_status_e add_rand_seed_hw_ticks();
  1343 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e add_rand_seed_hw_ticks();
  1323 
  1344 
  1324 };
  1345 };
  1325 
  1346 
  1326 
  1347 
  1327 //------------------------------------------------------------
  1348 //------------------------------------------------------------
  1328 
  1349 
  1329 /// The crypto_sha_256_c class includes the state of 
  1350 /// The crypto_sha_256_c class includes the state of 
  1330 /// one instance of SHA-256 algorithm.
  1351 /// one instance of SHA-256 algorithm.
  1331 class EAP_EXPORT crypto_sha_256_c
  1352 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_sha_256_c
  1332 : public abs_crypto_hash_algorithm_c
  1353 : public abs_crypto_hash_algorithm_c
  1333 {
  1354 {
  1334 
  1355 
  1335 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1356 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1336 private:
  1357 private:
  1350 
  1371 
  1351 	/**
  1372 	/**
  1352 	 * The set_is_invalid() function sets the state of the crypto_sha_256_c object invalid. 
  1373 	 * The set_is_invalid() function sets the state of the crypto_sha_256_c object invalid. 
  1353 	 * The crypto_sha_256_c object calls this function after it is initialized.
  1374 	 * The crypto_sha_256_c object calls this function after it is initialized.
  1354 	 */
  1375 	 */
  1355 	EAP_FUNC_IMPORT void set_is_invalid();
  1376 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1356 
  1377 
  1357 	/**
  1378 	/**
  1358 	 * The set_is_valid() function sets the state of the crypto_sha_256_c object valid. 
  1379 	 * The set_is_valid() function sets the state of the crypto_sha_256_c object valid. 
  1359 	 * The crypto_sha_256_c object calls this function after it is initialized.
  1380 	 * The crypto_sha_256_c object calls this function after it is initialized.
  1360 	 */
  1381 	 */
  1361 	EAP_FUNC_IMPORT void set_is_valid();
  1382 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1362 
  1383 
  1363 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1384 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1364 public:
  1385 public:
  1365 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1386 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1366 
  1387 
  1367 	/**
  1388 	/**
  1368 	 * Destructor resets the used internal buffers.
  1389 	 * Destructor resets the used internal buffers.
  1369 	 */
  1390 	 */
  1370 	EAP_FUNC_IMPORT virtual ~crypto_sha_256_c();
  1391 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_sha_256_c();
  1371 
  1392 
  1372 	/**
  1393 	/**
  1373 	 * Constructor initializes the used internal buffers.
  1394 	 * Constructor initializes the used internal buffers.
  1374 	 */
  1395 	 */
  1375 	EAP_FUNC_IMPORT crypto_sha_256_c(abs_eap_am_tools_c * const tools);
  1396 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_sha_256_c(abs_eap_am_tools_c * const tools);
  1376 
  1397 
  1377 	/**
  1398 	/**
  1378 	 * This function copies the context from parameter sha_256_context to this object.
  1399 	 * This function copies the context from parameter sha_256_context to this object.
  1379 	 */
  1400 	 */
  1380 	EAP_FUNC_IMPORT eap_status_e copy_context(const eap_variable_data_c * const sha_256_context);
  1401 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e copy_context(const eap_variable_data_c * const sha_256_context);
  1381 
  1402 
  1382 	/**
  1403 	/**
  1383 	 * The get_is_valid() function returns the status of the crypto_sha_256_c object. 
  1404 	 * The get_is_valid() function returns the status of the crypto_sha_256_c object. 
  1384 	 * True indicates the object is initialized.
  1405 	 * True indicates the object is initialized.
  1385 	 */
  1406 	 */
  1386 	EAP_FUNC_IMPORT bool get_is_valid();
  1407 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1387 
  1408 
  1388 	/**
  1409 	/**
  1389 	 * This function returns the size of message digest of SHA-256-algorithm.
  1410 	 * This function returns the size of message digest of SHA-256-algorithm.
  1390 	 */
  1411 	 */
  1391 	EAP_FUNC_IMPORT u32_t get_digest_length();
  1412 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_digest_length();
  1392 
  1413 
  1393 	/**
  1414 	/**
  1394 	 * This function returns the block size of SHA-256-algorithm.
  1415 	 * This function returns the block size of SHA-256-algorithm.
  1395 	 */
  1416 	 */
  1396 	EAP_FUNC_IMPORT u32_t get_block_size();
  1417 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1397 
  1418 
  1398 	/**
  1419 	/**
  1399 	 * This function initializes the context of SHA-256-algorithm.
  1420 	 * This function initializes the context of SHA-256-algorithm.
  1400 	 */
  1421 	 */
  1401 	EAP_FUNC_IMPORT eap_status_e hash_init();
  1422 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_init();
  1402 
  1423 
  1403 	/**
  1424 	/**
  1404 	 * This function updates the context of SHA-256-algorithm with data.
  1425 	 * This function updates the context of SHA-256-algorithm with data.
  1405 	 */
  1426 	 */
  1406 	EAP_FUNC_IMPORT eap_status_e hash_update(
  1427 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_update(
  1407 		const void * const data,
  1428 		const void * const data,
  1408 		const u32_t data_length);
  1429 		const u32_t data_length);
  1409 
  1430 
  1410 	/**
  1431 	/**
  1411 	 * This function writes the message digest to buffer.
  1432 	 * This function writes the message digest to buffer.
  1412 	 * @param Length is set if md_length_or_null is non-NULL.
  1433 	 * @param Length is set if md_length_or_null is non-NULL.
  1413 	 */
  1434 	 */
  1414 	EAP_FUNC_IMPORT eap_status_e hash_final(
  1435 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_final(
  1415 		void * const message_digest,
  1436 		void * const message_digest,
  1416 		u32_t *md_length_or_null);
  1437 		u32_t *md_length_or_null);
  1417 
  1438 
  1418 	/**
  1439 	/**
  1419 	 * This function cleans up the SHA-256 context.
  1440 	 * This function cleans up the SHA-256 context.
  1420 	 */
  1441 	 */
  1421 	EAP_FUNC_IMPORT eap_status_e hash_cleanup();
  1442 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_cleanup();
  1422 
  1443 
  1423 	/**
  1444 	/**
  1424 	 * This function returns a copy of the context of SHA-256-algorithm.
  1445 	 * This function returns a copy of the context of SHA-256-algorithm.
  1425 	 * Caller must free the copy.
  1446 	 * Caller must free the copy.
  1426 	 */
  1447 	 */
  1427 	EAP_FUNC_IMPORT abs_crypto_hash_algorithm_c * copy();
  1448 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hash_algorithm_c * copy();
  1428 };
  1449 };
  1429 
  1450 
  1430 
  1451 
  1431 //------------------------------------------------------------
  1452 //------------------------------------------------------------
  1432 
  1453 
  1433 /// The crypto_sha1_c class includes the state of 
  1454 /// The crypto_sha1_c class includes the state of 
  1434 /// one instance of SHA1 algorithm.
  1455 /// one instance of SHA1 algorithm.
  1435 class EAP_EXPORT crypto_sha1_c
  1456 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_sha1_c
  1436 : public abs_crypto_hash_algorithm_c
  1457 : public abs_crypto_hash_algorithm_c
  1437 {
  1458 {
  1438 
  1459 
  1439 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1460 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1440 private:
  1461 private:
  1454 
  1475 
  1455 	/**
  1476 	/**
  1456 	 * The set_is_invalid() function sets the state of the crypto_sha1_c object invalid. 
  1477 	 * The set_is_invalid() function sets the state of the crypto_sha1_c object invalid. 
  1457 	 * The crypto_sha1_c object calls this function after it is initialized.
  1478 	 * The crypto_sha1_c object calls this function after it is initialized.
  1458 	 */
  1479 	 */
  1459 	EAP_FUNC_IMPORT void set_is_invalid();
  1480 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1460 
  1481 
  1461 	/**
  1482 	/**
  1462 	 * The set_is_valid() function sets the state of the crypto_sha1_c object valid. 
  1483 	 * The set_is_valid() function sets the state of the crypto_sha1_c object valid. 
  1463 	 * The crypto_sha1_c object calls this function after it is initialized.
  1484 	 * The crypto_sha1_c object calls this function after it is initialized.
  1464 	 */
  1485 	 */
  1465 	EAP_FUNC_IMPORT void set_is_valid();
  1486 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1466 
  1487 
  1467 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1488 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1468 public:
  1489 public:
  1469 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1490 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1470 
  1491 
  1471 	/**
  1492 	/**
  1472 	 * Destructor resets the used internal buffers.
  1493 	 * Destructor resets the used internal buffers.
  1473 	 */
  1494 	 */
  1474 	EAP_FUNC_IMPORT virtual ~crypto_sha1_c();
  1495 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_sha1_c();
  1475 
  1496 
  1476 	/**
  1497 	/**
  1477 	 * Constructor initializes the used internal buffers.
  1498 	 * Constructor initializes the used internal buffers.
  1478 	 */
  1499 	 */
  1479 	EAP_FUNC_IMPORT crypto_sha1_c(abs_eap_am_tools_c * const tools);
  1500 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_sha1_c(abs_eap_am_tools_c * const tools);
  1480 
  1501 
  1481 	/**
  1502 	/**
  1482 	 * This function copies the context from parameter sha1_context to this object.
  1503 	 * This function copies the context from parameter sha1_context to this object.
  1483 	 */
  1504 	 */
  1484 	EAP_FUNC_IMPORT eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1505 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1485 
  1506 
  1486 	/**
  1507 	/**
  1487 	 * The get_is_valid() function returns the status of the crypto_sha1_c object. 
  1508 	 * The get_is_valid() function returns the status of the crypto_sha1_c object. 
  1488 	 * True indicates the object is initialized.
  1509 	 * True indicates the object is initialized.
  1489 	 */
  1510 	 */
  1490 	EAP_FUNC_IMPORT bool get_is_valid();
  1511 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1491 
  1512 
  1492 	/**
  1513 	/**
  1493 	 * This function returns the size of message digest of SHA1-algorithm.
  1514 	 * This function returns the size of message digest of SHA1-algorithm.
  1494 	 */
  1515 	 */
  1495 	EAP_FUNC_IMPORT u32_t get_digest_length();
  1516 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_digest_length();
  1496 
  1517 
  1497 	/**
  1518 	/**
  1498 	 * This function returns the block size of SHA1-algorithm.
  1519 	 * This function returns the block size of SHA1-algorithm.
  1499 	 */
  1520 	 */
  1500 	EAP_FUNC_IMPORT u32_t get_block_size();
  1521 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1501 
  1522 
  1502 	/**
  1523 	/**
  1503 	 * This function initializes the context of SHA1-algorithm.
  1524 	 * This function initializes the context of SHA1-algorithm.
  1504 	 */
  1525 	 */
  1505 	EAP_FUNC_IMPORT eap_status_e hash_init();
  1526 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_init();
  1506 
  1527 
  1507 	/**
  1528 	/**
  1508 	 * This function updates the context of SHA1-algorithm with data.
  1529 	 * This function updates the context of SHA1-algorithm with data.
  1509 	 */
  1530 	 */
  1510 	EAP_FUNC_IMPORT eap_status_e hash_update(
  1531 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_update(
  1511 		const void * const data,
  1532 		const void * const data,
  1512 		const u32_t data_length);
  1533 		const u32_t data_length);
  1513 
  1534 
  1514 	/**
  1535 	/**
  1515 	 * This function writes the message digest to buffer.
  1536 	 * This function writes the message digest to buffer.
  1516 	 * @param Length is set if md_length_or_null is non-NULL.
  1537 	 * @param Length is set if md_length_or_null is non-NULL.
  1517 	 */
  1538 	 */
  1518 	EAP_FUNC_IMPORT eap_status_e hash_final(
  1539 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_final(
  1519 		void * const message_digest,
  1540 		void * const message_digest,
  1520 		u32_t *md_length_or_null);
  1541 		u32_t *md_length_or_null);
  1521 
  1542 
  1522 	/**
  1543 	/**
  1523 	 * This function cleans up the SHA1 context.
  1544 	 * This function cleans up the SHA1 context.
  1524 	 */
  1545 	 */
  1525 	EAP_FUNC_IMPORT eap_status_e hash_cleanup();
  1546 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_cleanup();
  1526 
  1547 
  1527 	/**
  1548 	/**
  1528 	 * This function returns a copy of the context of SHA1-algorithm.
  1549 	 * This function returns a copy of the context of SHA1-algorithm.
  1529 	 * Caller must free the copy.
  1550 	 * Caller must free the copy.
  1530 	 */
  1551 	 */
  1531 	EAP_FUNC_IMPORT abs_crypto_hash_algorithm_c * copy();
  1552 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hash_algorithm_c * copy();
  1532 };
  1553 };
  1533 
  1554 
  1534 
  1555 
  1535 //------------------------------------------------------------
  1556 //------------------------------------------------------------
  1536 
  1557 
  1537 /// The crypto_ephemeral_diffie_hellman_c class includes
  1558 /// The crypto_ephemeral_diffie_hellman_c class includes
  1538 /// the state of one instance of ephemeral Diffie-Hellman key exchange algorithm.
  1559 /// the state of one instance of ephemeral Diffie-Hellman key exchange algorithm.
  1539 class EAP_EXPORT crypto_ephemeral_diffie_hellman_c
  1560 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_ephemeral_diffie_hellman_c
  1540 {
  1561 {
  1541 
  1562 
  1542 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1563 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1543 private:
  1564 private:
  1544 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1565 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1554 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1575 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1555 
  1576 
  1556 	/**
  1577 	/**
  1557 	 * Destructor resets the used internal buffers.
  1578 	 * Destructor resets the used internal buffers.
  1558 	 */
  1579 	 */
  1559 	EAP_FUNC_IMPORT virtual ~crypto_ephemeral_diffie_hellman_c();
  1580 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_ephemeral_diffie_hellman_c();
  1560 
  1581 
  1561 	/**
  1582 	/**
  1562 	 * Constructor initializes the used internal buffers.
  1583 	 * Constructor initializes the used internal buffers.
  1563 	 */
  1584 	 */
  1564 	EAP_FUNC_IMPORT crypto_ephemeral_diffie_hellman_c(abs_eap_am_tools_c * const tools);
  1585 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_ephemeral_diffie_hellman_c(abs_eap_am_tools_c * const tools);
  1565 
  1586 
  1566 	/**
  1587 	/**
  1567 	 * The set_is_valid() function sets the state of the crypto_ephemeral_diffie_hellman_c
  1588 	 * The set_is_valid() function sets the state of the crypto_ephemeral_diffie_hellman_c
  1568 	 * object valid. The crypto_ephemeral_diffie_hellman_c object calls this function
  1589 	 * object valid. The crypto_ephemeral_diffie_hellman_c object calls this function
  1569 	 * after it is initialized.
  1590 	 * after it is initialized.
  1570 	 */
  1591 	 */
  1571 	EAP_FUNC_IMPORT void set_is_valid();
  1592 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1572 
  1593 
  1573 	/**
  1594 	/**
  1574 	 * The get_is_valid() function returns the status of the crypto_ephemeral_diffie_hellman_c object.
  1595 	 * The get_is_valid() function returns the status of the crypto_ephemeral_diffie_hellman_c object.
  1575 	 * True indicates the object is initialized.
  1596 	 * True indicates the object is initialized.
  1576 	 */
  1597 	 */
  1577 	EAP_FUNC_IMPORT bool get_is_valid();
  1598 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1578 
  1599 
  1579 	/**
  1600 	/**
  1580 	 * This function creates the private and public keys using the prime and generator.
  1601 	 * This function creates the private and public keys using the prime and generator.
  1581 	 * Returns context in dh_context. It must be given to generate_g_power_to_xy and
  1602 	 * Returns context in dh_context. It must be given to generate_g_power_to_xy and
  1582 	 * dh_cleanup.
  1603 	 * dh_cleanup.
  1583 	 */
  1604 	 */
  1584 	EAP_FUNC_IMPORT eap_status_e generate_diffie_hellman_keys(
  1605 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e generate_diffie_hellman_keys(
  1585 		eap_variable_data_c * const dh_context,
  1606 		eap_variable_data_c * const dh_context,
  1586 		eap_variable_data_c * const own_public_dh_key,
  1607 		eap_variable_data_c * const own_public_dh_key,
  1587 		const void * const prime,
  1608 		const void * const prime,
  1588 		const u32_t prime_length,
  1609 		const u32_t prime_length,
  1589 		const void * const group_generator,
  1610 		const void * const group_generator,
  1591 
  1612 
  1592 	/**
  1613 	/**
  1593 	 * This function creates the shared Diffie-Hellman key using own private key,
  1614 	 * This function creates the shared Diffie-Hellman key using own private key,
  1594 	 * peer public key, prime and group generator.
  1615 	 * peer public key, prime and group generator.
  1595 	 */
  1616 	 */
  1596 	EAP_FUNC_IMPORT eap_status_e generate_g_power_to_xy(
  1617 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e generate_g_power_to_xy(
  1597 		const eap_variable_data_c * const dh_context,
  1618 		const eap_variable_data_c * const dh_context,
  1598 		const eap_variable_data_c * const peer_public_dh_key,
  1619 		const eap_variable_data_c * const peer_public_dh_key,
  1599 		eap_variable_data_c * const shared_dh_key,
  1620 		eap_variable_data_c * const shared_dh_key,
  1600 		const void * const prime,
  1621 		const void * const prime,
  1601 		const u32_t prime_length,
  1622 		const u32_t prime_length,
  1602 		const void * const group_generator,
  1623 		const void * const group_generator,
  1603 		const u32_t group_generator_length);
  1624 		const u32_t group_generator_length);
  1604 
  1625 
  1605 	EAP_FUNC_IMPORT eap_status_e dh_cleanup(
  1626 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e dh_cleanup(
  1606 		const eap_variable_data_c * const dh_context);
  1627 		const eap_variable_data_c * const dh_context);
  1607 
  1628 
  1608 };
  1629 };
  1609 
  1630 
  1610 //------------------------------------------------------------
  1631 //------------------------------------------------------------
  1611 
  1632 
  1612 /// The crypto_sha1_c class includes the state of 
  1633 /// The crypto_sha1_c class includes the state of 
  1613 /// one instance of MD5 algorithm.
  1634 /// one instance of MD5 algorithm.
  1614 class EAP_EXPORT crypto_md5_c
  1635 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_md5_c
  1615 : public abs_crypto_hash_algorithm_c
  1636 : public abs_crypto_hash_algorithm_c
  1616 {
  1637 {
  1617 
  1638 
  1618 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1639 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1619 private:
  1640 private:
  1633 
  1654 
  1634 	/**
  1655 	/**
  1635 	 * The set_is_invalid() function sets the state of the crypto_md5_c object invalid. 
  1656 	 * The set_is_invalid() function sets the state of the crypto_md5_c object invalid. 
  1636 	 * The crypto_md5_c object calls this function after it is initialized.
  1657 	 * The crypto_md5_c object calls this function after it is initialized.
  1637 	 */
  1658 	 */
  1638 	EAP_FUNC_IMPORT void set_is_invalid();
  1659 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1639 
  1660 
  1640 	/**
  1661 	/**
  1641 	 * The set_is_valid() function sets the state of the crypto_md5_c object valid. 
  1662 	 * The set_is_valid() function sets the state of the crypto_md5_c object valid. 
  1642 	 * The crypto_md5_c object calls this function after it is initialized.
  1663 	 * The crypto_md5_c object calls this function after it is initialized.
  1643 	 */
  1664 	 */
  1644 	EAP_FUNC_IMPORT void set_is_valid();
  1665 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1645 
  1666 
  1646 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1667 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1647 public:
  1668 public:
  1648 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1669 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1649 
  1670 
  1650 	/**
  1671 	/**
  1651 	 * Destructor resets the used internal buffers.
  1672 	 * Destructor resets the used internal buffers.
  1652 	 */
  1673 	 */
  1653 	EAP_FUNC_IMPORT virtual ~crypto_md5_c();
  1674 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_md5_c();
  1654 
  1675 
  1655 	/**
  1676 	/**
  1656 	 * Constructor initializes the used internal buffers.
  1677 	 * Constructor initializes the used internal buffers.
  1657 	 */
  1678 	 */
  1658 	EAP_FUNC_IMPORT crypto_md5_c(abs_eap_am_tools_c * const tools);
  1679 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_md5_c(abs_eap_am_tools_c * const tools);
  1659 
  1680 
  1660 	/**
  1681 	/**
  1661 	 * This function copies the context from parameter sha1_context to this object.
  1682 	 * This function copies the context from parameter sha1_context to this object.
  1662 	 */
  1683 	 */
  1663 	EAP_FUNC_IMPORT eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1684 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1664 
  1685 
  1665 	/**
  1686 	/**
  1666 	 * The get_is_valid() function returns the status of the crypto_md5_c object. 
  1687 	 * The get_is_valid() function returns the status of the crypto_md5_c object. 
  1667 	 * True indicates the object is initialized.
  1688 	 * True indicates the object is initialized.
  1668 	 */
  1689 	 */
  1669 	EAP_FUNC_IMPORT bool get_is_valid();
  1690 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1670 
  1691 
  1671 	/**
  1692 	/**
  1672 	 * This function returns the size of message digest of MD5-algorithm.
  1693 	 * This function returns the size of message digest of MD5-algorithm.
  1673 	 */
  1694 	 */
  1674 	EAP_FUNC_IMPORT u32_t get_digest_length();
  1695 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_digest_length();
  1675 
  1696 
  1676 	/**
  1697 	/**
  1677 	 * This function returns the block size of MD5-algorithm.
  1698 	 * This function returns the block size of MD5-algorithm.
  1678 	 */
  1699 	 */
  1679 	EAP_FUNC_IMPORT u32_t get_block_size();
  1700 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1680 
  1701 
  1681 	/**
  1702 	/**
  1682 	 * This function initializes the context of MD5-algorithm.
  1703 	 * This function initializes the context of MD5-algorithm.
  1683 	 */
  1704 	 */
  1684 	EAP_FUNC_IMPORT eap_status_e hash_init();
  1705 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_init();
  1685 
  1706 
  1686 	/**
  1707 	/**
  1687 	 * This function updates the context of MD5-algorithm with data.
  1708 	 * This function updates the context of MD5-algorithm with data.
  1688 	 */
  1709 	 */
  1689 	EAP_FUNC_IMPORT eap_status_e hash_update(
  1710 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_update(
  1690 		const void * const data,
  1711 		const void * const data,
  1691 		const u32_t data_length);
  1712 		const u32_t data_length);
  1692 
  1713 
  1693 	/**
  1714 	/**
  1694 	 * This function writes the message digest to buffer.
  1715 	 * This function writes the message digest to buffer.
  1695 	 * @param Length is set if md_length_or_null is non-NULL.
  1716 	 * @param Length is set if md_length_or_null is non-NULL.
  1696 	 */
  1717 	 */
  1697 	EAP_FUNC_IMPORT eap_status_e hash_final(
  1718 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_final(
  1698 		void * const message_digest,
  1719 		void * const message_digest,
  1699 		u32_t *md_length_or_null);
  1720 		u32_t *md_length_or_null);
  1700 
  1721 
  1701 	/**
  1722 	/**
  1702 	 * This function cleans up the MD5 context.
  1723 	 * This function cleans up the MD5 context.
  1703 	 */
  1724 	 */
  1704 	EAP_FUNC_IMPORT eap_status_e hash_cleanup();
  1725 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_cleanup();
  1705 
  1726 
  1706 	/**
  1727 	/**
  1707 	 * This function returns a copy of the context of MD5-algorithm.
  1728 	 * This function returns a copy of the context of MD5-algorithm.
  1708 	 * Caller must free the copy.
  1729 	 * Caller must free the copy.
  1709 	 */
  1730 	 */
  1710 	EAP_FUNC_IMPORT abs_crypto_hash_algorithm_c * copy();
  1731 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hash_algorithm_c * copy();
  1711 };
  1732 };
  1712 
  1733 
  1713 
  1734 
  1714 //------------------------------------------------------------
  1735 //------------------------------------------------------------
  1715 
  1736 
  1716 /// The crypto_sha1_c class includes the state of 
  1737 /// The crypto_sha1_c class includes the state of 
  1717 /// one instance of MD4 algorithm.
  1738 /// one instance of MD4 algorithm.
  1718 class EAP_EXPORT crypto_md4_c
  1739 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_md4_c
  1719 : public abs_crypto_hash_algorithm_c
  1740 : public abs_crypto_hash_algorithm_c
  1720 {
  1741 {
  1721 
  1742 
  1722 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1743 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1723 private:
  1744 private:
  1737 
  1758 
  1738 	/**
  1759 	/**
  1739 	 * The set_is_invalid() function sets the state of the crypto_md4_c object invalid. 
  1760 	 * The set_is_invalid() function sets the state of the crypto_md4_c object invalid. 
  1740 	 * The crypto_md4_c object calls this function after it is initialized.
  1761 	 * The crypto_md4_c object calls this function after it is initialized.
  1741 	 */
  1762 	 */
  1742 	EAP_FUNC_IMPORT void set_is_invalid();
  1763 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1743 
  1764 
  1744 	/**
  1765 	/**
  1745 	 * The set_is_valid() function sets the state of the crypto_md4_c object valid. 
  1766 	 * The set_is_valid() function sets the state of the crypto_md4_c object valid. 
  1746 	 * The crypto_md4_c object calls this function after it is initialized.
  1767 	 * The crypto_md4_c object calls this function after it is initialized.
  1747 	 */
  1768 	 */
  1748 	EAP_FUNC_IMPORT void set_is_valid();
  1769 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1749 
  1770 
  1750 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1771 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1751 public:
  1772 public:
  1752 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1773 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1753 
  1774 
  1754 	/**
  1775 	/**
  1755 	 * Destructor resets the used internal buffers.
  1776 	 * Destructor resets the used internal buffers.
  1756 	 */
  1777 	 */
  1757 	EAP_FUNC_IMPORT virtual ~crypto_md4_c();
  1778 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_md4_c();
  1758 
  1779 
  1759 	/**
  1780 	/**
  1760 	 * Constructor initializes the used internal buffers.
  1781 	 * Constructor initializes the used internal buffers.
  1761 	 */
  1782 	 */
  1762 	EAP_FUNC_IMPORT crypto_md4_c(abs_eap_am_tools_c * const tools);
  1783 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_md4_c(abs_eap_am_tools_c * const tools);
  1763 
  1784 
  1764 	/**
  1785 	/**
  1765 	 * This function copies the context from parameter sha1_context to this object.
  1786 	 * This function copies the context from parameter sha1_context to this object.
  1766 	 */
  1787 	 */
  1767 	EAP_FUNC_IMPORT eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1788 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e copy_context(const eap_variable_data_c * const sha1_context);
  1768 
  1789 
  1769 	/**
  1790 	/**
  1770 	 * The get_is_valid() function returns the status of the crypto_md4_c object. 
  1791 	 * The get_is_valid() function returns the status of the crypto_md4_c object. 
  1771 	 * True indicates the object is initialized.
  1792 	 * True indicates the object is initialized.
  1772 	 */
  1793 	 */
  1773 	EAP_FUNC_IMPORT bool get_is_valid();
  1794 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1774 
  1795 
  1775 	/**
  1796 	/**
  1776 	 * This function returns the size of message digest of MD4-algorithm.
  1797 	 * This function returns the size of message digest of MD4-algorithm.
  1777 	 */
  1798 	 */
  1778 	EAP_FUNC_IMPORT u32_t get_digest_length();
  1799 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_digest_length();
  1779 
  1800 
  1780 	/**
  1801 	/**
  1781 	 * This function returns the block size of MD4-algorithm.
  1802 	 * This function returns the block size of MD4-algorithm.
  1782 	 */
  1803 	 */
  1783 	EAP_FUNC_IMPORT u32_t get_block_size();
  1804 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H u32_t get_block_size();
  1784 
  1805 
  1785 	/**
  1806 	/**
  1786 	 * This function initializes the context of MD4-algorithm.
  1807 	 * This function initializes the context of MD4-algorithm.
  1787 	 */
  1808 	 */
  1788 	EAP_FUNC_IMPORT eap_status_e hash_init();
  1809 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_init();
  1789 
  1810 
  1790 	/**
  1811 	/**
  1791 	 * This function updates the context of MD4-algorithm with data.
  1812 	 * This function updates the context of MD4-algorithm with data.
  1792 	 */
  1813 	 */
  1793 	EAP_FUNC_IMPORT eap_status_e hash_update(
  1814 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_update(
  1794 		const void * const data,
  1815 		const void * const data,
  1795 		const u32_t data_length);
  1816 		const u32_t data_length);
  1796 
  1817 
  1797 	/**
  1818 	/**
  1798 	 * This function writes the message digest to buffer.
  1819 	 * This function writes the message digest to buffer.
  1799 	 * @param Length is set if md_length_or_null is non-NULL.
  1820 	 * @param Length is set if md_length_or_null is non-NULL.
  1800 	 */
  1821 	 */
  1801 	EAP_FUNC_IMPORT eap_status_e hash_final(
  1822 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_final(
  1802 		void * const message_digest,
  1823 		void * const message_digest,
  1803 		u32_t *md_length_or_null);
  1824 		u32_t *md_length_or_null);
  1804 
  1825 
  1805 	/**
  1826 	/**
  1806 	 * This function cleans up the MD4 context.
  1827 	 * This function cleans up the MD4 context.
  1807 	 */
  1828 	 */
  1808 	EAP_FUNC_IMPORT eap_status_e hash_cleanup();
  1829 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_cleanup();
  1809 
  1830 
  1810 	/**
  1831 	/**
  1811 	 * This function returns a copy of the context of MD4-algorithm.
  1832 	 * This function returns a copy of the context of MD4-algorithm.
  1812 	 * Caller must free the copy.
  1833 	 * Caller must free the copy.
  1813 	 */
  1834 	 */
  1814 	EAP_FUNC_IMPORT abs_crypto_hash_algorithm_c * copy();
  1835 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H abs_crypto_hash_algorithm_c * copy();
  1815 };
  1836 };
  1816 
  1837 
  1817 
  1838 
  1818 //------------------------------------------------------------
  1839 //------------------------------------------------------------
  1819 /// The crypto_rc4_c class includes the state of 
  1840 /// The crypto_rc4_c class includes the state of 
  1820 /// one instance of RC4 algorithm.
  1841 /// one instance of RC4 algorithm.
  1821 class EAP_EXPORT crypto_rc4_c
  1842 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_rc4_c
  1822 : public abs_crypto_stream_algorithm_c
  1843 : public abs_crypto_stream_algorithm_c
  1823 {
  1844 {
  1824 
  1845 
  1825 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1846 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1826 private:
  1847 private:
  1840 
  1861 
  1841 	/**
  1862 	/**
  1842 	 * The set_is_invalid() function sets the state of the crypto_rc4_c object invalid. 
  1863 	 * The set_is_invalid() function sets the state of the crypto_rc4_c object invalid. 
  1843 	 * The crypto_rc4_c object calls this function after it is initialized.
  1864 	 * The crypto_rc4_c object calls this function after it is initialized.
  1844 	 */
  1865 	 */
  1845 	EAP_FUNC_IMPORT void set_is_invalid();
  1866 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1846 
  1867 
  1847 	/**
  1868 	/**
  1848 	 * The set_is_valid() function sets the state of the crypto_rc4_c object valid. 
  1869 	 * The set_is_valid() function sets the state of the crypto_rc4_c object valid. 
  1849 	 * The crypto_rc4_c object calls this function after it is initialized.
  1870 	 * The crypto_rc4_c object calls this function after it is initialized.
  1850 	 */
  1871 	 */
  1851 	EAP_FUNC_IMPORT void set_is_valid();
  1872 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1852 
  1873 
  1853 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1874 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1854 public:
  1875 public:
  1855 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1876 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1856 
  1877 
  1857 	/**
  1878 	/**
  1858 	 * Destructor resets the used internal buffers.
  1879 	 * Destructor resets the used internal buffers.
  1859 	 */
  1880 	 */
  1860 	EAP_FUNC_IMPORT virtual ~crypto_rc4_c();
  1881 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_rc4_c();
  1861 
  1882 
  1862 	/**
  1883 	/**
  1863 	 * Constructor initializes the used internal buffers.
  1884 	 * Constructor initializes the used internal buffers.
  1864 	 */
  1885 	 */
  1865 	EAP_FUNC_IMPORT crypto_rc4_c(abs_eap_am_tools_c * const tools);
  1886 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_rc4_c(abs_eap_am_tools_c * const tools);
  1866 
  1887 
  1867 	/**
  1888 	/**
  1868 	 * The get_is_valid() function returns the status of the crypto_rc4_c object. 
  1889 	 * The get_is_valid() function returns the status of the crypto_rc4_c object. 
  1869 	 * True indicates the object is initialized.
  1890 	 * True indicates the object is initialized.
  1870 	 */
  1891 	 */
  1871 	EAP_FUNC_IMPORT bool get_is_valid();
  1892 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1872 
  1893 
  1873 	/**
  1894 	/**
  1874 	 * This function sets the RC4 key.
  1895 	 * This function sets the RC4 key.
  1875 	 */
  1896 	 */
  1876 	EAP_FUNC_IMPORT eap_status_e set_key(const eap_variable_data_c * const key);
  1897 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e set_key(const eap_variable_data_c * const key);
  1877 
  1898 
  1878 	/**
  1899 	/**
  1879 	 * This function discards desired count of RC4 stream.
  1900 	 * This function discards desired count of RC4 stream.
  1880 	 */
  1901 	 */
  1881 	EAP_FUNC_IMPORT eap_status_e discard_stream(const u32_t count_of_discarded_octets);
  1902 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e discard_stream(const u32_t count_of_discarded_octets);
  1882 
  1903 
  1883 	/**
  1904 	/**
  1884 	 * This function encrypts continuous data bytes in data_in_out buffer. 
  1905 	 * This function encrypts continuous data bytes in data_in_out buffer. 
  1885 	 */
  1906 	 */
  1886 	EAP_FUNC_IMPORT eap_status_e encrypt_data(
  1907 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_data(
  1887 		void * const data_in_out,
  1908 		void * const data_in_out,
  1888 		const u32_t data_length);
  1909 		const u32_t data_length);
  1889 
  1910 
  1890 	/**
  1911 	/**
  1891 	 * This function does RC4 encryption.
  1912 	 * This function does RC4 encryption.
  1892 	 */
  1913 	 */
  1893 	EAP_FUNC_IMPORT eap_status_e encrypt_data(
  1914 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_data(
  1894 		const void * const data_in, 
  1915 		const void * const data_in, 
  1895 		void * const data_out,
  1916 		void * const data_out,
  1896 		const u32_t data_length);
  1917 		const u32_t data_length);
  1897 
  1918 
  1898 	/**
  1919 	/**
  1899 	 * This function decrypts continuous data bytes in data_in_out buffer. 
  1920 	 * This function decrypts continuous data bytes in data_in_out buffer. 
  1900 	 */
  1921 	 */
  1901 	EAP_FUNC_IMPORT eap_status_e decrypt_data(
  1922 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_data(
  1902 		void * const data_in_out,
  1923 		void * const data_in_out,
  1903 		const u32_t data_length);
  1924 		const u32_t data_length);
  1904 
  1925 
  1905 	/**
  1926 	/**
  1906 	 * This function does RC4 decryption.
  1927 	 * This function does RC4 decryption.
  1907 	 */
  1928 	 */
  1908 	EAP_FUNC_IMPORT eap_status_e decrypt_data(
  1929 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_data(
  1909 		const void * const data_in, 
  1930 		const void * const data_in, 
  1910 		void * const data_out,
  1931 		void * const data_out,
  1911 		const u32_t data_length);
  1932 		const u32_t data_length);
  1912 
  1933 
  1913 };
  1934 };
  1914 
  1935 
  1915 //------------------------------------------------------------
  1936 //------------------------------------------------------------
  1916 
  1937 
  1917 /// The crypto_tls_base_prf_c class includes the state of 
  1938 /// The crypto_tls_base_prf_c class includes the state of 
  1918 /// one instance of TLS-PRF base algorithms.
  1939 /// one instance of TLS-PRF base algorithms.
  1919 class EAP_EXPORT crypto_tls_base_prf_c
  1940 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_base_prf_c
  1920 {
  1941 {
  1921 
  1942 
  1922 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1943 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1923 private:
  1944 private:
  1924 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1945 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1931 
  1952 
  1932 	/**
  1953 	/**
  1933 	 * The set_is_invalid() function sets the state of the crypto_tls_base_prf_c object invalid. 
  1954 	 * The set_is_invalid() function sets the state of the crypto_tls_base_prf_c object invalid. 
  1934 	 * The crypto_tls_base_prf_c object calls this function after it is initialized.
  1955 	 * The crypto_tls_base_prf_c object calls this function after it is initialized.
  1935 	 */
  1956 	 */
  1936 	EAP_FUNC_IMPORT void set_is_invalid();
  1957 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  1937 
  1958 
  1938 	/**
  1959 	/**
  1939 	 * The set_is_valid() function sets the state of the crypto_tls_base_prf_c object valid. 
  1960 	 * The set_is_valid() function sets the state of the crypto_tls_base_prf_c object valid. 
  1940 	 * The crypto_tls_base_prf_c object calls this function after it is initialized.
  1961 	 * The crypto_tls_base_prf_c object calls this function after it is initialized.
  1941 	 */
  1962 	 */
  1942 	EAP_FUNC_IMPORT void set_is_valid();
  1963 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  1943 
  1964 
  1944 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1965 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1945 public:
  1966 public:
  1946 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1967 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1947 
  1968 
  1948 	/**
  1969 	/**
  1949 	 * Destructor resets the used internal buffers.
  1970 	 * Destructor resets the used internal buffers.
  1950 	 */
  1971 	 */
  1951 	EAP_FUNC_IMPORT virtual ~crypto_tls_base_prf_c();
  1972 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_tls_base_prf_c();
  1952 
  1973 
  1953 	/**
  1974 	/**
  1954 	 * Constructor initializes the used internal buffers.
  1975 	 * Constructor initializes the used internal buffers.
  1955 	 */
  1976 	 */
  1956 	EAP_FUNC_IMPORT crypto_tls_base_prf_c(abs_eap_am_tools_c * const tools);
  1977 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_base_prf_c(abs_eap_am_tools_c * const tools);
  1957 
  1978 
  1958 	/**
  1979 	/**
  1959 	 * The get_is_valid() function returns the status of the crypto_tls_base_prf_c object. 
  1980 	 * The get_is_valid() function returns the status of the crypto_tls_base_prf_c object. 
  1960 	 * True indicates the object is initialized.
  1981 	 * True indicates the object is initialized.
  1961 	 */
  1982 	 */
  1962 	EAP_FUNC_IMPORT bool get_is_valid();
  1983 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  1963 
  1984 
  1964 	EAP_FUNC_IMPORT eap_status_e tls_prf_A_value(
  1985 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_A_value(
  1965 		abs_crypto_hmac_algorithm_c * const hash,
  1986 		abs_crypto_hmac_algorithm_c * const hash,
  1966 		eap_variable_data_c * const key,
  1987 		eap_variable_data_c * const key,
  1967 		eap_variable_data_c * const seed,
  1988 		eap_variable_data_c * const seed,
  1968 		eap_variable_data_c * const A_md5_output);
  1989 		eap_variable_data_c * const A_md5_output);
  1969 
  1990 
  1970 	EAP_FUNC_IMPORT eap_status_e tls_prf_one_round(
  1991 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_one_round(
  1971 		abs_crypto_hmac_algorithm_c * const hash,
  1992 		abs_crypto_hmac_algorithm_c * const hash,
  1972 		const eap_variable_data_c * const key,
  1993 		const eap_variable_data_c * const key,
  1973 		eap_variable_data_c * const A_input,
  1994 		eap_variable_data_c * const A_input,
  1974 		eap_variable_data_c * const seed,
  1995 		eap_variable_data_c * const seed,
  1975 		void * const out_buffer,
  1996 		void * const out_buffer,
  1976 		const u32_t out_buffer_length);
  1997 		const u32_t out_buffer_length);
  1977 
  1998 
  1978 	/**
  1999 	/**
  1979 	 * This function cleans up the TLS-PRF context.
  2000 	 * This function cleans up the TLS-PRF context.
  1980 	 */
  2001 	 */
  1981 	EAP_FUNC_IMPORT eap_status_e tls_prf_cleanup();
  2002 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_cleanup();
  1982 
  2003 
  1983 };
  2004 };
  1984 
  2005 
  1985 //------------------------------------------------------------
  2006 //------------------------------------------------------------
  1986 
  2007 
  1987 /// The crypto_tls_sha1_prf_c class includes the state of 
  2008 /// The crypto_tls_sha1_prf_c class includes the state of 
  1988 /// one instance of TLS-PRF SHA1 algorithm.
  2009 /// one instance of TLS-PRF SHA1 algorithm.
  1989 /// This is needed because compound authentication
  2010 /// This is needed because compound authentication
  1990 /// binding of PEAP does use only P_SHA-1 for generating
  2011 /// binding of PEAP does use only P_SHA-1 for generating
  1991 /// compound keyed MACs and the compound session keys.
  2012 /// compound keyed MACs and the compound session keys.
  1992 class EAP_EXPORT crypto_tls_sha1_prf_c
  2013 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_sha1_prf_c
  1993 : public crypto_tls_base_prf_c
  2014 : public crypto_tls_base_prf_c
  1994 {
  2015 {
  1995 
  2016 
  1996 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2017 	// - - - - - - - - - - - - - - - - - - - - - - - -
  1997 private:
  2018 private:
  2012 
  2033 
  2013 	/**
  2034 	/**
  2014 	 * The set_is_invalid() function sets the state of the crypto_tls_sha1_prf_c object invalid. 
  2035 	 * The set_is_invalid() function sets the state of the crypto_tls_sha1_prf_c object invalid. 
  2015 	 * The crypto_tls_sha1_prf_c object calls this function after it is initialized.
  2036 	 * The crypto_tls_sha1_prf_c object calls this function after it is initialized.
  2016 	 */
  2037 	 */
  2017 	EAP_FUNC_IMPORT void set_is_invalid();
  2038 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2018 
  2039 
  2019 	/**
  2040 	/**
  2020 	 * The set_is_valid() function sets the state of the crypto_tls_sha1_prf_c object valid. 
  2041 	 * The set_is_valid() function sets the state of the crypto_tls_sha1_prf_c object valid. 
  2021 	 * The crypto_tls_sha1_prf_c object calls this function after it is initialized.
  2042 	 * The crypto_tls_sha1_prf_c object calls this function after it is initialized.
  2022 	 */
  2043 	 */
  2023 	EAP_FUNC_IMPORT void set_is_valid();
  2044 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2024 
  2045 
  2025 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2046 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2026 public:
  2047 public:
  2027 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2048 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2028 
  2049 
  2029 	/**
  2050 	/**
  2030 	 * Destructor resets the used internal buffers.
  2051 	 * Destructor resets the used internal buffers.
  2031 	 */
  2052 	 */
  2032 	EAP_FUNC_IMPORT virtual ~crypto_tls_sha1_prf_c();
  2053 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_tls_sha1_prf_c();
  2033 
  2054 
  2034 	/**
  2055 	/**
  2035 	 * Constructor initializes the used internal buffers.
  2056 	 * Constructor initializes the used internal buffers.
  2036 	 */
  2057 	 */
  2037 	EAP_FUNC_IMPORT crypto_tls_sha1_prf_c(abs_eap_am_tools_c * const tools);
  2058 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_sha1_prf_c(abs_eap_am_tools_c * const tools);
  2038 
  2059 
  2039 	/**
  2060 	/**
  2040 	 * The get_is_valid() function returns the status of the crypto_tls_sha1_prf_c object. 
  2061 	 * The get_is_valid() function returns the status of the crypto_tls_sha1_prf_c object. 
  2041 	 * True indicates the object is initialized.
  2062 	 * True indicates the object is initialized.
  2042 	 */
  2063 	 */
  2043 	EAP_FUNC_IMPORT bool get_is_valid();
  2064 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2044 
  2065 
  2045 	/**
  2066 	/**
  2046 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2067 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2047 	 */
  2068 	 */
  2048 	EAP_FUNC_IMPORT eap_status_e tls_prf_init(
  2069 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_init(
  2049 		const eap_variable_data_c * const secret,
  2070 		const eap_variable_data_c * const secret,
  2050 		const eap_variable_data_c * const label,
  2071 		const eap_variable_data_c * const label,
  2051 		const eap_variable_data_c * const seed);
  2072 		const eap_variable_data_c * const seed);
  2052 
  2073 
  2053 	/**
  2074 	/**
  2054 	 * This function writes the message digest to buffer. 
  2075 	 * This function writes the message digest to buffer. 
  2055 	 * Length is set if md_length_or_null is non-NULL.
  2076 	 * Length is set if md_length_or_null is non-NULL.
  2056 	 */
  2077 	 */
  2057 	EAP_FUNC_IMPORT eap_status_e tls_prf_output(
  2078 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_output(
  2058 		void * const pseudo_random_data,
  2079 		void * const pseudo_random_data,
  2059 		const u32_t pseudo_random_data_length);
  2080 		const u32_t pseudo_random_data_length);
  2060 
  2081 
  2061 	/**
  2082 	/**
  2062 	 * This function cleans up the TLS-PRF context.
  2083 	 * This function cleans up the TLS-PRF context.
  2063 	 */
  2084 	 */
  2064 	EAP_FUNC_IMPORT eap_status_e tls_prf_cleanup();
  2085 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_cleanup();
  2065 
  2086 
  2066 };
  2087 };
  2067 
  2088 
  2068 //------------------------------------------------------------
  2089 //------------------------------------------------------------
  2069 
  2090 
  2070 /// The crypto_tls_md5_prf_c class includes the state of 
  2091 /// The crypto_tls_md5_prf_c class includes the state of 
  2071 /// one instance of TLS-PRF MD5 algorithm.
  2092 /// one instance of TLS-PRF MD5 algorithm.
  2072 class EAP_EXPORT crypto_tls_md5_prf_c
  2093 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_md5_prf_c
  2073 : public crypto_tls_base_prf_c
  2094 : public crypto_tls_base_prf_c
  2074 {
  2095 {
  2075 
  2096 
  2076 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2097 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2077 private:
  2098 private:
  2092 
  2113 
  2093 	/**
  2114 	/**
  2094 	 * The set_is_invalid() function sets the state of the crypto_tls_md5_prf_c object invalid. 
  2115 	 * The set_is_invalid() function sets the state of the crypto_tls_md5_prf_c object invalid. 
  2095 	 * The crypto_tls_md5_prf_c object calls this function after it is initialized.
  2116 	 * The crypto_tls_md5_prf_c object calls this function after it is initialized.
  2096 	 */
  2117 	 */
  2097 	EAP_FUNC_IMPORT void set_is_invalid();
  2118 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2098 
  2119 
  2099 	/**
  2120 	/**
  2100 	 * The set_is_valid() function sets the state of the crypto_tls_md5_prf_c object valid. 
  2121 	 * The set_is_valid() function sets the state of the crypto_tls_md5_prf_c object valid. 
  2101 	 * The crypto_tls_md5_prf_c object calls this function after it is initialized.
  2122 	 * The crypto_tls_md5_prf_c object calls this function after it is initialized.
  2102 	 */
  2123 	 */
  2103 	EAP_FUNC_IMPORT void set_is_valid();
  2124 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2104 
  2125 
  2105 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2126 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2106 public:
  2127 public:
  2107 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2128 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2108 
  2129 
  2109 	/**
  2130 	/**
  2110 	 * Destructor resets the used internal buffers.
  2131 	 * Destructor resets the used internal buffers.
  2111 	 */
  2132 	 */
  2112 	EAP_FUNC_IMPORT virtual ~crypto_tls_md5_prf_c();
  2133 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_tls_md5_prf_c();
  2113 
  2134 
  2114 	/**
  2135 	/**
  2115 	 * Constructor initializes the used internal buffers.
  2136 	 * Constructor initializes the used internal buffers.
  2116 	 */
  2137 	 */
  2117 	EAP_FUNC_IMPORT crypto_tls_md5_prf_c(abs_eap_am_tools_c * const tools);
  2138 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_md5_prf_c(abs_eap_am_tools_c * const tools);
  2118 
  2139 
  2119 	/**
  2140 	/**
  2120 	 * The get_is_valid() function returns the status of the crypto_tls_md5_prf_c object. 
  2141 	 * The get_is_valid() function returns the status of the crypto_tls_md5_prf_c object. 
  2121 	 * True indicates the object is initialized.
  2142 	 * True indicates the object is initialized.
  2122 	 */
  2143 	 */
  2123 	EAP_FUNC_IMPORT bool get_is_valid();
  2144 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2124 
  2145 
  2125 	/**
  2146 	/**
  2126 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2147 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2127 	 */
  2148 	 */
  2128 	EAP_FUNC_IMPORT eap_status_e tls_prf_init(
  2149 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_init(
  2129 		const eap_variable_data_c * const secret,
  2150 		const eap_variable_data_c * const secret,
  2130 		const eap_variable_data_c * const label,
  2151 		const eap_variable_data_c * const label,
  2131 		const eap_variable_data_c * const seed);
  2152 		const eap_variable_data_c * const seed);
  2132 
  2153 
  2133 	/**
  2154 	/**
  2134 	 * This function writes the message digest to buffer. 
  2155 	 * This function writes the message digest to buffer. 
  2135 	 * Length is set if md_length_or_null is non-NULL.
  2156 	 * Length is set if md_length_or_null is non-NULL.
  2136 	 */
  2157 	 */
  2137 	EAP_FUNC_IMPORT eap_status_e tls_prf_output(
  2158 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_output(
  2138 		void * const pseudo_random_data,
  2159 		void * const pseudo_random_data,
  2139 		const u32_t pseudo_random_data_length);
  2160 		const u32_t pseudo_random_data_length);
  2140 
  2161 
  2141 	/**
  2162 	/**
  2142 	 * This function cleans up the TLS-PRF context.
  2163 	 * This function cleans up the TLS-PRF context.
  2143 	 */
  2164 	 */
  2144 	EAP_FUNC_IMPORT eap_status_e tls_prf_cleanup();
  2165 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_cleanup();
  2145 
  2166 
  2146 };
  2167 };
  2147 
  2168 
  2148 //------------------------------------------------------------
  2169 //------------------------------------------------------------
  2149 
  2170 
  2150 /// The crypto_tls_prf_c class includes the state of 
  2171 /// The crypto_tls_prf_c class includes the state of 
  2151 /// one instance of TLS-PRF algorithm.
  2172 /// one instance of TLS-PRF algorithm.
  2152 class EAP_EXPORT crypto_tls_prf_c
  2173 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_prf_c
  2153 {
  2174 {
  2154 
  2175 
  2155 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2176 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2156 private:
  2177 private:
  2157 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2178 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2167 
  2188 
  2168 	/**
  2189 	/**
  2169 	 * The set_is_invalid() function sets the state of the crypto_tls_prf_c object invalid. 
  2190 	 * The set_is_invalid() function sets the state of the crypto_tls_prf_c object invalid. 
  2170 	 * The crypto_tls_prf_c object calls this function after it is initialized.
  2191 	 * The crypto_tls_prf_c object calls this function after it is initialized.
  2171 	 */
  2192 	 */
  2172 	EAP_FUNC_IMPORT void set_is_invalid();
  2193 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2173 
  2194 
  2174 	/**
  2195 	/**
  2175 	 * The set_is_valid() function sets the state of the crypto_tls_prf_c object valid. 
  2196 	 * The set_is_valid() function sets the state of the crypto_tls_prf_c object valid. 
  2176 	 * The crypto_tls_prf_c object calls this function after it is initialized.
  2197 	 * The crypto_tls_prf_c object calls this function after it is initialized.
  2177 	 */
  2198 	 */
  2178 	EAP_FUNC_IMPORT void set_is_valid();
  2199 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2179 
  2200 
  2180 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2201 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2181 public:
  2202 public:
  2182 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2203 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2183 
  2204 
  2184 	/**
  2205 	/**
  2185 	 * Destructor resets the used internal buffers.
  2206 	 * Destructor resets the used internal buffers.
  2186 	 */
  2207 	 */
  2187 	EAP_FUNC_IMPORT virtual ~crypto_tls_prf_c();
  2208 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_tls_prf_c();
  2188 
  2209 
  2189 	/**
  2210 	/**
  2190 	 * Constructor initializes the used internal buffers.
  2211 	 * Constructor initializes the used internal buffers.
  2191 	 */
  2212 	 */
  2192 	EAP_FUNC_IMPORT crypto_tls_prf_c(abs_eap_am_tools_c * const tools);
  2213 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_tls_prf_c(abs_eap_am_tools_c * const tools);
  2193 
  2214 
  2194 	/**
  2215 	/**
  2195 	 * The get_is_valid() function returns the status of the crypto_tls_prf_c object. 
  2216 	 * The get_is_valid() function returns the status of the crypto_tls_prf_c object. 
  2196 	 * True indicates the object is initialized.
  2217 	 * True indicates the object is initialized.
  2197 	 */
  2218 	 */
  2198 	EAP_FUNC_IMPORT bool get_is_valid();
  2219 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2199 
  2220 
  2200 	/**
  2221 	/**
  2201 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2222 	 * This function initializes the context of TLS-PRF algorithm using the key.
  2202 	 */
  2223 	 */
  2203 	EAP_FUNC_IMPORT eap_status_e tls_prf_init(
  2224 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_init(
  2204 		const eap_variable_data_c * const secret,
  2225 		const eap_variable_data_c * const secret,
  2205 		const eap_variable_data_c * const label,
  2226 		const eap_variable_data_c * const label,
  2206 		const eap_variable_data_c * const seed);
  2227 		const eap_variable_data_c * const seed);
  2207 
  2228 
  2208 	/**
  2229 	/**
  2209 	 * This function writes the message digest to buffer. 
  2230 	 * This function writes the message digest to buffer. 
  2210 	 * Length is set if md_length_or_null is non-NULL.
  2231 	 * Length is set if md_length_or_null is non-NULL.
  2211 	 */
  2232 	 */
  2212 	EAP_FUNC_IMPORT eap_status_e tls_prf_output(
  2233 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_output(
  2213 		void * const pseudo_random_data,
  2234 		void * const pseudo_random_data,
  2214 		const u32_t pseudo_random_data_length);
  2235 		const u32_t pseudo_random_data_length);
  2215 
  2236 
  2216 	/**
  2237 	/**
  2217 	 * This function cleans up the TLS-PRF context.
  2238 	 * This function cleans up the TLS-PRF context.
  2218 	 */
  2239 	 */
  2219 	EAP_FUNC_IMPORT eap_status_e tls_prf_cleanup();
  2240 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e tls_prf_cleanup();
  2220 
  2241 
  2221 };
  2242 };
  2222 
  2243 
  2223 //------------------------------------------------------------
  2244 //------------------------------------------------------------
  2224 
  2245 
  2225 
  2246 
  2226 /// The crypto_eap_fast_hmac_sha1_prf_c class includes the state of 
  2247 /// The crypto_eap_fast_hmac_sha1_prf_c class includes the state of 
  2227 /// one instance of T-PRF algorithm used in EAP-FAST.
  2248 /// one instance of T-PRF algorithm used in EAP-FAST.
  2228 class EAP_EXPORT crypto_eap_fast_hmac_sha1_prf_c
  2249 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_eap_fast_hmac_sha1_prf_c
  2229 {
  2250 {
  2230 
  2251 
  2231 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2252 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2232 private:
  2253 private:
  2233 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2254 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2246 
  2267 
  2247 	/**
  2268 	/**
  2248 	 * The set_is_invalid() function sets the state of the crypto_eap_fast_hmac_sha1_prf_c object invalid. 
  2269 	 * The set_is_invalid() function sets the state of the crypto_eap_fast_hmac_sha1_prf_c object invalid. 
  2249 	 * The crypto_eap_fast_hmac_sha1_prf_c object calls this function after it is initialized.
  2270 	 * The crypto_eap_fast_hmac_sha1_prf_c object calls this function after it is initialized.
  2250 	 */
  2271 	 */
  2251 	EAP_FUNC_IMPORT void set_is_invalid();
  2272 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2252 
  2273 
  2253 	/**
  2274 	/**
  2254 	 * The set_is_valid() function sets the state of the crypto_eap_fast_hmac_sha1_prf_c object valid. 
  2275 	 * The set_is_valid() function sets the state of the crypto_eap_fast_hmac_sha1_prf_c object valid. 
  2255 	 * The crypto_eap_fast_hmac_sha1_prf_c object calls this function after it is initialized.
  2276 	 * The crypto_eap_fast_hmac_sha1_prf_c object calls this function after it is initialized.
  2256 	 */
  2277 	 */
  2257 	EAP_FUNC_IMPORT void set_is_valid();
  2278 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2258 
  2279 
  2259 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2280 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2260 public:
  2281 public:
  2261 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2282 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2262 
  2283 
  2263 	/**
  2284 	/**
  2264 	 * Destructor resets the used internal buffers.
  2285 	 * Destructor resets the used internal buffers.
  2265 	 */
  2286 	 */
  2266 	EAP_FUNC_IMPORT virtual ~crypto_eap_fast_hmac_sha1_prf_c();
  2287 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_eap_fast_hmac_sha1_prf_c();
  2267 
  2288 
  2268 	/**
  2289 	/**
  2269 	 * Constructor initializes the used internal buffers.
  2290 	 * Constructor initializes the used internal buffers.
  2270 	 */
  2291 	 */
  2271 	EAP_FUNC_IMPORT crypto_eap_fast_hmac_sha1_prf_c(abs_eap_am_tools_c * const tools);
  2292 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_eap_fast_hmac_sha1_prf_c(abs_eap_am_tools_c * const tools);
  2272 
  2293 
  2273 	/**
  2294 	/**
  2274 	 * The get_is_valid() function returns the status of the crypto_eap_fast_hmac_sha1_prf_c object. 
  2295 	 * The get_is_valid() function returns the status of the crypto_eap_fast_hmac_sha1_prf_c object. 
  2275 	 * True indicates the object is initialized.
  2296 	 * True indicates the object is initialized.
  2276 	 */
  2297 	 */
  2277 	EAP_FUNC_IMPORT bool get_is_valid();
  2298 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2278 
  2299 
  2279 	/**
  2300 	/**
  2280 	 * This function initializes the context of T-PRF algorithm using the key.
  2301 	 * This function initializes the context of T-PRF algorithm using the key.
  2281 	 */
  2302 	 */
  2282 	EAP_FUNC_IMPORT eap_status_e t_prf_init(
  2303 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e t_prf_init(
  2283 		const eap_variable_data_c * const key,
  2304 		const eap_variable_data_c * const key,
  2284 		const eap_variable_data_c * const label,
  2305 		const eap_variable_data_c * const label,
  2285 		const eap_variable_data_c * const seed);
  2306 		const eap_variable_data_c * const seed);
  2286 
  2307 
  2287 	/**
  2308 	/**
  2288 	 * This function writes the message digest to buffer. 
  2309 	 * This function writes the message digest to buffer. 
  2289 	 */
  2310 	 */
  2290 	EAP_FUNC_IMPORT eap_status_e t_prf_output(
  2311 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e t_prf_output(
  2291 		void * const pseudo_random_data,
  2312 		void * const pseudo_random_data,
  2292 		const u16_t pseudo_random_data_length);
  2313 		const u16_t pseudo_random_data_length);
  2293 
  2314 
  2294 	/**
  2315 	/**
  2295 	 * This function cleans up the T-PRF context.
  2316 	 * This function cleans up the T-PRF context.
  2296 	 */
  2317 	 */
  2297 	EAP_FUNC_IMPORT eap_status_e t_prf_cleanup();
  2318 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e t_prf_cleanup();
  2298 
  2319 
  2299 };
  2320 };
  2300 
  2321 
  2301 
  2322 
  2302 //------------------------------------------------------------
  2323 //------------------------------------------------------------
  2303 
  2324 
  2304 /// The crypto_tls_prf_c class includes the state of 
  2325 /// The crypto_tls_prf_c class includes the state of 
  2305 /// one instance of RSA algorithm.
  2326 /// one instance of RSA algorithm.
  2306 class EAP_EXPORT crypto_rsa_c
  2327 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_rsa_c
  2307 {
  2328 {
  2308 
  2329 
  2309 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2330 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2310 private:
  2331 private:
  2311 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2332 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2324 
  2345 
  2325 	/**
  2346 	/**
  2326 	 * The set_is_invalid() function sets the state of the crypto_rsa_c object invalid. 
  2347 	 * The set_is_invalid() function sets the state of the crypto_rsa_c object invalid. 
  2327 	 * The crypto_rsa_c object calls this function after it is initialized.
  2348 	 * The crypto_rsa_c object calls this function after it is initialized.
  2328 	 */
  2349 	 */
  2329 	EAP_FUNC_IMPORT void set_is_invalid();
  2350 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2330 
  2351 
  2331 	/**
  2352 	/**
  2332 	 * The set_is_valid() function sets the state of the crypto_rsa_c object valid. 
  2353 	 * The set_is_valid() function sets the state of the crypto_rsa_c object valid. 
  2333 	 * The crypto_rsa_c object calls this function after it is initialized.
  2354 	 * The crypto_rsa_c object calls this function after it is initialized.
  2334 	 */
  2355 	 */
  2335 	EAP_FUNC_IMPORT void set_is_valid();
  2356 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2336 
  2357 
  2337 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2358 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2338 public:
  2359 public:
  2339 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2360 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2340 
  2361 
  2341 	/**
  2362 	/**
  2342 	 * Destructor resets the used internal buffers.
  2363 	 * Destructor resets the used internal buffers.
  2343 	 */
  2364 	 */
  2344 	EAP_FUNC_IMPORT virtual ~crypto_rsa_c();
  2365 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_rsa_c();
  2345 
  2366 
  2346 	/**
  2367 	/**
  2347 	 * Constructor initializes the used internal buffers.
  2368 	 * Constructor initializes the used internal buffers.
  2348 	 */
  2369 	 */
  2349 	EAP_FUNC_IMPORT crypto_rsa_c(abs_eap_am_tools_c * const tools);
  2370 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_rsa_c(abs_eap_am_tools_c * const tools);
  2350 
  2371 
  2351 	/**
  2372 	/**
  2352 	 * The get_is_valid() function returns the status of the crypto_rsa_c object. 
  2373 	 * The get_is_valid() function returns the status of the crypto_rsa_c object. 
  2353 	 * True indicates the object is initialized.
  2374 	 * True indicates the object is initialized.
  2354 	 */
  2375 	 */
  2355 	EAP_FUNC_IMPORT bool get_is_valid();
  2376 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2356 
  2377 
  2357 	/**
  2378 	/**
  2358 	 * This function initializes the context of RSA algorithm using the key.
  2379 	 * This function initializes the context of RSA algorithm using the key.
  2359 	 */
  2380 	 */
  2360 	EAP_FUNC_IMPORT eap_status_e init();
  2381 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e init();
  2361 
  2382 
  2362 	EAP_FUNC_IMPORT eap_status_e encrypt_with_public_key(
  2383 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_with_public_key(
  2363 		const eap_variable_data_c * const public_rsa_key,
  2384 		const eap_variable_data_c * const public_rsa_key,
  2364 		const eap_variable_data_c * const input_data,
  2385 		const eap_variable_data_c * const input_data,
  2365 		eap_variable_data_c * const output_data);
  2386 		eap_variable_data_c * const output_data);
  2366 
  2387 
  2367 	EAP_FUNC_IMPORT eap_status_e decrypt_with_public_key(
  2388 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_with_public_key(
  2368 		const eap_variable_data_c * const public_rsa_key,
  2389 		const eap_variable_data_c * const public_rsa_key,
  2369 		const eap_variable_data_c * const input_data,
  2390 		const eap_variable_data_c * const input_data,
  2370 		eap_variable_data_c * const output_data);
  2391 		eap_variable_data_c * const output_data);
  2371 
  2392 
  2372 	EAP_FUNC_IMPORT eap_status_e encrypt_with_private_key(
  2393 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e encrypt_with_private_key(
  2373 		const eap_variable_data_c * const private_rsa_key,
  2394 		const eap_variable_data_c * const private_rsa_key,
  2374 		const eap_variable_data_c * const input_data,
  2395 		const eap_variable_data_c * const input_data,
  2375 		eap_variable_data_c * const output_data);
  2396 		eap_variable_data_c * const output_data);
  2376 
  2397 
  2377 	EAP_FUNC_IMPORT eap_status_e decrypt_with_private_key(
  2398 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e decrypt_with_private_key(
  2378 		const eap_variable_data_c * const private_rsa_key,
  2399 		const eap_variable_data_c * const private_rsa_key,
  2379 		const eap_variable_data_c * const input_data,
  2400 		const eap_variable_data_c * const input_data,
  2380 		eap_variable_data_c * const output_data);
  2401 		eap_variable_data_c * const output_data);
  2381 
  2402 
  2382 	EAP_FUNC_IMPORT eap_status_e sign(
  2403 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e sign(
  2383 		const eap_variable_data_c * const private_dsa_key,
  2404 		const eap_variable_data_c * const private_dsa_key,
  2384 		const eap_variable_data_c * const hash,
  2405 		const eap_variable_data_c * const hash,
  2385 		eap_variable_data_c * const signed_hash);
  2406 		eap_variable_data_c * const signed_hash);
  2386 
  2407 
  2387 	EAP_FUNC_IMPORT eap_status_e verify(
  2408 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e verify(
  2388 		const eap_variable_data_c * const public_rsa_key,
  2409 		const eap_variable_data_c * const public_rsa_key,
  2389 		const eap_variable_data_c * const hash,
  2410 		const eap_variable_data_c * const hash,
  2390 		const eap_variable_data_c * const signed_hash);
  2411 		const eap_variable_data_c * const signed_hash);
  2391 
  2412 
  2392 	/**
  2413 	/**
  2393 	 * This function cleans up the RSA context.
  2414 	 * This function cleans up the RSA context.
  2394 	 */
  2415 	 */
  2395 	EAP_FUNC_IMPORT eap_status_e cleanup();
  2416 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e cleanup();
  2396 
  2417 
  2397 };
  2418 };
  2398 
  2419 
  2399 //------------------------------------------------------------
  2420 //------------------------------------------------------------
  2400 
  2421 
  2401 /// The crypto_tls_prf_c class includes the state of 
  2422 /// The crypto_tls_prf_c class includes the state of 
  2402 /// one instance of DSA algorithm.
  2423 /// one instance of DSA algorithm.
  2403 class EAP_EXPORT crypto_dsa_c
  2424 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_dsa_c
  2404 {
  2425 {
  2405 
  2426 
  2406 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2427 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2407 private:
  2428 private:
  2408 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2429 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2421 
  2442 
  2422 	/**
  2443 	/**
  2423 	 * The set_is_invalid() function sets the state of the crypto_dsa_c object invalid. 
  2444 	 * The set_is_invalid() function sets the state of the crypto_dsa_c object invalid. 
  2424 	 * The crypto_dsa_c object calls this function after it is initialized.
  2445 	 * The crypto_dsa_c object calls this function after it is initialized.
  2425 	 */
  2446 	 */
  2426 	EAP_FUNC_IMPORT void set_is_invalid();
  2447 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_invalid();
  2427 
  2448 
  2428 	/**
  2449 	/**
  2429 	 * The set_is_valid() function sets the state of the crypto_dsa_c object valid. 
  2450 	 * The set_is_valid() function sets the state of the crypto_dsa_c object valid. 
  2430 	 * The crypto_dsa_c object calls this function after it is initialized.
  2451 	 * The crypto_dsa_c object calls this function after it is initialized.
  2431 	 */
  2452 	 */
  2432 	EAP_FUNC_IMPORT void set_is_valid();
  2453 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H void set_is_valid();
  2433 
  2454 
  2434 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2455 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2435 public:
  2456 public:
  2436 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2457 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2437 
  2458 
  2438 	/**
  2459 	/**
  2439 	 * Destructor resets the used internal buffers.
  2460 	 * Destructor resets the used internal buffers.
  2440 	 */
  2461 	 */
  2441 	EAP_FUNC_IMPORT virtual ~crypto_dsa_c();
  2462 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_dsa_c();
  2442 
  2463 
  2443 	/**
  2464 	/**
  2444 	 * Constructor initializes the used internal buffers.
  2465 	 * Constructor initializes the used internal buffers.
  2445 	 */
  2466 	 */
  2446 	EAP_FUNC_IMPORT crypto_dsa_c(abs_eap_am_tools_c * const tools);
  2467 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_dsa_c(abs_eap_am_tools_c * const tools);
  2447 
  2468 
  2448 	/**
  2469 	/**
  2449 	 * The get_is_valid() function returns the status of the crypto_dsa_c object. 
  2470 	 * The get_is_valid() function returns the status of the crypto_dsa_c object. 
  2450 	 * True indicates the object is initialized.
  2471 	 * True indicates the object is initialized.
  2451 	 */
  2472 	 */
  2452 	EAP_FUNC_IMPORT bool get_is_valid();
  2473 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2453 
  2474 
  2454 	/**
  2475 	/**
  2455 	 * This function initializes the context of DSA algorithm using the key.
  2476 	 * This function initializes the context of DSA algorithm using the key.
  2456 	 */
  2477 	 */
  2457 	EAP_FUNC_IMPORT eap_status_e init();
  2478 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e init();
  2458 
  2479 
  2459 	EAP_FUNC_IMPORT eap_status_e sign(
  2480 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e sign(
  2460 		const eap_variable_data_c * const private_dsa_key,
  2481 		const eap_variable_data_c * const private_dsa_key,
  2461 		const eap_variable_data_c * const hash,
  2482 		const eap_variable_data_c * const hash,
  2462 		eap_variable_data_c * const signed_hash);
  2483 		eap_variable_data_c * const signed_hash);
  2463 
  2484 
  2464 	EAP_FUNC_IMPORT eap_status_e verify(
  2485 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e verify(
  2465 		const eap_variable_data_c * const public_dsa_key,
  2486 		const eap_variable_data_c * const public_dsa_key,
  2466 		const eap_variable_data_c * const dsa_param_p,
  2487 		const eap_variable_data_c * const dsa_param_p,
  2467 		const eap_variable_data_c * const dsa_param_q,
  2488 		const eap_variable_data_c * const dsa_param_q,
  2468 		const eap_variable_data_c * const dsa_param_g,
  2489 		const eap_variable_data_c * const dsa_param_g,
  2469 		const eap_variable_data_c * const hash,
  2490 		const eap_variable_data_c * const hash,
  2470 		const eap_variable_data_c * const signed_hash);
  2491 		const eap_variable_data_c * const signed_hash);
  2471 
  2492 
  2472 	/**
  2493 	/**
  2473 	 * This function cleans up the DSA context.
  2494 	 * This function cleans up the DSA context.
  2474 	 */
  2495 	 */
  2475 	EAP_FUNC_IMPORT eap_status_e cleanup();
  2496 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e cleanup();
  2476 
  2497 
  2477 };
  2498 };
  2478 
  2499 
  2479 //------------------------------------------------------------
  2500 //------------------------------------------------------------
  2480 
  2501 
  2481 /// The crypto_wpa_psk_password_hash_c class includes the functions for
  2502 /// The crypto_wpa_psk_password_hash_c class includes the functions for
  2482 /// generating WPA PSK from an ASCII password
  2503 /// generating WPA PSK from an ASCII password
  2483 class EAP_EXPORT crypto_wpa_psk_password_hash_c
  2504 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_wpa_psk_password_hash_c
  2484 {
  2505 {
  2485 
  2506 
  2486 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2507 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2487 private:
  2508 private:
  2488 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2509 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2523 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2544 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2524 
  2545 
  2525 	/**
  2546 	/**
  2526 	 * Destructor resets the used internal buffers.
  2547 	 * Destructor resets the used internal buffers.
  2527 	 */
  2548 	 */
  2528 	EAP_FUNC_IMPORT virtual ~crypto_wpa_psk_password_hash_c();
  2549 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_wpa_psk_password_hash_c();
  2529 
  2550 
  2530 	/**
  2551 	/**
  2531 	 * Constructor initializes the used internal buffers.
  2552 	 * Constructor initializes the used internal buffers.
  2532 	 */
  2553 	 */
  2533 	EAP_FUNC_IMPORT crypto_wpa_psk_password_hash_c(abs_eap_am_tools_c * const tools);
  2554 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_wpa_psk_password_hash_c(abs_eap_am_tools_c * const tools);
  2534 
  2555 
  2535 	/**
  2556 	/**
  2536 	 * The get_is_valid() function returns the status of the crypto_wpa_psk_password_hash object. 
  2557 	 * The get_is_valid() function returns the status of the crypto_wpa_psk_password_hash object. 
  2537 	 * True indicates the object is initialized.
  2558 	 * True indicates the object is initialized.
  2538 	 */
  2559 	 */
  2539 	EAP_FUNC_IMPORT bool get_is_valid();
  2560 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2540 	
  2561 	
  2541 	/**
  2562 	/**
  2542 	* Calculates the PSK hash from an ASCII password
  2563 	* Calculates the PSK hash from an ASCII password
  2543 	*/
  2564 	*/
  2544 	EAP_FUNC_IMPORT eap_status_e password_hash(
  2565 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e password_hash(
  2545 		const eap_variable_data_c * const password,
  2566 		const eap_variable_data_c * const password,
  2546 		const eap_variable_data_c * const ssid,	
  2567 		const eap_variable_data_c * const ssid,	
  2547 		eap_variable_data_c * const output,
  2568 		eap_variable_data_c * const output,
  2548 		void * object = 0,
  2569 		void * object = 0,
  2549 		eap_status_e (*progress_callback)(void*, u32_t) = 0);
  2570 		eap_status_e (*progress_callback)(void*, u32_t) = 0);
  2552 
  2573 
  2553 //------------------------------------------------------------
  2574 //------------------------------------------------------------
  2554 
  2575 
  2555 /// The crypto_wpa_psk_password_hash_c class includes the functions for
  2576 /// The crypto_wpa_psk_password_hash_c class includes the functions for
  2556 /// generating WPA PSK from an ASCII password
  2577 /// generating WPA PSK from an ASCII password
  2557 class EAP_EXPORT crypto_nt_hash_c
  2578 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_nt_hash_c
  2558 {
  2579 {
  2559 
  2580 
  2560 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2581 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2561 private:
  2582 private:
  2562 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2583 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2584 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2605 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2585 
  2606 
  2586 	/**
  2607 	/**
  2587 	 * Destructor resets the used internal buffers.
  2608 	 * Destructor resets the used internal buffers.
  2588 	 */
  2609 	 */
  2589 	EAP_FUNC_IMPORT virtual ~crypto_nt_hash_c();
  2610 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_nt_hash_c();
  2590 
  2611 
  2591 	/**
  2612 	/**
  2592 	 * Constructor initializes the used internal buffers.
  2613 	 * Constructor initializes the used internal buffers.
  2593 	 */
  2614 	 */
  2594 	EAP_FUNC_IMPORT crypto_nt_hash_c(abs_eap_am_tools_c * const tools);
  2615 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_nt_hash_c(abs_eap_am_tools_c * const tools);
  2595 
  2616 
  2596 	/**
  2617 	/**
  2597 	 * The get_is_valid() function returns the status of the crypto_wpa_psk_password_hash object. 
  2618 	 * The get_is_valid() function returns the status of the crypto_wpa_psk_password_hash object. 
  2598 	 * True indicates the object is initialized.
  2619 	 * True indicates the object is initialized.
  2599 	 */
  2620 	 */
  2600 	EAP_FUNC_IMPORT bool get_is_valid();
  2621 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2601 	
  2622 	
  2602 	EAP_FUNC_IMPORT eap_status_e nt_password_hash(
  2623 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e nt_password_hash(
  2603 		const eap_variable_data_c * const password_utf8,
  2624 		const eap_variable_data_c * const password_utf8,
  2604 		eap_variable_data_c * const password_hash,
  2625 		eap_variable_data_c * const password_hash,
  2605 		const u32_t digest_size);
  2626 		const u32_t digest_size);
  2606 
  2627 
  2607 	EAP_FUNC_IMPORT eap_status_e hash_nt_password_hash(
  2628 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e hash_nt_password_hash(
  2608 		const eap_variable_data_c * const password_hash,
  2629 		const eap_variable_data_c * const password_hash,
  2609 		eap_variable_data_c * const password_hash_hash,
  2630 		eap_variable_data_c * const password_hash_hash,
  2610 		const u32_t digest_size);
  2631 		const u32_t digest_size);
  2611 
  2632 
  2612 	/* RFC 3079 */
  2633 	/* RFC 3079 */
  2613 
  2634 
  2614 	EAP_FUNC_IMPORT eap_status_e get_master_key(
  2635 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e get_master_key(
  2615 		const eap_variable_data_c * const password_hash_hash,
  2636 		const eap_variable_data_c * const password_hash_hash,
  2616 		const eap_variable_data_c * const nt_response,
  2637 		const eap_variable_data_c * const nt_response,
  2617 		eap_variable_data_c * const master_key,
  2638 		eap_variable_data_c * const master_key,
  2618 		const u32_t in_master_key_length);
  2639 		const u32_t in_master_key_length);
  2619 
  2640 
  2620 	EAP_FUNC_IMPORT eap_status_e get_asymmetric_start_key(
  2641 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e get_asymmetric_start_key(
  2621 		const eap_variable_data_c * const in_master_key,
  2642 		const eap_variable_data_c * const in_master_key,
  2622 		eap_variable_data_c * const out_session_key,
  2643 		eap_variable_data_c * const out_session_key,
  2623 		const u32_t in_session_key_length,
  2644 		const u32_t in_session_key_length,
  2624 		const bool in_is_send,
  2645 		const bool in_is_send,
  2625 		const bool in_is_server);
  2646 		const bool in_is_server);
  2626 
  2647 
  2627 	EAP_FUNC_IMPORT eap_status_e get_new_key_from_sha(
  2648 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e get_new_key_from_sha(
  2628 		const eap_variable_data_c * const in_start_key,
  2649 		const eap_variable_data_c * const in_start_key,
  2629 		const eap_variable_data_c * const in_session_key,
  2650 		const eap_variable_data_c * const in_session_key,
  2630 		eap_variable_data_c * const out_interim_key,
  2651 		eap_variable_data_c * const out_interim_key,
  2631 		const u32_t in_interim_key_length);
  2652 		const u32_t in_interim_key_length);
  2632 	
  2653 	
  2634 
  2655 
  2635 //------------------------------------------------------------
  2656 //------------------------------------------------------------
  2636 
  2657 
  2637 /// The crypto_kd_hmac_sha256_c class includes the functions for
  2658 /// The crypto_kd_hmac_sha256_c class includes the functions for
  2638 /// KD-HMAC-SHA256.
  2659 /// KD-HMAC-SHA256.
  2639 class EAP_EXPORT crypto_kd_hmac_sha256_c
  2660 class EAP_CLASS_VISIBILITY_EAP_CRYPTO_API_H crypto_kd_hmac_sha256_c
  2640 {
  2661 {
  2641 
  2662 
  2642 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2663 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2643 private:
  2664 private:
  2644 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2665 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2666 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2687 	// - - - - - - - - - - - - - - - - - - - - - - - -
  2667 
  2688 
  2668 	/**
  2689 	/**
  2669 	 * Destructor resets the used internal buffers.
  2690 	 * Destructor resets the used internal buffers.
  2670 	 */
  2691 	 */
  2671 	EAP_FUNC_IMPORT virtual ~crypto_kd_hmac_sha256_c();
  2692 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H virtual ~crypto_kd_hmac_sha256_c();
  2672 
  2693 
  2673 	/**
  2694 	/**
  2674 	 * Constructor initializes the used internal buffers.
  2695 	 * Constructor initializes the used internal buffers.
  2675 	 */
  2696 	 */
  2676 	EAP_FUNC_IMPORT crypto_kd_hmac_sha256_c(abs_eap_am_tools_c * const tools);
  2697 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H crypto_kd_hmac_sha256_c(abs_eap_am_tools_c * const tools);
  2677 
  2698 
  2678 	/**
  2699 	/**
  2679 	 * The get_is_valid() function returns the status of the crypto_kd_hmac_sha256_c object. 
  2700 	 * The get_is_valid() function returns the status of the crypto_kd_hmac_sha256_c object. 
  2680 	 * True indicates the object is initialized.
  2701 	 * True indicates the object is initialized.
  2681 	 */
  2702 	 */
  2682 	EAP_FUNC_IMPORT bool get_is_valid();
  2703 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H bool get_is_valid();
  2683 	
  2704 	
  2684 	EAP_FUNC_IMPORT eap_status_e expand_key(
  2705 	EAP_FUNC_VISIBILITY_EAP_CRYPTO_API_H eap_status_e expand_key(
  2685 		eap_variable_data_c * const output,
  2706 		eap_variable_data_c * const output,
  2686 		const u32_t required_output_size,
  2707 		const u32_t required_output_size,
  2687 		const eap_variable_data_c * const key,
  2708 		const eap_variable_data_c * const key,
  2688 		const eap_variable_data_c * const label
  2709 		const eap_variable_data_c * const label
  2689 		);
  2710 		);