APT:Unwrap

Revision as of 21:52, 31 May 2013 by Yellows8 (talk | contribs) (Created page with "=Request= {| class="wikitable" border="1" |- ! Index Word ! Description |- | 0 | Header code [0x00470104] |- | 1 | Output buffer size |- | 2 | Input buffer size |- | 3 | Block ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Request

Index Word Description
0 Header code [0x00470104]
1 Output buffer size
2 Input buffer size
3 Block size
4 Nonce size, size 12 is used if this is >12.
5 (inputbufsize<<4) | 10
6 Input encrypted data buffer ptr
7 (outputbufsize<<4) | 12
8 Output cleartext data buffer ptr

Response

Index Word Description
0 Header code
1 Result code

Description

This decrypts the input data with AES-CCM using keytype2. The 12-byte nonce buffer used by NS is cleared to all-zero, then the nonce from inputbuf+0 with the noncesize is copied to this nonce buffer. NS then uses PS:EncryptSignDecryptVerifyAesCcm with keytype2 and with the above nonce buffer, where the inputptr is inputbuf+noncesize, outputptr is outputbuf+0, and size is inputbuffersize - noncesize - 16.

After decryption, NS copies the data at outbuf+blocksize to outbuf+blocksize+noncesize, with size inputbuffersize-blocksize-16. NS then copies the nonce from inputbuf+0 with the noncesize, to outbuf+blocksize.