CAAM in trusty

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAAM in trusty

Jump to solution
828 Views
asmaa
Contributor V

Hi there,

I am using CAAM in trusty for IMX boards, I am able to work out AES and DES in ECB mode, also RSA and SHA is working. I am not getting the right encrypted values for CBC mode. Following is the code changes for job descriptor , it's similar to what's done in trusty/hardware/nxp/app/hwcrypto/caam.c for ECB mode, I have changed slightly for CBC mode. I am not getting any error, just the encrypted output is not matching the ciphertext expected.

Can someone please confirm if I am doing it in the right way for  AES CBC mode?

 

g_job->dsc[0] = 0xb080000A

 g_job->dsc[1] = 0x02000010;

g_job->dsc[2] = key_pa;

g_job->dsc[3] = 0x22120010;
g_job->dsc[4] = iv_pa;
g_job->dsc[5] = 0x22120000 | (0x0000ffff & len);
g_job->dsc[6] = in_pa;
g_job->dsc[7] = enc ? 0x8210010D : 0x8210010C;
g_job->dsc[8] = 0x60300000 | (0x0000ffff & len);
g_job->dsc[9] = out_pa;
g_job->dsc_used = 10;
run_job(g_job);
 
if (g_job->status & JOB_RING_STS) {
TLOGE("job failed (0x%08x)\n"g_job->status);
return CAAM_FAILURE;
    }
 
 
These are the values I am using:
KEY = 9dc2c84a37850c11699818605f47958c
IV = 256953b2feab2a04ae0180d8335bbed6
PLAINTEXT = 2e586692e647f5028ec6fa47a55a2aab
CIPHERTEXT = 1b1ebd1fc45ec43037fd4844241a437f
 
Any help is really appreciated, thank you so much.
0 Kudos
1 Solution
814 Views
asmaa
Contributor V

I was able to resolve the issue.

View solution in original post

0 Kudos
1 Reply
815 Views
asmaa
Contributor V

I was able to resolve the issue.

0 Kudos