1 /*- 2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies. 3 * All rights reserved. 4 * 5 * NBMK Encryption Technologies provides no support of any kind for 6 * this software. Questions or concerns about it may be addressed to 7 * the members of the relevant open-source community at 8 * <tech-crypto@netbsd.org>. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions are 12 * met: 13 * 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 17 * 2. Redistributions in binary form must reproduce the above 18 * copyright notice, this list of conditions and the following 19 * disclaimer in the documentation and/or other materials provided 20 * with the distribution. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 /***************************************************************************** 36 * @(#) n8_pub_errors.h 1.17@(#) 37 *****************************************************************************/ 38 39 /*****************************************************************************/ 40 /** @file n8_pub_errors.h 41 * @brief Error conditions/return codes. 42 * 43 * Return codes for public API defined here. 44 * 45 *****************************************************************************/ 46 47 /***************************************************************************** 48 * Revision history: 49 * 03/10/03 brr Added error codes for API callbacks. 50 * 10/22/02 brr Added N8_INCOMPATIBLE_OPEN. 51 * 10/10/02 brr Added N8_TIMEOUT. 52 * 04/30/02 brr Added N8_API_QUEUE_FULL. 53 * 04/12/02 hml Added N8_HARDWARE_UNAVAILABLE. 54 * 04/03/02 brr Added N8_INVALID_DRIVER_VERSION. 55 * 03/28/01 hml Added N8_QUEUE_FULL. 56 * 10/30/01 dkm Added N8_INVALID_UNIT. 57 * 10/16/01 hml Added N8_QUEUE_ERROR. 58 * 10/12/01 dkm Moved to include_public directory. 59 * 09/06/01 hml Added the N8_STATUS_ATTACH_OK value. 60 * 06/30/01 arh Added documentation to N8_Status_t enumeration values and 61 * assigned specific values to each. 62 * Added N8_ALREADY_INITIALIZED. 63 * 06/14/01 bac Added N8_INVALID_VERSION. 64 * 05/30/01 mlando Added N8_VERIFICATION_FAILED, because IPSec interface changed 65 * 05/30/01 bac Removed N8_VERIFICATION_FAILED 66 * 05/11/01 bac Added N8_VERIFICATION_FAILED 67 * 04/10/01 bac Standardized by converting enums to uppercase. 68 * 03/10/01 bac Original version. 69 ****************************************************************************/ 70 71 #ifndef N8_PUB_ERRORS_H 72 #define N8_PUB_ERRORS_H 73 74 #if 0 75 #ifdef __cplusplus 76 extern "C" 77 { 78 #endif 79 #endif 80 81 /* These enumeration constants are the API error return values. 82 All user-visible API routines return a value of this type. 83 Note the following: 84 1. NO CODE, INTERNAL (i.e., written by NetOctave) OR 85 EXTERNAL, SHOULD ASSUME THAT N8_STATUS_OK = 0. 86 2. Each enumeration value should have its value 87 explicitly set, so the values can be determined 88 easily from this file. 89 3. Once defined, values should never be changed, for 90 reasons of backwards compatibility etc. 91 4. This also means if an enumeration constant is 92 ever deleted, its value should be left unused 93 and not re-assigned to a new constant. */ 94 95 typedef enum 96 { 97 N8_STATUS_OK = 0, /* The call completed successfully.*/ 98 N8_EVENT_COMPLETE = 1, /* The asynchronous event has 99 completed.*/ 100 N8_EVENT_INCOMPLETE = 2, /* The asynchronous event has not 101 completed. */ 102 N8_INVALID_INPUT_SIZE = 3, /* An input size or length parameter is 103 outside its legal value range. */ 104 N8_INVALID_OUTPUT_SIZE = 4, /* An output size or length parameter is 105 outside its required value range. */ 106 N8_INVALID_ENUM = 5, /* An input enumerated constant is not a 107 recognized value for that enumerated 108 type. */ 109 N8_INVALID_PARAMETER = 6, /* An input parameter is of the wrong 110 type. */ 111 N8_INVALID_OBJECT = 7, /* An input object is not of the right 112 type, not correctly initialized, or 113 contains bad or invalid values. */ 114 N8_INVALID_KEY = 8, /* The type or value of a key is illegal 115 for the required key. */ 116 N8_INVALID_KEY_SIZE = 9, /* The size or length of a key is 117 outside its legal value range. */ 118 N8_INVALID_PROTOCOL = 10, /* The specified communication protocol 119 is not a recognized value. */ 120 N8_INVALID_CIPHER = 11, /* The specified cipher/encryption 121 algorithm is not a recognized 122 value. */ 123 N8_INVALID_HASH = 12, /* The specified hash algorithm is not 124 a recognized/supported value. */ 125 N8_INVALID_VALUE = 13, /* A specified parameter has a value 126 that is not legal. */ 127 N8_INVALID_VERSION = 14, /* The version number in an SSL or 128 TLS version is not a supported 129 version. */ 130 N8_INCONSISTENT = 15, /* An input argument's internal state 131 is inconsistent, or the values of two 132 or more input parameters are 133 inconsistent with one another. */ 134 N8_NOT_INITIALIZED = 16, /* A required resource or input object 135 has not been properly initialized. */ 136 N8_UNALLOCATED_CONTEXT = 17, /* The specified context entry is not 137 allocated and cannot be used in this 138 call. */ 139 N8_NO_MORE_RESOURCE = 18, /* The call failed due to exhaustion of 140 a required resource. */ 141 N8_HARDWARE_ERROR = 19, /* The hardware has detected an error. 142 It may be an inconsistency with the 143 operands (e.g. they are not relatively 144 prime), a timing issue, or other 145 problem. It DOES NOT indicate that 146 the hardware is actually faulty. */ 147 N8_UNEXPECTED_ERROR = 20, /* Some other unexpected, unrecognized 148 error has occurred. */ 149 N8_UNIMPLEMENTED_FUNCTION = 21, /* The called interface is not 150 implemented in this release. */ 151 N8_MALLOC_FAILED = 22, /* An internal memory allocation 152 operation failed. */ 153 N8_WEAK_KEY = 23, /* A cryptographically unsecure key 154 was provided. */ 155 N8_VERIFICATION_FAILED = 24, /* The MAC computed from a received SSL, 156 TLS, or IPSec packet did not equal 157 the MAC contained in the packet. */ 158 N8_ALREADY_INITIALIZED = 25, /* An attempt has been made to 159 initialize an already initialized 160 resource. */ 161 N8_FILE_ERROR = 26, /* A file I/O error occurred trying 162 to open or read a file. */ 163 N8_STATUS_ATTACH_OK = 27, /* A shared resource was successfully 164 attached to (not created) */ 165 N8_QUEUE_ERROR = 28, /* A queueing error occurred when 166 posting an operation to the QMgr */ 167 N8_INVALID_UNIT = 29, /* The specified unit is out of range 168 of valid or available unit values.*/ 169 N8_UNALIGNED_ADDRESS = 30, /* The passed address is not 32-bit 170 aligned */ 171 N8_QUEUE_FULL = 31, /* Posting an operation to the QMgr 172 failed because the cmd queue is full. */ 173 N8_INVALID_DRIVER_VERSION = 32, /* The SDK library is not compatible 174 with the installed driver. */ 175 N8_HARDWARE_UNAVAILABLE = 33, /* No NetOctave Hardware is available 176 or the driver is not loaded or the 177 driver has malfunctioned. */ 178 N8_API_QUEUE_FULL = 34, /* Posting an operation to the QMgr 179 failed because the API queue is full. */ 180 N8_RNG_QUEUE_EMPTY = 35, /* The RNG queue did not have a sufficient 181 number of bytes available to honor the 182 RNG request. */ 183 N8_TIMEOUT = 36, /* The operation has timed out. */ 184 N8_INCOMPATIBLE_OPEN = 37, /* The driver has been opened to */ 185 /* perform a different operation */ 186 /* & must be restarted. */ 187 N8_EVENT_ALLOC_FAILED = 38, /* The allocation of the event array */ 188 /* failed. */ 189 N8_THREAD_INIT_FAILED = 39, /* The callback thread could not be */ 190 /* intiialized. */ 191 N8_EVENT_QUEUE_FULL = 40 /* The event array is full. */ 192 193 } N8_Status_t; 194 195 #if 0 196 #ifdef __cplusplus 197 } 198 #endif 199 #endif 200 201 #endif /* N8_PUB_ERRORS_H */ 202 203