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_VerifySignatureWithHash</TITLE>
16	<LINK rel="stylesheet" href="../../css/nitro.css">
17	<BASE target="main">
18</HEAD>
19<BODY>
20<H1>CRYPTO_VerifySignatureWithHash <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 &lt;nitro/crypto/sign.h&gt;
26
27int CRYPTO_VerifySignatureWithHash(
28const void* hash_ptr,
29const void* sign_ptr,
30const void* mod_ptr
31);
32		</CODE></PRE>
33	</DD>
34</DL>
35<H2>Arguments</H2>
36<TABLE border="1">
37	<TBODY>
38		<TR>
39			<TD width="25%"><EM><STRONG><CODE>hash_ptr</CODE></STRONG></EM></TD>
40			<TD width="75%">Pointer to a 20-byte SHA-1 hash value for data requiring digital signature verification.</TD>
41		</TR>
42		<TR>
43			<TD><EM><STRONG><CODE>sign_ptr</CODE></STRONG></EM></TD>
44			<TD>Pointer to the digital signature (128 bytes).</TD>
45		</TR>
46		<TR>
47			<TD><EM><STRONG><CODE>mod_ptr</CODE></STRONG></EM></TD>
48			<TD>Pointer to the public-key modulus (128 bytes).</TD>
49		</TR>
50	</TBODY>
51</TABLE>
52<H2>Return Values</H2>
53<P>
54	Returns one of the following process results.
55</P>
56<TABLE border="1">
57	<TBODY>
58		<TR>
59			<TD width="25%"><EM><STRONG><CODE>TRUE</CODE></STRONG></EM></TD>
60			<TD width="75%">Digital signature verification succeeded.</TD>
61		</TR>
62		<TR>
63			<TD><EM><STRONG><CODE>FALSE</CODE></STRONG></EM></TD>
64			<TD>Verification failed. Failure results because either the signature and the data differ, the public key and the signature do not match, or the signature format is incorrect.</TD>
65		</TR>
66	</TBODY>
67</TABLE>
68<H2>Description</H2>
69<P>
70	Digital signatures are used to verify whether data is correct.<BR>hash_ptr is assigned a pointer to a 20-byte hash value derived from an application of the SHA-1 algorithm for data requiring verification. 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>
71</P>
72<P>
73	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.
74</P>
75<P>
76	Normally, the <A href="CRYPTO_VerifySignature.html"><CODE>CRYPTO_VerifySignature</CODE></A> function is useful, which calculates the SHA-1 hash value internally. Use this function when not all of the data is available in memory, for whatever reason.
77</P>
78<P>
79	Due to licensing issues, this API will only work with the TWL. If you need to verify a signature on a NITRO system, link and use the same function in the NITRO-Crypto package.
80</P>
81<P>
82	For detailed information on electronic signatures, see <A href="../overview/about_Signature.html">Digital Signature Overview</A>.
83</P>
84<H2>See Also</H2>
85<P>
86	<CODE><A href="CRYPTO_VerifySignature.html">CRYPTO_VerifySignature</A></CODE>
87</P>
88<H2>Revision History</H2>
89<P>
90	2008/03/27 Initial version.
91</P>
92<hr><p>CONFIDENTIAL</p></body>
93</HTML>
94