Chameleon-Mini
DESFireStatusCodes.h
1 /*
2 The DESFire stack portion of this firmware source
3 is free software written by Maxie Dion Schmidt (@maxieds):
4 You can redistribute it and/or modify
5 it under the terms of this license.
6 
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 
11 The complete source distribution of
12 this firmware is available at the following link:
13 https://github.com/maxieds/ChameleonMiniFirmwareDESFireStack.
14 
15 Based in part on the original DESFire code created by
16 @dev-zzo (GitHub handle) [Dmitry Janushkevich] available at
17 https://github.com/dev-zzo/ChameleonMini/tree/desfire.
18 
19 This notice must be retained at the top of all source files where indicated.
20 */
21 
22 /*
23  * DESFireStatusCodes.h
24  * Maxie D. Schmidt (github.com/maxieds)
25  */
26 
27 #ifndef __DESFIRE_STATUS_CODES_H__
28 #define __DESFIRE_STATUS_CODES_H__
29 
30 #include "DESFireFirmwareSettings.h"
31 
32 extern BYTE FRAME_CONTINUE[];
33 extern BYTE OPERATION_OK[];
34 extern BYTE OK[];
35 extern BYTE INIT[];
36 
37 #define DESFIRE_STATUS_RESPONSE_SIZE 1
38 
39 // NOTE: See p. 72 of the datasheet for descriptions of these response codes:
40 typedef enum DESFIRE_FIRMWARE_ENUM_PACKING {
41  STATUS_OPERATION_OK = 0x00,
42  STATUS_NO_CHANGES = 0x0C,
43  STATUS_OUT_OF_EEPROM_ERROR = 0x0E,
44  STATUS_ILLEGAL_COMMAND_CODE = 0x1C,
45  STATUS_INTEGRITY_ERROR = 0x1E,
46  STATUS_NO_SUCH_KEY = 0x40,
47  STATUS_LENGTH_ERROR = 0x7E,
48  STATUS_PERMISSION_DENIED = 0x9D,
49  STATUS_PARAMETER_ERROR = 0x9E,
50  STATUS_APP_NOT_FOUND = 0xA0,
51  STATUS_APP_INTEGRITY_ERROR = 0xA1,
52  STATUS_AUTHENTICATION_ERROR = 0xAE,
53  STATUS_ADDITIONAL_FRAME = 0xAF,
54  STATUS_BOUNDARY_ERROR = 0xBE,
55  STATUS_COMMAND_ABORTED = 0xCA,
56  STATUS_APP_COUNT_ERROR = 0xCE,
57  STATUS_DUPLICATE_ERROR = 0xDE,
58  STATUS_EEPROM_ERROR = 0xEE,
59  STATUS_FILE_NOT_FOUND = 0xF0,
60  STATUS_PICC_INTEGRITY_ERROR = 0xC1,
61  STATUS_WRONG_VALUE_ERROR = 0x6E,
62 } DesfireStatusCodeType;
63 
64 #define SW_NO_ERROR ((uint16_t) 0x9000)
65 #define SW_BYTES_REMAINING_00 ((uint16_t) 0x6100)
66 #define SW_WRONG_LENGTH ((uint16_t) 0x6700)
67 #define SW_SECURITY_STATUS_NOT_SATISFIED ((uint16_t) 0x6982)
68 #define SW_FILE_INVALID ((uint16_t) 0x6983)
69 #define SW_DATA_INVALID ((uint16_t) 0x6984;
70 #define SW_CONDITIONS_NOT_SATISFIED ((uint16_t) 0x6985)
71 #define SW_COMMAND_NOT_ALLOWED ((uint16_t) 0x6986)
72 #define SW_APPLET_SELECT_FAILED ((uint16_t) 0x6999)
73 #define SW_WRONG_DATA ((uint16_t) 0x6a80)
74 #define SW_FUNC_NOT_SUPPORTED ((uint16_t) 0x6a81)
75 #define SW_FILE_NOT_FOUND ((uint16_t) 0x6a82)
76 #define SW_RECORD_NOT_FOUND ((uint16_t) 0x6a83)
77 #define SW_INCORRECT_P1P2 ((uint16_t) 0x6a86)
78 #define SW_WRONG_P1P2 ((uint16_t) 0x6b00)
79 #define SW_CORRECT_LENGTH_00 ((uint16_t) 0x6c00)
80 #define SW_INS_NOT_SUPPORTED ((uint16_t) 0x6d00)
81 #define SW_CLA_NOT_SUPPORTED ((uint16_t) 0x6e00)
82 #define SW_UNKNOWN ((uint16_t) 0x6f00)
83 #define SW_FILE_FULL ((uint16_t) 0x6a84)
84 #define SW_LOGICAL_CHANNEL_NOT_SUPPORTED ((uint16_t) 0x6881)
85 #define SW_SECURE_MESSAGING_NOT_SUPPORTED ((uint16_t) 0x6882)
86 #define SW_WARNING_STATE_UNCHANGED ((uint16_t) 0x6200)
87 #define SW_REFERENCE_DATA_NOT_FOUND ((uint16_t) 0x6a88)
88 #define SW_INTERNAL_ERROR ((uint16_t) 0x6d66)
89 
90 #endif