SEC5.2 operations on T2080

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SEC5.2 operations on T2080

912件の閲覧回数
andrewbanda
Contributor I

Hi,

I want to perform hashing using the security engine of the T2080. Does anyone have an example or know where I can find one, using descriptors to do (for example) a SHA256 hash?

Thank you,

Andrew

ラベル(1)
タグ(2)
0 件の賞賛
3 返答(返信)

660件の閲覧回数
bpe
NXP Employee
NXP Employee

Take a look at the following files:

http://git.freescale.com/git/cgit.cgi/ppc/sdk/flib.git/tree/sec/rta/tests/hmac_1.c
http://git.freescale.com/git/cgit.cgi/ppc/sdk/flib.git/tree/sec/rta/tests/hmac_2.c
http://git.freescale.com/git/cgit.cgi/ppc/sdk/flib.git/tree/sec/rta/tests/hmac_by_hand.c

If you are working with NXP SDK, the name of the package that owns them is flib.


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

660件の閲覧回数
andrewbanda
Contributor I

Hi Platon,

Just another question. I've used the rta code to generate a sha256 job descriptor:

int sec_sha256(uint64_t mesg, uint64_t dest, uint32_t mesg_length, uint32_t *buff)
{
struct program prg;
struct program *p = &prg;

PROGRAM_CNTXT_INIT(p, buff, 0);
PROGRAM_SET_36BIT_ADDR(p);

JOB_HDR(p, SHR_NEVER, 0, 0, 0);
{
ALG_OPERATION(p, OP_ALG_ALGSEL_SHA256, OP_ALG_AAI_HASH, OP_ALG_AS_INITFINAL, ICV_CHECK_DISABLE, DIR_ENC);

FIFOLOAD(p, MSG2, mesg, mesg_length, LAST2 | EXT);

STORE(p, CONTEXT2, 0, dest, 32, 0);
}

return PROGRAM_FINALIZE(p);
}

Which generates:

Job Descriptor
B0800009
8443000D
24540000
00000000
00040000
000001C0
54200020
00000000

00030000

Now I'm having trouble submitting the descriptor to the SEC engine, I'm a bit confused about the register configuration.

Here's what I've made so far:

void submit_job(uint32_t in_buff, uint32_t out_buff, int size)
{
WRITE_REG(MCFGR, 0x121f1);


WRITE_REG(IRSR_JR0, 2 * size);
WRITE_REG(ORSR_JR0, 2 * size);

WRITE_REG(IRBAR_JR0, 0);
WRITE_REG((IRBAR_JR0 + 4), in_buff);
WRITE_REG(ORBAR_JR0, 0);
WRITE_REG((ORBAR_JR0 + 4), out_buff);

WRITE_REG(IRJAR_JR0, size);

}

in_buff is the address of the job descriptor, out_buff is some other address and size is the size of the descriptor. The output status is "Error reading descriptor" and the error source is the job ring.

If you or anyone can help me with this, I would be very grateful.

Best regards,

Andrew

0 件の賞賛

660件の閲覧回数
andrewbanda
Contributor I

Thank you very much Platon,

It seems to be exactly what I need. Yes I'm working the NXP SDK, so I'll go through it.

0 件の賞賛