AES128解码有无对应API



  • 现在使用8012B时使用appm_use_aes128_block可以加密,请教解码可以使用哪个API?



  • 有的,SDK的159的版本app.h会有appm_use_aes128_decryption函数可以进行aes128的解密。 demo_basci_function工程中user_proj_main()入口函数有示例代码。 如下:
    void get_aes128_decryption(void *arg)
    {
    struct gapm_use_enc_block_ind *param = (struct gapm_use_enc_block_ind *)arg;
    printf("get_aes128_decryption: ");
    show_reg2(param->result,KEY_LEN,1);
    printf("\r\n");
    }
    void get_aes128_rst(void *arg)
    {
    struct gapm_use_enc_block_ind *param = (struct gapm_use_enc_block_ind *)arg;
    printf("aes128: ");
    show_reg2(param->result,KEY_LEN,1);
    printf("\r\n");

    uint8_t key[] = "0000000000000000";
    appm_use_aes128_decryption(key,param->result,get_aes128_decryption);
    

    }

    void user_proj_main(void)
    {
    uint8_t plaintext[] = "0000000000000001";
    uint8_t key[] = "0000000000000000";
    appm_use_aes128_block(key,plaintext,get_aes128_rst);
    }