1 #ifndef __GENIE_CRYPTO_H__ 2 #define __GENIE_CRYPTO_H__ 3 4 #define GENIE_CRYPTO_UNIT_SIZE (16) 5 6 #define STATIC_OOB_LENGTH 16 7 8 /** 9 * @brief get the authentication info 10 * @param[in] random: the random sequence used for calculating. 11 * @return the authenticated sequence 12 */ 13 uint8_t *genie_crypto_get_auth(const uint8_t random[16]); 14 15 /** 16 * @brief encrypt ais data. 17 * @param[in] raw data 18 * @param[out] encryped data 19 */ 20 int genie_crypto_encrypt(const uint8_t data_in[16], uint8_t data_out[16]); 21 22 /** 23 * @brief decrypt ais data. 24 * @param[in] encryped data 25 * @param[out] raw data 26 */ 27 int genie_crypto_decrypt(const uint8_t data_in[16], uint8_t data_out[16]); 28 29 /** 30 * @brief get the cipher for ble auth. 31 * @param[in] random, 16 Byte 32 * @param[out] cipher, 1 6Byte 33 */ 34 void genie_ais_get_cipher(const uint8_t random[16], uint8_t *cipher); 35 36 /** 37 * @brief clear the keys of ais service. 38 */ 39 void genie_ais_reset(void); 40 41 /** 42 * @brief init the ais advertising. 43 * @param[inout] the phoint of advertising data 44 * @param[in] is silent adv or not 45 */ 46 void genie_crypto_adv_create(uint8_t ad_structure[14], uint8_t is_silent); 47 48 #endif 49