#include <types.h>
Go to the source code of this file.
Defines | |
#define | AUTH_FLAG_PIN 0x01 |
Flag for authstate signalling a successful PIN verification. More... | |
#define | AUTH_FLAG_KEY 0x02 |
Flag for authstate signalling a successful external authentication or key verification. More... | |
#define | AUTH_AC_ALW 0x0 |
Access Condition: Always. More... | |
#define | AUTH_AC_PIN 0x1 |
Access Condition: PIN. More... | |
#define | AUTH_AC_ADM 0x2 |
Access Condition: Key. More... | |
#define | AUTH_AC_POA 0x3 |
Access Condition: PIN or Key. More... | |
#define | AUTH_AC_PAA 0x4 |
Access Condition: PIN and Key. More... | |
#define | AUTH_AC_NEV 0xF |
Access Condition: Never. More... | |
#define | PIN_MAX_RETRIES 3 |
Default max. retries for PIN. More... | |
#define | PUK_MAX_RETRIES 10 |
Default max. retries for PUK. More... | |
#define | PIN_TYPE_PIN 0 |
PIN type: PIN. More... | |
#define | PIN_TYPE_PUK 1 |
PIN type: PUK. More... | |
#define | PIN_TYPE_EXT 2 |
PIN type: Key for external authentication. More... | |
#define | PIN_TYPE_INT 3 |
PIN type: Key for internal authentication. More... | |
#define | KEY_MAX_RETRIES 10 |
Default max. retries for keys. More... | |
#define | AUTH_FID_EXTAUTH 0xFF00 |
FID for file with external authentication key. More... | |
#define | AUTH_FID_INTAUTH 0xFF01 |
FID for file with internal authentication key. More... | |
#define | AUTH_FID_PINPUK 0xFF02 |
FID for file with PIN and PUK. More... | |
Functions | |
bool | auth_init (void) |
Initialize authentication variables. More... | |
bool | auth_checkAc (iu8 ac) |
Check fullfillment of access condition. More... | |
bool | auth_getCheckPinLen (iu8 pintype, iu8 pinlen, iu16 *addr, iu8 *len, iu16 *rcaddr, iu8 *maxret) |
Verifies length of PIN and returns addresses of PIN in EEPROM. More... | |
bool | auth_setPin (iu8 pintype, iu8 *pin, iu8 pinlen) |
Write PIN, PUK, External Authentication key or Internal Authentication key. More... | |
bool | auth_verifyPin (iu8 pintype, iu8 *pin, iu8 pinlen) |
Verifies PIN, PUK or External Authentication key and sets flags in authstate. More... | |
bool | auth_getChallenge (iu8 *dst, iu8 rndlen) |
Returns 8 byte challenge for External Authentication. More... | |
bool | auth_createVerifyCryptogram (iu8 *cry, iu8 crylen, bool create, bool enc) |
Encrypt or decrypt challenge or verify cryptogram. More... | |
Variables | |
iu8 | challvalidity |
Validity of challenge. More... |
Here are the declarations and definitions for the authentication functions. The authentication types supported are:
|
Access Condition: Key.
|
|
Access Condition: Always.
|
|
Access Condition: Never.
|
|
Access Condition: PIN and Key.
|
|
Access Condition: PIN.
|
|
Access Condition: PIN or Key.
|
|
FID for file with external authentication key. It is only searched for the file in the MF and not in any DF. |
|
FID for file with internal authentication key. It is only searched for the file in the MF and not in any DF. |
|
FID for file with PIN and PUK. It is only searched for the file in the MF and not in any DF. |
|
Flag for authstate signalling a successful external authentication or key verification.
|
|
Flag for authstate signalling a successful PIN verification.
|
|
Default max. retries for keys.
|
|
Default max. retries for PIN.
|
|
PIN type: Key for external authentication.
|
|
PIN type: Key for internal authentication.
|
|
PIN type: PIN.
|
|
PIN type: PUK.
|
|
Default max. retries for PUK.
|
|
Check fullfillment of access condition. This function checks, if the current setting of authstate fullfills the condition specified with ac.
|
|
Encrypt or decrypt challenge or verify cryptogram. To include the decryption process CONF_WITH_DECRYPT must be set to 1.
|
|
Returns 8 byte challenge for External Authentication. The challenge is also written to the challenge array and challvalidity is set to 2.
|
|
Verifies length of PIN and returns addresses of PIN in EEPROM. This functions does depending on pintype:
|
|
Initialize authentication variables. This function resets authstate and challvalidity. It must be called after reset.
|
|
Write PIN, PUK, External Authentication key or Internal Authentication key. The process is secured by transactions.
|
|
Verifies PIN, PUK or External Authentication key and sets flags in authstate. The update of the retry counter is secured by transactions. Warning: Currently the retry counter is not handled in a secure way. For more information see e.g. Rankl/Effing.
|
|
Validity of challenge. The initial value if challvalidity is 2. This is decremented at the start of the command loop, so that it is 1 at the command following a Get Challenge. |