1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - include
3   File:     crypto/sign.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_CRYPTO_SIGN_H_
19 #define NITRO_CRYPTO_SIGN_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /*---------------------------------------------------------------------------*
26   Name:         CRYPTO_VerifySignatureWithHash
27 
28   Description:  verifies the electronic signature from the hash value
29 
30   Arguments:    hash_ptr - pointer to the hash value
31                 sign_ptr - pointer to the electronic signature
32                 mod_ptr - pointer to the public key
33   Returns:      TRUE if verified
34                 FALSE if unable to verify
35  *---------------------------------------------------------------------------*/
36 int CRYPTO_VerifySignatureWithHash(
37     const void* hash_ptr,
38     const void* sign_ptr,
39     const void* mod_ptr
40 );
41 
42 /*---------------------------------------------------------------------------*
43   Name:         CRYPTO_VerifySignature
44 
45   Description:  verifies the electronic signature from the data
46 
47   Arguments:    data_ptr - pointer to the data
48                 data_len - Data size
49                 sign_ptr - pointer to the electronic signature
50                 mod_ptr - pointer to the public key
51 
52   Returns:      TRUE if verified
53                 FALSE if unable to verify
54  *---------------------------------------------------------------------------*/
55 int CRYPTO_VerifySignature(
56     const void* data_ptr,
57     int   data_len,
58     const void* sign_ptr,
59     const void* mod_ptr
60 );
61 
62 
63 /*---------------------------------------------------------------------------*
64   Name:         CRYPTO_SIGN_GetModulus
65 
66   Description:  Returns a pointer to the public key's modulus.
67                 (The address of the returned pointer is passed to the mod_ptr argument of the following functions.
68                    CRYPTO_VerifySignature, CRYPTO_VerifySignatureWithHash )
69 
70   Arguments:    pub_ptr - Pointer to the public key
71   Returns:      Returns the address of the modulus on success.
72                 Returns NULL on failure.
73  *---------------------------------------------------------------------------*/
74 void *CRYPTO_SIGN_GetModulus(
75 	const void* pub_ptr
76 );
77 
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif //_NITRO_CRYPTO_SIGN_H_
84