1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<title>AES_DecryptAndVerify</title> 9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 10</head> 11 12<body> 13 14<h1 align="left">AES_DecryptAndVerify <IMG src="../../image/TWL.gif" width="23" height="12" border="0" align="middle"></h1> 15<h2>Syntax</h2> 16 17<dl> 18 <dd> 19 <pre><CODE>#include <twl/aes.h> 20 21#define AES_ENCRYPT_HEADER_SIZE 16 22 23<a href="../api/AESResult.html">AESResult</a> AES_DecryptAndVerify( 24 const void* src, 25 u32 srcSize, 26 void* dst, 27 <a href="../api/AESCallback.html">AESCallback</a> callback, 28 void* arg ); 29</CODE></pre> 30</dd> 31</dl> 32 33<h2>Arguments</h2> 34<TABLE border="1" width="100%" class="arguments"> 35 <TBODY> 36 <TR> 37<TH>src</TH> 38<TD>Pointer to ciphertext. Must be 4-byte aligned. In addition, it must point to a location in main memory.</TD> 39 </TR> 40 <TR> 41<TH>srcSize</TH> 42<TD>Ciphertext size. It must be larger than 0, and less than or equal to <code>AES_PDATA_SIZE_MAX</code>.</TD> 43 </TR> 44 <TR> 45<TH>dst</TH> 46<TD>Pointer to the buffer that will store the plaintext. Must be 4-byte aligned. In addition, it must point to a location in main memory. An area of size <span class="argument">srcSize</span> - <code>AES_SIGN_HEADER_SIZE</code> bytes is required.</TD> 47 </TR> 48 <TR> 49<TH>callback</TH> 50<TD>Pointer to the callback function to call when decryption completes. It is possible to specify <CODE>NULL</CODE>.</TD> 51 </TR> 52 <TR> 53<TH>arg</TH> 54<TD>User-defined parameter that is passed to the above callback function. Can be any value, including <CODE>NULL</CODE>.</TD> 55 </TR> 56 </TBODY> 57</TABLE> 58 59<h2>Return Values</h2> 60<p> 61Returns <CODE>AES_RESULT_SUCCESS</CODE> if the AES operation was started successfully. Any other return values indicate an error. 62</p> 63 64<H2>Description</H2> 65<P> 66Decrypts and verifies the signature of data that was encrypted using <code><a href="AES_EncryptAndSign.html">AES_EncryptAndSign()</a></code>. 67</p> 68 69<p> 70This uses the key that was selected with <code><a href="../api/AES_SetKey.html">AES_SetKey()</a></code> to decrypt and verify the signature of the <span class="argument">srcSize</span> bytes starting from <span class="argument">src</span>. The decrypted result is written to a region starting at <span class="argument">dst</span> whose size is <span class="argument">srcSize</span> - <code>AES_SIGN_HEADER_SIZE</code> bytes. When the decryption process completes, <span class="argument">callback</span> is called, using the decrypted result and <span class="argument">arg</span> as arguments. <span class="argument">callback</span> is called from the interrupt handler, so it might be called even when interrupts are disabled. Conversely, <span class="argument">callback</span> will not be called when interrupts are disabled. 71</p> 72 73<p> 74This function returns control immediately once it has started the processing. If processing starts without a problem, this function will return <code>AES_RESULT_SUCCESS</code>, but if an error occurs during subsequent processing, it will call <span class="argument">callback</span> with the error value and <span class="argument">arg</span> as arguments. <B>Note:</B> Error notification using this callback is started from the interrupt handler, so depending on the situation, it is possible that the callback can deliver error notification before control returns from the function. 75</p> 76 77<p> 78The decryption key must be set beforehand using <code><a href="../api/AES_SetKey.html">AES_SetKey()</a></code>. 79</p> 80 81 82<h2>See Also</h2> 83<p><CODE><A href="AES_EncryptAndSign.html">AES_EncryptAndSign</A></CODE></p> 84 85<H2>Revision History</H2> 86<P> 872008/07/11 Added <CODE>AES_ENCRYPT_HEADER_SIZE</CODE>. <br>2007/12/25 Initial version. 88</P> 89<hr><p>CONFIDENTIAL</p></body> 90</html> 91