Difference between revisions of "APT:Wrap"

From 3dbrew
Jump to navigation Jump to search
(Created page with "=Request= {| class="wikitable" border="1" |- ! Index Word ! Description |- | 0 | Header code [0x00460104] |- | 1 | Output buffer size |- | 2 | Input buffer size |- | 3 | Block ...")
 
Line 47: Line 47:
  
 
=Description=
 
=Description=
This encrypts the input data with [[PS:EncryptSignDecryptVerifyAesCcm|AES-CCM]] using keytype2. The 12-byte nonce buffer used by NS is cleared to all-zero, then the nonce from inputbuf+blocksize with the noncesize is copied to this nonce buffer. NS then copies the data at inputbuf+0 to outbuf+noncesize, with the blocksize.
+
This encrypts the input data with [[PS:EncryptSignDecryptVerifyAesCcm|AES-CCM]] using keytype2, when the input noncesize is <12 the low 2-bits are cleared in the noncesize. The 12-byte nonce buffer used by NS is cleared to all-zero, then the nonce from inputbuf+blocksize with the noncesize is copied to this nonce buffer. NS then copies the data at inputbuf+0 to outbuf+noncesize, with the blocksize.
  
 
NS then copies the data at inbuf+blocksize+noncesize to outbuf+blocksize, with size inputbuffersize-blocksize-noncesize. NS then uses [[PS:EncryptSignDecryptVerifyAesCcm]] with keytype2 and with the above nonce buffer, where the input/output buffer ptrs are outbuf+noncesize, with size blocksize+(inputbuffersize-blocksize-noncesize). NS then copies the the nonce from the nonce-buffer with the noncesize, to outbuf+0.
 
NS then copies the data at inbuf+blocksize+noncesize to outbuf+blocksize, with size inputbuffersize-blocksize-noncesize. NS then uses [[PS:EncryptSignDecryptVerifyAesCcm]] with keytype2 and with the above nonce buffer, where the input/output buffer ptrs are outbuf+noncesize, with size blocksize+(inputbuffersize-blocksize-noncesize). NS then copies the the nonce from the nonce-buffer with the noncesize, to outbuf+0.

Revision as of 23:24, 31 May 2013

Request

Index Word Description
0 Header code [0x00460104]
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 cleartext data buffer ptr
7 (outputbufsize<<4) | 12
8 Output encrypted data buffer ptr

Response

Index Word Description
0 Header code
1 Result code

Description

This encrypts the input data with AES-CCM using keytype2, when the input noncesize is <12 the low 2-bits are cleared in the noncesize. The 12-byte nonce buffer used by NS is cleared to all-zero, then the nonce from inputbuf+blocksize with the noncesize is copied to this nonce buffer. NS then copies the data at inputbuf+0 to outbuf+noncesize, with the blocksize.

NS then copies the data at inbuf+blocksize+noncesize to outbuf+blocksize, with size inputbuffersize-blocksize-noncesize. NS then uses PS:EncryptSignDecryptVerifyAesCcm with keytype2 and with the above nonce buffer, where the input/output buffer ptrs are outbuf+noncesize, with size blocksize+(inputbuffersize-blocksize-noncesize). NS then copies the the nonce from the nonce-buffer with the noncesize, to outbuf+0.