• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2   # Copyright 2016-2017 Intel Corporation
3   #
4   # Licensed under the Apache License, Version 2.0 (the "License");
5   # you may not use this file except in compliance with the License.
6   # You may obtain a copy of the License at
7   #
8   #     http://www.apache.org/licenses/LICENSE-2.0
9   #
10   # Unless required by applicable law or agreed to in writing, software
11   # distributed under the License is distributed on an "AS IS" BASIS,
12   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   # See the License for the specific language governing permissions and
14   # limitations under the License.
15   ############################################################################*/
16 #ifndef EPID_COMMON_ERRORS_H_
17 #define EPID_COMMON_ERRORS_H_
18 /*!
19  * \file
20  * \brief Error reporting.
21 */
22 
23 /// Error reporting interface.
24 /*!
25  \defgroup ErrorCodes errors
26  This module defines the return status type. It also provides tools for
27  interactions with status values, such as converting them to a string.
28 
29  \ingroup EpidCommon
30   @{
31 */
32 
33 /// Return status for SDK functions.
34 /*!
35   Convention for status values is as follows:
36   - Zero indicates "success"
37   - Any positive number indicates "success with status"
38   - Any negative number indicates "failure"
39 */
40 typedef enum {
41   kEpidNoErr = 0,                   //!< no error
42   kEpidSigValid = 0,                //!< Signature is valid
43   kEpidSigInvalid = 1,              //!< Signature is invalid
44   kEpidSigRevokedInGroupRl = 2,     //!< Signature revoked in GroupRl
45   kEpidSigRevokedInPrivRl = 3,      //!< Signature revoked in PrivRl
46   kEpidSigRevokedInSigRl = 4,       //!< Signature revoked in SigRl
47   kEpidSigRevokedInVerifierRl = 5,  //!< Signature revoked in VerifierRl
48   kEpidErr = -999,                  //!< unspecified error
49   kEpidNotImpl,                     //!< not implemented error
50   kEpidBadArgErr,                   //!< incorrect arg to function
51   kEpidNoMemErr,                    //!< not enough memory for the operation
52   kEpidMemAllocErr,   //!< insufficient memory allocated for operation
53   kEpidMathErr,       //!< internal math error
54   kEpidDivByZeroErr,  //!< an attempt to divide by zero
55   kEpidUnderflowErr,  //!< a value became less than minimum supported level
56   kEpidHashAlgorithmNotSupported,  //!< unsupported hash algorithm type
57   kEpidRandMaxIterErr,  //!< reached max iteration for random number generation
58   kEpidDuplicateErr,    //!< argument would add duplicate entry
59   kEpidInconsistentBasenameSetErr,    //!< set basename conflicts with arguments
60   kEpidMathQuadraticNonResidueError,  //!< quadratic Non-Residue Error
61   kEpidOutOfSequenceError,  //!< operation was performed out of sequence
62 } EpidStatus;
63 
64 /// Returns string representation of error code.
65 /*!
66  \param e
67  The status value.
68 
69  \returns The string describing the status.
70 */
71 char const* EpidStatusToString(EpidStatus e);
72 
73 /*! @} */
74 #endif  // EPID_COMMON_ERRORS_H_
75