Dialog Semiconductor customer support - crypto https://support.dialog-semiconductor.com/resource-keywords/crypto en Unable to use AES Hardware encryption block https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-42-%E2%80%93-software/unable-use-aes-hardware-encryption

Hi

I am trying to use AES Hardware encryption for some user data, based on BLE app barebone

I have gone through the rest of the forum documents, but it did not help.

My code is as below :

struct gapm_use_enc_block_cmd *enccmd = KE_MSG_ALLOC(GAPM_USE_ENC_BLOCK_CMD, TASK_GAPM, TASK_APP, gapm_use_enc_block_cmd);
enccmd->operation = GAPM_USE_ENC_BLOCK;
uint8_t key[16] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
uint8_t pt[16] = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff};
memcpy(enccmd->operand_1,key,16);
memcpy(enccmd->operand_2,pt,16);
ke_msg_send(enccmd);

This is at the bottom of user_app_init();

---

I added this in user_catch_rest_hndl

case GAPM_USE_ENC_BLOCK_IND:
{
struct gapm_use_enc_block_ind const *msg_param = (struct gapm_use_enc_block_ind const *) (param);
uint8_t ciphertext[16];
memcpy(ciphertext,msg_param->result,16);
if(ciphertext[0] == 0x01 ) {
ciphertext[0]++;
}

if(ciphertext[0] == 0x01) {
--ciphertext[0];
}
}
break;

I added breakpoints, but it seems that the message is never caught. Can you please help me figure out what i am missing / doing wrong ?

Thanks

Keywords: 
Device: 
Thu, 17 Nov 2016 07:49:42 +0000 ankitdaf 4937年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-42-%E2%80%93-software/unable-use-aes-hardware-encryption#comments