mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-03 12:28:13 +00:00
chore(core): Disable wait_random() for prodtest and VCP.
[no changelog]
This commit is contained in:
parent
45a973b8f9
commit
62e3a414ad
@ -193,6 +193,7 @@ void rdi_handler(uint32_t uw_tick) {
|
|||||||
* against fault injection.
|
* against fault injection.
|
||||||
*/
|
*/
|
||||||
void wait_random(void) {
|
void wait_random(void) {
|
||||||
|
#ifndef TREZOR_PRODTEST
|
||||||
int wait = drbg_random8();
|
int wait = drbg_random8();
|
||||||
volatile int i = 0;
|
volatile int i = 0;
|
||||||
volatile int j = wait;
|
volatile int j = wait;
|
||||||
@ -207,4 +208,5 @@ void wait_random(void) {
|
|||||||
if (i != wait || j != 0) {
|
if (i != wait || j != 0) {
|
||||||
shutdown_privileged();
|
shutdown_privileged();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,6 @@ static uint8_t usb_class_setup(USBD_HandleTypeDef *dev,
|
|||||||
wait_random();
|
wait_random();
|
||||||
return usb_hid_class_setup(dev, &usb_ifaces[req->wIndex].hid, req);
|
return usb_hid_class_setup(dev, &usb_ifaces[req->wIndex].hid, req);
|
||||||
case USB_IFACE_TYPE_VCP:
|
case USB_IFACE_TYPE_VCP:
|
||||||
wait_random();
|
|
||||||
return usb_vcp_class_setup(dev, &usb_ifaces[req->wIndex].vcp, req);
|
return usb_vcp_class_setup(dev, &usb_ifaces[req->wIndex].vcp, req);
|
||||||
case USB_IFACE_TYPE_WEBUSB:
|
case USB_IFACE_TYPE_WEBUSB:
|
||||||
wait_random();
|
wait_random();
|
||||||
@ -516,7 +515,6 @@ static uint8_t usb_class_data_in(USBD_HandleTypeDef *dev, uint8_t ep_num) {
|
|||||||
usb_hid_class_data_in(dev, &usb_ifaces[i].hid, ep_num);
|
usb_hid_class_data_in(dev, &usb_ifaces[i].hid, ep_num);
|
||||||
break;
|
break;
|
||||||
case USB_IFACE_TYPE_VCP:
|
case USB_IFACE_TYPE_VCP:
|
||||||
wait_random();
|
|
||||||
usb_vcp_class_data_in(dev, &usb_ifaces[i].vcp, ep_num);
|
usb_vcp_class_data_in(dev, &usb_ifaces[i].vcp, ep_num);
|
||||||
break;
|
break;
|
||||||
case USB_IFACE_TYPE_WEBUSB:
|
case USB_IFACE_TYPE_WEBUSB:
|
||||||
@ -541,7 +539,6 @@ static uint8_t usb_class_data_out(USBD_HandleTypeDef *dev, uint8_t ep_num) {
|
|||||||
usb_hid_class_data_out(dev, &usb_ifaces[i].hid, ep_num);
|
usb_hid_class_data_out(dev, &usb_ifaces[i].hid, ep_num);
|
||||||
break;
|
break;
|
||||||
case USB_IFACE_TYPE_VCP:
|
case USB_IFACE_TYPE_VCP:
|
||||||
wait_random();
|
|
||||||
usb_vcp_class_data_out(dev, &usb_ifaces[i].vcp, ep_num);
|
usb_vcp_class_data_out(dev, &usb_ifaces[i].vcp, ep_num);
|
||||||
break;
|
break;
|
||||||
case USB_IFACE_TYPE_WEBUSB:
|
case USB_IFACE_TYPE_WEBUSB:
|
||||||
@ -559,7 +556,6 @@ static uint8_t usb_class_sof(USBD_HandleTypeDef *dev) {
|
|||||||
for (int i = 0; i < USBD_MAX_NUM_INTERFACES; i++) {
|
for (int i = 0; i < USBD_MAX_NUM_INTERFACES; i++) {
|
||||||
switch (usb_ifaces[i].type) {
|
switch (usb_ifaces[i].type) {
|
||||||
case USB_IFACE_TYPE_VCP:
|
case USB_IFACE_TYPE_VCP:
|
||||||
wait_random();
|
|
||||||
usb_vcp_class_sof(dev, &usb_ifaces[i].vcp);
|
usb_vcp_class_sof(dev, &usb_ifaces[i].vcp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user