mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-20 04:54:45 -07:00
[FL-3835] Ultralight C authentication with des key (#3720)
* Update api_symbols.csv * Ultralight C 3des implementation added * Access check for Ultralight cards is now splitted into 2 functions one for ULC card and another for common * Ultralight C authentication command handlers added * Update api_symbols.csv and api_symbols.csv * Length added to ultralight encrypt function * New structure for storing 3des key added * Reseting of 3des_key added * des_context init/deinit added to poller * New poller step for ultralight c auth added * Added ultralight c des key to application * Renamed felica unlock scenes to more generic des auth scenes, because they are now used also for ultralight c * Show different menus for different ultralight card types * Update api_symbols.csv and api_symbols.csv * Some macro defines added * Different amount of pages will be now read for ultralight C and others * New unit test for ultralight C * Some comments and macro replacements * New function added to api * Now all data read checks mfulC separately * Adjusted listener to handle missing 3des_key properly * Now poller populates 3des_key after reading with auth to card data * Nfc: rename _3des_key to tdes_key * Bump API Symbols * Mute PVS Warnings Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -42,6 +42,7 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
MfUltralightAuthPassword password; /**< Password to be used for authentication. */
|
||||
MfUltralightC3DesAuthKey tdes_key;
|
||||
MfUltralightAuthPack pack; /**< Pack received on successfull authentication. */
|
||||
bool auth_success; /**< Set to true if authentication succeeded, false otherwise. */
|
||||
bool skip_auth; /**< Set to true if authentication should be skipped, false otherwise. */
|
||||
@@ -85,12 +86,33 @@ MfUltralightError mf_ultralight_poller_auth_pwd(
|
||||
*
|
||||
* Must ONLY be used inside the callback function.
|
||||
*
|
||||
* This function now is used only to identify Mf Ultralight C cards.
|
||||
* This function is used to start authentication process for Ultralight C cards.
|
||||
*
|
||||
* @param[in, out] instance pointer to the instance to be used in the transaction.
|
||||
* @param[in] RndA Randomly generated block which is required for authentication process.
|
||||
* @param[out] output Authentication encryption result.
|
||||
* @return MfUltralightErrorNone if card supports authentication command, an error code on otherwise.
|
||||
*/
|
||||
MfUltralightError mf_ultralight_poller_authenticate(MfUltralightPoller* instance);
|
||||
MfUltralightError mf_ultralight_poller_authenticate_start(
|
||||
MfUltralightPoller* instance,
|
||||
const uint8_t* RndA,
|
||||
uint8_t* output);
|
||||
|
||||
/**
|
||||
* @brief End authentication procedure
|
||||
*
|
||||
* This function is used to end authentication process for Ultralight C cards.
|
||||
*
|
||||
* @param[in, out] instance pointer to the instance to be used in the transaction.
|
||||
* @param[in] RndB Block received from the card (card generates it randomly) which is required for authentication process.
|
||||
* @param[in] request Contains data of RndA + RndB', where RndB' is decoded and shifted RndB received from the card on previous step.
|
||||
* @param[out] response Must return RndA' which an encrypted shifted RndA value received from the card and decrypted by this function.
|
||||
*/
|
||||
MfUltralightError mf_ultralight_poller_authenticate_end(
|
||||
MfUltralightPoller* instance,
|
||||
const uint8_t* RndB,
|
||||
const uint8_t* request,
|
||||
uint8_t* response);
|
||||
|
||||
/**
|
||||
* @brief Read page from card.
|
||||
|
||||
Reference in New Issue
Block a user