1 #ifndef NSSL_INIT_H
2 #define NSSL_INIT_H
3 
4 /*---------------------------------------------------------------------------*
5   Project:      Nintendo SSL Client
6   File:         nssl_init.h
7   Description:  This file provides the minimum set of SSL client side APIs to use middlewares
8 
9   Copyright (C) Nintendo.  All rights reserved.
10 
11   These coded instructions, statements, and computer programs contain
12   proprietary information of Nintendo of America Inc. and/or Nintendo
13   Company Ltd., and are protected by Federal copyright law.  They may
14   not be disclosed to third parties or copied or duplicated in any form,
15   in whole or in part, without the prior written consent of Nintendo.
16 
17   *---------------------------------------------------------------------------*/
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /*---------------------------------------------------------------------------*
25  *
26  *    Globals/Externs
27  *    -- Variables/Functions --
28  *
29  *---------------------------------------------------------------------------*/
30 
31 /* Return codes */
32 #define NSSL_RVAL_OK                                   0
33 #define NSSL_RVAL_INVALID_NSSL_CTX                    -2621441
34 #define NSSL_RVAL_INVALID_CERTID                      -2621442
35 #define NSSL_RVAL_CERT_LIMIT                          -2621443
36 #define NSSL_RVAL_INVALID_NSSL_CONNECTION             -2621444
37 #define NSSL_RVAL_INVALID_CERT                        -2621445
38 #define NSSL_RVAL_ZERO_RETURN                         -2621446
39 #define NSSL_RVAL_WANT_READ                           -2621447
40 #define NSSL_RVAL_WANT_WRITE                          -2621448
41 #define NSSL_RVAL_IO_ERROR                            -2621449
42 #define NSSL_RVAL_NSSLLIB_ERROR                       -2621450
43 #define NSSL_RVAL_UNKNOWN                             -2621451
44 #define NSSL_RVAL_OUT_OF_MEMORY                       -2621452
45 #define NSSL_RVAL_INVALID_STATE                       -2621453
46 #define NSSL_RVAL_HANDSHAKE_ERROR                     -2621454
47 #define NSSL_RVAL_NO_CERT                             -2621455
48 #define NSSL_RVAL_INVALID_FD                          -2621456
49 #define NSSL_RVAL_LIB_NOT_READY                       -2621457
50 #define NSSL_RVAL_IPC_ERROR                           -2621458
51 #define NSSL_RVAL_RESOURCE_LIMIT                      -2621459
52 #define NSSL_RVAL_INVALID_HANDLE                      -2621460
53 #define NSSL_RVAL_INVALID_CERT_TYPE                   -2621461
54 #define NSSL_RVAL_INVALID_KEY_TYPE                    -2621462
55 #define NSSL_RVAL_INVALID_SIZE                        -2621463
56 #define NSSL_RVAL_NO_PEER_CERT                        -2621464
57 #define NSSL_RVAL_INSUFFICIENT_SIZE                   -2621465
58 #define NSSL_RVAL_NO_CIPHER                           -2621466
59 #define NSSL_RVAL_INVALID_ARG                         -2621467
60 #define NSSL_RVAL_INVALID_NSSL_SESSION                -2621468
61 #define NSSL_RVAL_NO_SESSION                          -2621469
62 #define NSSL_RVAL_SSL_SHUTDOWN_ERROR                  -2621470
63 #define NSSL_RVAL_CERT_SIZE_LIMIT                     -2621471
64 #define NSSL_RVAL_CERT_NO_ACCESS                      -2621472
65 #define NSSL_RVAL_INVALID_CERT_ID                     -2621473
66 #define NSSL_RVAL_CERT_READ_ERROR                     -2621474
67 #define NSSL_RVAL_CERTSTORE_INIT_FAILURE              -2621475
68 #define NSSL_RVAL_INVALID_CERT_ENCODING               -2621476
69 #define NSSL_RVAL_CERTSTORE_ERR                       -2621477
70 #define NSSL_RVAL_PVTKEY_READ_ERROR                   -2621478
71 #define NSSL_RVAL_INVALID_PVTKEY                      -2621479
72 #define NSSL_RVAL_NOT_READY                           -2621480
73 #define NSSL_RVAL_ENCRYPTION_ERROR                    -2621481
74 #define NSSL_RVAL_NO_CERTSTORE                        -2621482
75 #define NSSL_RVAL_PVTKEY_SIZE_LIMIT                   -2621483
76 #define NSSL_RVAL_PROC_MAX_EXT_CERTS                  -2621484
77 #define NSSL_RVAL_PROC_MAX_CONTEXTS                   -2621485
78 #define NSSL_RVAL_PROC_MAX_CONNECTIONS                -2621486
79 #define NSSL_RVAL_CERT_NOT_EXPORTALE                  -2621487
80 #define NSSL_RVAL_INVALID_CERT_SIZE                   -2621488
81 #define NSSL_RVAL_INVALID_KEY_SIZE                    -2621489
82 #define NSSL_RVAL_CRL_SIZE_LIMIT                      -2621490
83 #define NSSL_RVAL_INVALID_CRL                         -2621491
84 #define NSSL_RVAL_INVALID_CRL_TYPE                    -2621492
85 #define NSSL_RVAL_INVALID_CTX_MODE                    -2621493
86 
87 
88 typedef int NSSL_RVAL;
89 
90 /*---------------------------------------------------------------------------*
91  *
92  *                           PUBLIC   METHODS
93  *
94  *---------------------------------------------------------------------------*/
95 
96 /*---------------------------------------------------------------------------
97   Name:         NSSLInit()
98 
99   Description:  Initialize NSSL library
100 
101   Arguments:    None
102 
103   Returns:      NSSL_RVAL_OK on success. Appropriate error code on failure.
104 *---------------------------------------------------------------------------*/
105 NSSL_RVAL NSSLInit(void);
106 
107 /*---------------------------------------------------------------------------
108   Name:         NSSLFinish()
109 
110   Description:  Cleanup NSSL library after application has finished using it.
111 
112   Arguments:    None
113 
114   Returns:      NSSL_RVAL_OK on success. Appropriate error code on failure.
115 *---------------------------------------------------------------------------*/
116 NSSL_RVAL NSSLFinish(void);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* NSSL_INIT_H */
123