TSEC: Difference between revisions
( ͡° ͜ʖ ͡°) |
|||
Line 2,412: | Line 2,412: | ||
===== do_crypto ===== | ===== do_crypto ===== | ||
This is the method responsible for all crypto operations performed during [[#KeygenLdr|KeygenLdr]]. It takes '''src_addr''', '''src_size''', '''iv_addr''', '''dst_addr''', '''mode''' and ''' | This is the method responsible for all crypto operations performed during [[#KeygenLdr|KeygenLdr]]. It takes '''src_addr''', '''src_size''', '''iv_addr''', '''dst_addr''', '''mode''' and '''use_imem''' as arguments. | ||
// Check for invalid source data size | // Check for invalid source data size | ||
if (!src_size || (src_size & 0x0F)) | if (!src_size || (src_size & 0x0F)) | ||
Line 2,556: | Line 2,556: | ||
// The next xfer instruction will be overridden | // The next xfer instruction will be overridden | ||
// and target changes from DMA to crypto input/output stream | // and target changes from DMA to crypto input/output stream | ||
if ( | if (use_imem) | ||
cxset(0xA1); // Flag 0xA0 is | cxset(0xA1); // Flag 0xA0 is falcon imem <-> crypto input/output stream | ||
else | else | ||
cxset(0x21); // Flag 0x20 is external mem <-> crypto input/output stream | cxset(0x21); // Flag 0x20 is external mem <-> crypto input/output stream | ||
Line 2,570: | Line 2,570: | ||
// The next xfer instruction will be overridden | // The next xfer instruction will be overridden | ||
// and target changes from DMA to crypto input/output stream | // and target changes from DMA to crypto input/output stream | ||
if ( | if (use_imem) | ||
cxset(0xA1); // Flag 0xA0 is | cxset(0xA1); // Flag 0xA0 is falcon imem <-> crypto input/output stream | ||
else | else | ||
cxset(0x21); // Flag 0x20 is external mem <-> crypto input/output stream | cxset(0x21); // Flag 0x20 is external mem <-> crypto input/output stream | ||
Line 2,583: | Line 2,583: | ||
// The next 2 xfer instructions will be overridden | // The next 2 xfer instructions will be overridden | ||
// and target changes from DMA to crypto input/output stream | // and target changes from DMA to crypto input/output stream | ||
if ( | if (use_imem) | ||
cxset(0xA2); // Flag 0xA0 is | cxset(0xA2); // Flag 0xA0 is falcon imem <-> crypto input/output stream | ||
else | else | ||
cxset(0x22); // Flag 0x20 is external mem <-> crypto input/output stream | cxset(0x22); // Flag 0x20 is external mem <-> crypto input/output stream |