Compare commits

..

6 Commits

Author SHA1 Message Date
8955a1ccf4 default up to enabled 2019-09-17 00:06:45 +08:00
16f07bfc95 allow in bootloader as well 2019-09-16 17:12:09 +08:00
0945ad264c add get_version command to hid 2019-09-16 17:00:30 +08:00
b20ca7c5f7 delete old code 2019-09-16 17:00:13 +08:00
bc73ce8d21 allow get_assertion with disabled UP 2019-09-16 16:25:58 +08:00
2051ddb180 properly check the rpId in request 2019-09-16 15:33:38 +08:00
16 changed files with 59 additions and 81 deletions

View File

@ -187,16 +187,6 @@
"contributions": [
"bug"
]
},
{
"login": "jolo1581",
"name": "Jan A.",
"avatar_url": "https://avatars1.githubusercontent.com/u/53423977?v=4",
"profile": "https://github.com/jolo1581",
"contributions": [
"code",
"doc"
]
}
],
"contributorsPerLine": 7,

View File

@ -136,7 +136,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="http://blogs.gnome.org/hughsie/"><img src="https://avatars0.githubusercontent.com/u/151380?v=4" width="100px;" alt="Richard Hughes"/><br /><sub><b>Richard Hughes</b></sub></a><br /><a href="#ideas-hughsie" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/solokeys/solo/commits?author=hughsie" title="Code">💻</a> <a href="#infra-hughsie" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#tool-hughsie" title="Tools">🔧</a></td>
<td align="center"><a href="http://www.schulz.dk"><img src="https://avatars1.githubusercontent.com/u/1150049?v=4" width="100px;" alt="Kim Schulz"/><br /><sub><b>Kim Schulz</b></sub></a><br /><a href="#business-kimusan" title="Business development">💼</a> <a href="#ideas-kimusan" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/oplik0"><img src="https://avatars2.githubusercontent.com/u/25460763?v=4" width="100px;" alt="Jakub"/><br /><sub><b>Jakub</b></sub></a><br /><a href="https://github.com/solokeys/solo/issues?q=author%3Aoplik0" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/jolo1581"><img src="https://avatars1.githubusercontent.com/u/53423977?v=4" width="100px;" alt="Jan A."/><br /><sub><b>Jan A.</b></sub></a><br /><a href="https://github.com/solokeys/solo/commits?author=jolo1581" title="Code">💻</a> <a href="https://github.com/solokeys/solo/commits?author=jolo1581" title="Documentation">📖</a></td>
</tr>
</table>
@ -170,7 +169,7 @@ You can buy Solo, Solo Tap, and Solo for Hackers at [solokeys.com](https://solok
<br/>
[![License](https://img.shields.io/github/license/solokeys/solo.svg)](https://github.com/solokeys/solo/blob/master/LICENSE)
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors)
[![Build Status](https://travis-ci.com/solokeys/solo.svg?branch=master)](https://travis-ci.com/solokeys/solo)
[![Discourse Users](https://img.shields.io/discourse/https/discourse.solokeys.com/users.svg)](https://discourse.solokeys.com)
[![Keybase Chat](https://img.shields.io/badge/chat-on%20keybase-brightgreen.svg)](https://keybase.io/team/solokeys.public)

View File

@ -1 +1 @@
2.5.3
2.5.2

View File

@ -18,7 +18,7 @@ Further progress is tracked in: <https://github.com/solokeys/solo/issues/144>.
If you still need to setup a rule, a simple way to do it is:
```
git clone https://github.com/solokeys/solo.git
git clone git@github.com:solokeys/solo.git
cd solo/udev
make setup
```

View File

@ -8,25 +8,21 @@
#include "device.h"
#include "nfc.h"
static void flush_rx(void)
static void flush_rx()
{
while(LL_SPI_IsActiveFlag_RXNE(SPI1) != 0)
{
LL_SPI_ReceiveData8(SPI1);
}
}
static void wait_for_tx(void)
static void wait_for_tx()
{
// while (LL_SPI_IsActiveFlag_BSY(SPI1) == 1)
// ;
while(LL_SPI_GetTxFIFOLevel(SPI1) != LL_SPI_TX_FIFO_EMPTY)
;
}
static void wait_for_rx(void)
static void wait_for_rx()
{
while(LL_SPI_IsActiveFlag_RXNE(SPI1) == 0)
;
@ -274,7 +270,7 @@ void ams_print_int1(uint8_t int0)
#endif
}
int ams_init(void)
int ams_init()
{
LL_GPIO_SetPinMode(SOLO_AMS_CS_PORT,SOLO_AMS_CS_PIN,LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetOutputPin(SOLO_AMS_CS_PORT,SOLO_AMS_CS_PIN);
@ -296,7 +292,7 @@ int ams_init(void)
return 0;
}
void ams_configure(void)
void ams_configure()
{
// Should not be used during passive operation.
uint8_t block[4];

View File

@ -39,8 +39,8 @@ typedef union
#define SELECT() LL_GPIO_ResetOutputPin(SOLO_AMS_CS_PORT,SOLO_AMS_CS_PIN)
#define UNSELECT() LL_GPIO_SetOutputPin(SOLO_AMS_CS_PORT,SOLO_AMS_CS_PIN)
int ams_init(void);
void ams_configure(void);
int ams_init();
void ams_configure();
void ams_read_buffer(uint8_t * data, int len);
void ams_write_buffer(uint8_t * data, int len);

View File

@ -61,13 +61,12 @@ static uint8_t master_secret[64];
static uint8_t transport_secret[32];
void crypto_sha256_init(void)
void crypto_sha256_init()
{
sha256_init(&sha256_ctx);
}
void crypto_sha512_init(void)
{
void crypto_sha512_init() {
cf_sha512_init(&sha512_ctx);
}
@ -80,7 +79,7 @@ void crypto_load_master_secret(uint8_t * key)
memmove(transport_secret, key+64, 32);
}
void crypto_reset_master_secret(void)
void crypto_reset_master_secret()
{
memset(master_secret, 0, 64);
memset(transport_secret, 0, 32);
@ -108,8 +107,7 @@ void crypto_sha256_final(uint8_t * hash)
sha256_final(&sha256_ctx, hash);
}
void crypto_sha512_final(uint8_t * hash)
{
void crypto_sha512_final(uint8_t * hash) {
// NB: there is also cf_sha512_digest
cf_sha512_digest_final(&sha512_ctx, hash);
}
@ -185,14 +183,14 @@ void crypto_sha256_hmac_final(uint8_t * key, uint32_t klen, uint8_t * hmac)
}
void crypto_ecc256_init(void)
void crypto_ecc256_init()
{
uECC_set_rng((uECC_RNG_Function)ctap_generate_rng);
_es256_curve = uECC_secp256r1();
}
void crypto_ecc256_load_attestation_key(void)
void crypto_ecc256_load_attestation_key()
{
static uint8_t _key [32];
memmove(_key, (uint8_t*)ATTESTATION_KEY_ADDR, 32);

View File

@ -34,7 +34,7 @@
#define LOW_FREQUENCY 1
#define HIGH_FREQUENCY 0
void wait_for_usb_tether(void);
void wait_for_usb_tether();
uint32_t __90_ms = 0;
@ -48,12 +48,12 @@ static bool isLowFreq = 0;
static bool _up_disabled = false;
// #define IS_BUTTON_PRESSED() (0 == (LL_GPIO_ReadInputPort(SOLO_BUTTON_PORT) & SOLO_BUTTON_PIN))
static int is_physical_button_pressed(void)
static int is_physical_button_pressed()
{
return (0 == (LL_GPIO_ReadInputPort(SOLO_BUTTON_PORT) & SOLO_BUTTON_PIN));
}
static int is_touch_button_pressed(void)
static int is_touch_button_pressed()
{
int is_pressed = (tsc_read_button(0) || tsc_read_button(1));
#ifndef IS_BOOTLOADER
@ -69,7 +69,7 @@ static int is_touch_button_pressed(void)
int (*IS_BUTTON_PRESSED)() = is_physical_button_pressed;
static void edge_detect_touch_button(void)
static void edge_detect_touch_button()
{
static uint8_t last_touch = 0;
uint8_t current_touch = 0;
@ -92,13 +92,12 @@ static void edge_detect_touch_button(void)
}
void device_disable_up(bool disable)
{
void device_disable_up(bool disable) {
_up_disabled = disable;
}
// Timer6 overflow handler. happens every ~90ms.
void TIM6_DAC_IRQHandler(void)
void TIM6_DAC_IRQHandler()
{
// timer is only 16 bits, so roll it over here
TIM6->SR = 0;
@ -143,7 +142,7 @@ void USB_IRQHandler(void)
HAL_PCD_IRQHandler(&hpcd);
}
uint32_t millis(void)
uint32_t millis()
{
return (((uint32_t)TIM6->CNT) + (__90_ms * 90));
}
@ -161,7 +160,7 @@ void device_set_status(uint32_t status)
__device_status = status;
}
int device_is_button_pressed(void)
int device_is_button_pressed()
{
return IS_BUTTON_PRESSED();
}
@ -172,13 +171,12 @@ void delay(uint32_t ms)
while ((millis() - time) < ms)
;
}
void device_reboot(void)
void device_reboot()
{
NVIC_SystemReset();
}
void device_init_button(void)
void device_init_button()
{
if (tsc_sensor_exists())
{
@ -228,12 +226,12 @@ void device_init(int argc, char *argv[])
}
int device_is_nfc(void)
int device_is_nfc()
{
return _NFC_status;
}
void wait_for_usb_tether(void)
void wait_for_usb_tether()
{
while (USBD_OK != CDC_Transmit_FS((uint8_t*)"tethered\r\n", 10) )
;
@ -244,7 +242,7 @@ void wait_for_usb_tether(void)
;
}
void usbhid_init(void)
void usbhid_init()
{
if (!isLowFreq)
{
@ -294,12 +292,12 @@ void ctaphid_write_block(uint8_t * data)
}
void usbhid_close(void)
void usbhid_close()
{
}
void main_loop_delay(void)
void main_loop_delay()
{
}
@ -309,14 +307,13 @@ static uint32_t winkt1 = 0;
#ifdef LED_WINK_VALUE
static uint32_t winkt2 = 0;
#endif
void device_wink(void)
void device_wink()
{
wink_time = 10;
winkt1 = 0;
}
void heartbeat(void)
void heartbeat()
{
static int state = 0;
static uint32_t val = (LED_MAX_SCALER - LED_MIN_SCALER)/2;
@ -385,7 +382,7 @@ void authenticator_read_backup_state(AuthenticatorState * a)
}
// Return 1 yes backup is init'd, else 0
int authenticator_is_backup_initialized(void)
int authenticator_is_backup_initialized()
{
uint8_t header[16];
uint32_t * ptr = (uint32_t *)flash_addr(STATE2_PAGE);
@ -502,7 +499,7 @@ uint32_t ctap_atomic_count(int sel)
void device_manage(void)
void device_manage()
{
#if NON_BLOCK_PRINTING
int i = 10;
@ -528,7 +525,7 @@ void device_manage(void)
#endif
}
static int handle_packets(void)
static int handle_packets()
{
static uint8_t hidmsg[HID_PACKET_SIZE];
memset(hidmsg,0, sizeof(hidmsg));
@ -564,7 +561,6 @@ static int wait_for_button_activate(uint32_t wait)
} while (!IS_BUTTON_PRESSED());
return 0;
}
static int wait_for_button_release(uint32_t wait)
{
int ret;
@ -658,7 +654,7 @@ int ctap_user_verification(uint8_t arg)
return 1;
}
void ctap_reset_rk(void)
void ctap_reset_rk()
{
int i;
printf1(TAG_GREEN, "resetting RK \r\n");
@ -668,7 +664,7 @@ void ctap_reset_rk(void)
}
}
uint32_t ctap_rk_size(void)
uint32_t ctap_rk_size()
{
return RK_NUM_PAGES * (PAGE_SIZE / sizeof(CTAP_residentKey));
}
@ -730,7 +726,7 @@ void ctap_overwrite_rk(int index,CTAP_residentKey * rk)
}
}
void boot_st_bootloader(void)
void boot_st_bootloader()
{
__disable_irq();
@ -742,7 +738,7 @@ void boot_st_bootloader(void)
;
}
void boot_solo_bootloader(void)
void boot_solo_bootloader()
{
LL_IWDG_Enable(IWDG);

View File

@ -14,12 +14,12 @@
#include "log.h"
#include "device.h"
static void flash_lock(void)
static void flash_lock()
{
FLASH->CR |= (1U<<31);
}
static void flash_unlock(void)
static void flash_unlock()
{
if (FLASH->CR & FLASH_CR_LOCK)
{

View File

@ -699,7 +699,7 @@ void SystemClock_Config_LF20(void)
SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN);
}
void init_usb(void)
void init_usb()
{
// enable USB power
SET_BIT(PWR->CR2, PWR_CR2_USV);

View File

@ -22,7 +22,7 @@
#ifndef _INIT_H_
#define _INIT_H_
void init_usb(void);
void init_usb();
void init_gpio(void);
void init_debug_uart(void);
void init_pwm(void);

View File

@ -57,11 +57,10 @@ void TIM6_DAC_IRQHandler()
__90_ms += 1;
}
uint32_t millis(void)
uint32_t millis()
{
return (((uint32_t)TIM6->CNT) + (__90_ms * 90));
}
void _Error_Handler(char *file, int line)
{
while(1)

View File

@ -359,7 +359,7 @@ static uint32_t WTX_timer;
bool WTX_process(int read_timeout);
void WTX_clear(void)
void WTX_clear()
{
WTX_sent = false;
WTX_fail = false;
@ -374,7 +374,7 @@ bool WTX_on(int WTX_time)
return true;
}
bool WTX_off(void)
bool WTX_off()
{
WTX_timer = 0;
@ -398,7 +398,7 @@ bool WTX_off(void)
return true;
}
void WTX_timer_exec(void)
void WTX_timer_exec()
{
// condition: (timer on) or (not expired[300ms])
if ((WTX_timer == 0) || WTX_timer + 300 > millis())
@ -856,7 +856,7 @@ void nfc_process_iblock(uint8_t * buf, int len)
static uint8_t ibuf[1024];
static int ibuflen = 0;
void clear_ibuf(void)
void clear_ibuf()
{
ibuflen = 0;
memset(ibuf, 0, sizeof(ibuf));
@ -969,7 +969,7 @@ void nfc_process_block(uint8_t * buf, unsigned int len)
}
}
int nfc_loop(void)
int nfc_loop()
{
uint8_t buf[32];
AMS_DEVICE ams;

View File

@ -6,9 +6,9 @@
#include "apdu.h"
// Return number of bytes read if any.
int nfc_loop(void);
int nfc_loop();
int nfc_init(void);
int nfc_init();
typedef struct
{
@ -61,6 +61,6 @@ typedef enum
APP_FIDO,
} APPLETS;
void WTX_timer_exec(void);
void WTX_timer_exec();
#endif

View File

@ -8,7 +8,7 @@
#define ELECTRODE_0 TSC_GROUP2_IO1
#define ELECTRODE_1 TSC_GROUP2_IO2
void tsc_init(void)
void tsc_init()
{
LL_GPIO_InitTypeDef GPIO_InitStruct;
// Enable TSC clock
@ -74,7 +74,7 @@ void tsc_set_electrode(uint32_t channel_ids)
TSC->IOCCR = (channel_ids);
}
void tsc_start_acq(void)
void tsc_start_acq()
{
TSC->CR &= ~(TSC_CR_START);
@ -86,7 +86,7 @@ void tsc_start_acq(void)
TSC->CR |= TSC_CR_START;
}
void tsc_wait_on_acq(void)
void tsc_wait_on_acq()
{
while ( ! (TSC->ISR & TSC_FLAG_EOA) )
;
@ -117,7 +117,7 @@ uint32_t tsc_read_button(uint32_t index)
return tsc_read(1) < 45;
}
int tsc_sensor_exists(void)
int tsc_sensor_exists()
{
static uint8_t does = 0;
if (does) return 1;

View File

@ -3,9 +3,9 @@
#include <stdint.h>
void tsc_init(void);
void tsc_init();
int tsc_sensor_exists(void);
int tsc_sensor_exists();
// Read button0 or button1
// Returns 1 if pressed, 0 if not.