move inits to device_init
This commit is contained in:
parent
120fb95541
commit
2893cd7ce3
13
fido2/ctap.c
13
fido2/ctap.c
@ -351,12 +351,12 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au
|
|||||||
|
|
||||||
device_set_status(CTAPHID_STATUS_UPNEEDED);
|
device_set_status(CTAPHID_STATUS_UPNEEDED);
|
||||||
// if NFC - not need to click a button
|
// if NFC - not need to click a button
|
||||||
int but = 1;
|
int but = 1;
|
||||||
if(!fromNFC)
|
if(!fromNFC)
|
||||||
{
|
{
|
||||||
but = ctap_user_presence_test();
|
but = ctap_user_presence_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!but)
|
if (!but)
|
||||||
{
|
{
|
||||||
return CTAP2_ERR_OPERATION_DENIED;
|
return CTAP2_ERR_OPERATION_DENIED;
|
||||||
@ -1509,7 +1509,7 @@ static void ctap_state_init()
|
|||||||
ctap_reset_rk();
|
ctap_reset_rk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctap_init()
|
void ctap_init(int init_pin)
|
||||||
{
|
{
|
||||||
crypto_ecc256_init();
|
crypto_ecc256_init();
|
||||||
|
|
||||||
@ -1564,7 +1564,10 @@ void ctap_init()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto_ecc256_make_key_pair(KEY_AGREEMENT_PUB, KEY_AGREEMENT_PRIV);
|
if (init_pin)
|
||||||
|
{
|
||||||
|
crypto_ecc256_make_key_pair(KEY_AGREEMENT_PUB, KEY_AGREEMENT_PRIV);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BRIDGE_TO_WALLET
|
#ifdef BRIDGE_TO_WALLET
|
||||||
wallet_init();
|
wallet_init();
|
||||||
|
12
fido2/ctap.h
12
fido2/ctap.h
@ -1,21 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
|
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
|
||||||
*
|
*
|
||||||
* This file is part of Solo.
|
* This file is part of Solo.
|
||||||
*
|
*
|
||||||
* Solo is free software: you can redistribute it and/or modify
|
* Solo is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Solo is distributed in the hope that it will be useful,
|
* Solo is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Solo. If not, see <https://www.gnu.org/licenses/>
|
* along with Solo. If not, see <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This code is available under licenses for commercial use.
|
* This code is available under licenses for commercial use.
|
||||||
* Please contact SoloKeys for more information.
|
* Please contact SoloKeys for more information.
|
||||||
*/
|
*/
|
||||||
@ -282,7 +282,7 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp, bool f
|
|||||||
int ctap_encode_der_sig(uint8_t * sigbuf, uint8_t * sigder);
|
int ctap_encode_der_sig(uint8_t * sigbuf, uint8_t * sigder);
|
||||||
|
|
||||||
// Run ctap related power-up procedures (init pinToken, generate shared secret)
|
// Run ctap related power-up procedures (init pinToken, generate shared secret)
|
||||||
void ctap_init();
|
void ctap_init(int init_pin);
|
||||||
|
|
||||||
// Resets state between different accesses of different applications
|
// Resets state between different accesses of different applications
|
||||||
void ctap_reset_state();
|
void ctap_reset_state();
|
||||||
|
@ -61,16 +61,8 @@ int main(int argc, char * argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
device_init();
|
device_init();
|
||||||
// printf1(TAG_GEN,"init device\n");
|
|
||||||
|
|
||||||
usbhid_init();
|
|
||||||
// printf1(TAG_GEN,"init usb\n");
|
|
||||||
|
|
||||||
ctaphid_init();
|
|
||||||
// printf1(TAG_GEN,"init ctaphid\n");
|
|
||||||
|
|
||||||
ctap_init();
|
|
||||||
// printf1(TAG_GEN,"init ctap\n");
|
|
||||||
|
|
||||||
memset(hidmsg,0,sizeof(hidmsg));
|
memset(hidmsg,0,sizeof(hidmsg));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user