1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<!--========================================================================== 3 Copyright 2008 Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 ==========================================================================--> 11<HTML> 12<HEAD> 13 <META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 14 <META http-equiv="Content-Style-Type" content="text/css"> 15 <TITLE>CRYPTO_VerifySignature</TITLE> 16 <LINK rel="stylesheet" href="../../css/nitro.css"> 17 <BASE target="main"> 18</HEAD> 19<BODY> 20<H1>CRYPTO_VerifySignature <IMG src="../../image/NTR.gif" width="23" height="12" border="0" align="middle"><IMG src="../../image/TWL.gif" width="23" height="12" border="0" align="middle"></H1> 21<H2>Syntax</H2> 22<DL> 23 <DD> 24 <PRE><CODE> 25#include <nitro/crypto/sign.h> 26 27int CRYPTO_VerifySignature( 28const void* data_ptr, 29int data_len, 30const void* sign_ptr, 31const void* mod_ptr 32); 33 </CODE></PRE> 34 </DD> 35</DL> 36<H2>Arguments</H2> 37<TABLE border="1"> 38 <TBODY> 39 <TR> 40 <TD width="25%"><EM><STRONG><CODE>data_ptr</CODE></STRONG></EM></TD> 41 <TD width="75%">Pointer to target data for digital signature verification.</TD> 42 </TR> 43 <TR> 44 <TD><EM><STRONG><CODE>data_len</CODE></STRONG></EM></TD> 45 <TD>Length of the verification data specified by data_ptr.</TD> 46 </TR> 47 <TR> 48 <TD><EM><STRONG><CODE>sign_ptr</CODE></STRONG></EM></TD> 49 <TD>Pointer to the digital signature (128 bytes).</TD> 50 </TR> 51 <TR> 52 <TD><EM><STRONG><CODE>mod_ptr</CODE></STRONG></EM></TD> 53 <TD>Pointer to the public-key modulus (128 bytes).</TD> 54 </TR> 55 </TBODY> 56</TABLE> 57<H2>Return Values</H2> 58<P> 59 Returns one of the following process results. 60</P> 61<TABLE border="1"> 62 <TBODY> 63 <TR> 64 <TD width="25%"><EM><STRONG><CODE>TRUE</CODE></STRONG></EM></TD> 65 <TD width="75%">Digital signature verification succeeded.</TD> 66 </TR> 67 <TR> 68 <TD><EM><STRONG><CODE>FALSE</CODE></STRONG></EM></TD> 69 <TD>Verification failed. Failure results if the signature and the data differ, the public key and the signature do not match, the signature format is incorrect, or the memory allocation fails.</TD> 70 </TR> 71 </TBODY> 72</TABLE> 73<H2>Description</H2> 74<P> 75 Digital signatures are used to verify whether data is correct.<BR>sign_ptr is assigned 128 bytes of signature data. The signature data uses PKCS#1 v.1.5 formatting for a 1024-bit RSA key length, hashed with the SHA-1 algorithm.<BR><CODE>mod_ptr</CODE> is a byte sequence of the 128-byte public-key modulus, arranged in order from the upper byte. <B>Note:</B> The public exponent for the public key is fixed as 65537 (0x10001). This function does not support RSA keys with a public exponent other than 65537.<BR> 76</P> 77<P> 78 Dynamically allocates memory for calculations during the call. The memory management function specified by <code><A href="../util/CRYPTO_SetMemAllocator.html">CRYPTO_SetMemAllocator()</A></code> is used. However, among the memory management functions that can be specified for this function, the memory size-changing function (the <EM><STRONG><CODE>realloc</CODE></STRONG></EM> argument) is not used. <BR>The amount of memory used varies depending on the data to verify. This is usually not a problem if 4KB is provided in advance. This function returns FALSE if memory allocation fails and NULL is passed by the memory management function. In addition, there is no correlation between the amount of memory used and data_len. 79</P> 80<P> 81 Due to licensing issues, this API will only work with the TWL. If you need to run this on a NITRO system, link and use the same function in the NITRO-Crypto package. 82</P> 83<P> 84 For detailed information on electronic signatures, see <A href="../overview/about_Signature.html">Digital Signature Overview</A>. 85</P> 86<H2>See Also</H2> 87<P> 88 <CODE><A href="CRYPTO_VerifySignatureWithHash.html">CRYPTO_VerifySignatureWithHash</A></CODE> 89</P> 90<H2>Revision History</H2> 91<P> 92 2008/03/27 Initial version. 93</P> 94<hr><p>CONFIDENTIAL</p></body> 95</HTML> 96