WO2020169997A1 - Method for improving safety of a component or system running a firmware or a finite state machine - Google Patents

Method for improving safety of a component or system running a firmware or a finite state machine Download PDF

Info

Publication number
WO2020169997A1
WO2020169997A1 PCT/IB2019/000089 IB2019000089W WO2020169997A1 WO 2020169997 A1 WO2020169997 A1 WO 2020169997A1 IB 2019000089 W IB2019000089 W IB 2019000089W WO 2020169997 A1 WO2020169997 A1 WO 2020169997A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
firmware
watchpoint
state machine
finite state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/IB2019/000089
Other languages
French (fr)
Inventor
Alberto TROIA
Antonino Mondello
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Micron Technology Inc
Original Assignee
Micron Technology Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Micron Technology Inc filed Critical Micron Technology Inc
Priority to US16/624,070 priority Critical patent/US11477030B2/en
Priority to PCT/IB2019/000089 priority patent/WO2020169997A1/en
Priority to CN201980092384.5A priority patent/CN113474772B/en
Publication of WO2020169997A1 publication Critical patent/WO2020169997A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/30—Monitoring
    • G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3013—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is an embedded system, i.e. a combination of hardware and software dedicated to perform a certain function in mobile devices, printers, automotive or aircraft systems
    • H—ELECTRICITY
    • H04—ELECTRIC COMMUNICATION TECHNIQUE
    • H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0736—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751—Error or fault detection not based on redundancy
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/30—Monitoring
    • G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/30—Monitoring
    • G06F11/3058—Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/30—Monitoring
    • G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/36—Prevention of errors by analysis, debugging or testing of software
    • G06F11/3604—Analysis of software for verifying properties of programs
    • G06F11/3612—Analysis of software for verifying properties of programs by runtime analysis
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/572—Secure firmware programming, e.g. of basic input output system [BIOS]
    • H—ELECTRICITY
    • H04—ELECTRIC COMMUNICATION TECHNIQUE
    • H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/03—Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
    • G06F2221/033—Test or assess software
    • H—ELECTRICITY
    • H04—ELECTRIC COMMUNICATION TECHNIQUE
    • H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present disclosure relates generally to components or systems running a firmware or a finite state machine that implements the responses of certain internal or external events, in particular in vehicles, and more particularly to a method for improving safety of such components or systems. Even more particularly, the present disclosure relates to a method for evaluating a firmware or a finite state machine to improve safety of a component or system running the same by avoiding the triggering of wrong or inconsistent instructions leading to potentially dangerous situations.
  • a task of a component or a system can be executed by running a firmware or a finite state machine, that implements the responses of certain internal events, tied to the working of the component or system, or external events, in particular gathered by sensors.
  • motor vehicles such as autonomous and/or non- autonomous vehicles (e.g., automobiles, cars, trucks, buses, etc.)
  • sensors can nowadays use sensors, cameras, and communication means to obtain information about their surroundings.
  • sensors are used in many other fields, such as in airplanes or in plants comprising one or more machinery managed by a control system.
  • a specific temperature can be sensed in order to ensure that a threshold value is attained before using a function or component or to end such a use.
  • a component or a system can execute one or more task by using: - a firmware, in the form of a program in a high level language, such as C++ and/or other custom languages, being compiled to obtain an assembly code executed by a microprocessor; or
  • FSM finite state machine
  • an autonomous vehicle can be a driverless vehicle, a computerized system managing the entire working of the vehicle and the safe and correct running of its firmware /finite state machine being of the utmost importance.
  • Figure 1 shows a block diagram of a firmware implementing a method in accordance with an embodiment of the present disclosure
  • Figure 2 shows a portion of a routine of the firmware of Figure 1 as modified by the method in accordance with an embodiment of the present disclosure
  • Figure 3A and 3B show block diagrams of a finite state machine implementing the method in accordance with an embodiment of the present disclosure
  • Figure 4 shows a block diagram of the finite state machine of figure 3A showing a path being analyzed with the method in accordance with an embodiment of the present disclosure
  • Figure 5 shows a block diagram of a finite state machine including a sub-finite state machine implementing the method in accordance with an embodiment of the present disclosure
  • Figure 6A and 6B show methods in accordance with embodiments of the present disclosure
  • Figure 7A shows an apparatus, namely a vehicle, comprising a component or system running a firmware or a finite state machine implementing a method in accordance with an embodiment of the present disclosure
  • Figure 7B shows a block diagram of the apparatus of Figure 7 A and of the component or system comprised therein.
  • the proposed method is aimed to avoid the triggering of wrong or inconsistent signals leading to potentially dangerous situations by detecting anomalous sequences of routines or states in a firmware or in a finite state machine during their execution.
  • An example method includes the steps of:
  • the significative instructions or states may be begin /end instructions of routines of the firmware or specific executions states of the finite state machine.
  • the HASH function may be the cryptographic HASH function or Secure Hash Algorithm SHA-256.
  • Another example method according to the present disclosure comprises the steps of:
  • Another example method according to the present disclosure comprises the steps of:
  • the present disclosure also relates to a simple component or a more complex system, generally indicated as component implementing the above method.
  • the component implementing the above method may comprise:
  • the disclosure further relates to an apparatus comprising:
  • the component including:
  • the method can be used for enhancing the safety of a component or a system using a firmware or a finite state machine (FSM) indifferently.
  • FSM finite state machine
  • the method essentially provides for individuating significative instruction/ states in a firmware / finite state machine and associating the same with respective watchpoints, then using a HASH function to evaluate a correctness of different sequences of instruction/ states during the running of the firmware/finite state machine.
  • the method provides for verifying if an instruction/ state following a current instruction/ state is among a plurality of correct instructions/states on the basis of the original programming of the corresponding firmware / finite state machine, the correct instructions/ states that could follow each instruction/ state of the firmware / finite state machine being previously stored.
  • firmware or finite state machine is used in an apparatus being a vehicle, such as a private vehicle or also a vehicle intended to transport people and/or goods
  • the present disclosure is not limited thereto and can be also used in other environments or apparatuses, such as in an airplane or in a control system of a plant, such as, for example, a car factory, a chemical plant, a power plant or any other type of factory.
  • a finite state machine essentially comprises a plurality of states, each state being executed following a transition from a previous state.
  • a firmware essentially comprises a plurality of routines and corresponding instructions to begin/end them. In this way, it is clear that the states of a finite state machine could be considered as equivalent to the instructions to begin/ end a routine of a firmware.
  • SEUs Single Event Upsets
  • MEUs Multiple Event Upsets
  • vent upset it is indicated herein any kind of internal or external action or unwanted /unforecastd event leading to unwanted instructions within a routine of a firmware or transitions between states of a finite state machine.
  • event upsets can occur for instance when a vehicle runs in the vicinity of a generator of electrical noise, such as a radio station plant or high voltage air cables.
  • Event upsets can also be caused, for instance, by the malfunctioning of a single device in the component/ system or by an erroneous string of commands provided by a user or also by an attempt of hacking the component /system, usually involving fraudulently changing of the power supplies values. In a general way, event upsets can be accidentally or purposely provoked.
  • an event upset could deviate the correct working of a firmware, in term of sequences of routines, or of a finite state machine, in term of transitions between states, from their original and correct programming, such a deviation being for instance a jump into a routine / state that is not one among the possible correct routines/ states that can follow a current one according to the working established a priori for the firmware or finite state machine, such an unforeseen routine/ state leading to a malfunctioning of the firmware or finite state machine and thus of the component or system comprising it.
  • the integrity tests are performed: during the upgrading of the firmware or finite state machine;
  • the method according to the present disclosure detects bad firmware or finite state machine behaviors by evaluating the firmware or finite state machine structure or diagram and in particular the different routines and instructions or states and transitions composing the same in order to select specific instructions/ states wherein inserting corresponding watchpoints to be checked during the running of the firmware or finite state machine.
  • the method comprises a preliminary step of evaluating the firmware or finite state machine structure decomposing the same into a plurality of states /routines and instructions and selecting a plurality of significant instructions/ states of interest. For instance, inside a firmware, the begin/end instructions of the routines could be selected as significative instructions, while in a finite state machine, specific executions states could be selected as significative states.
  • the method then comprises a step of associating a watchpoint to each of the selected significative instructions/ states.
  • the method according to the present disclosure provides for calculating a HASH value corresponding to each watchpoint by means of a HASH function.
  • a HASH function is a function that is used to map data of arbitrary size into data of a fixed size, returning values being called HASH values. More particularly, a HASH function always provides a result value, also indicated as digest, of a fixed length, starting from an initial data or message of variable length. Moreover, HASH functions are usually not reversible, so that an original data or value cannot be retrieved by the HASH value alone. [0047] It is also not possible to create two different HASH results having a same value starting from different inputs. In this sense, the HASH functions are claimed as having no collisions, also indicated as HASH collision.
  • the method comprises a first step of calculating first HASH values of all the watchpoints of the firmware or finite state machine before running the same, herein also indicated as initial HASH values or Golden HASH values or G-HASH values, indifferently.
  • the HASH value of each watchpoint is calculated so as to depend only from an allowable path in the firmware or finite state machine, so tracking the correct execution flow of the firmware or finite state machine.
  • the different paths between the routines/ states comprising an unknown length of branches, loops, i.e. analog timings, user inputs, and others, are providing a unique HASH value.
  • the method allows to avoid branch track collisions during the execution of the instructions/ states comprised in a corresponding path within the firmware or finite state machine, a fixed size value being calculated for each end point.
  • the HASH functions provide HASH values having a fixed size being known a priori and allow to associate even very long path to a unique HASH value of a fixed size, indeed. In other words, independently from the length of the processed data, the HASH function always output a fixed size result value.
  • the method exploits a cryptographic HASH functions, more particularly a Secure Hash Algorithm, or SHA.
  • SHAs are cryptographic HASH functions published by the National Institute of Standards and Technology (NIST) as a U.S. Federal Information Processing Standard (FIPS), the list of allowed HASH functions being regularly updated, while keeping the same size.
  • the SHA-256 is used, providing HASH values having a size of the 32Bytes and having not shown any collision from its conception up to now.
  • the first step of calculating the first or G-HASH values is performed for a firmware during a compiling phase and for a finite state machine during a synthesis phase, i.e. according to an original programming of the same, the first or G-HASH values corresponding to all the possible allowable paths to reach an end point of the firmware or finite state machine from a defined starting point.
  • the first or G-HASH values map the correct paths allowed for the firmware or finite state machine before running them in a component/ system, more particularly, the first or G-HASH values form a tree wherein the watchpoints are connected one another in a correct manner.
  • the tree of first or G-HASH values in particular shows all possible watchpoints (i.e. the correct ones) that could follow a selected watchpoint, being considered as a starting point, on the basis of the correct working programmed for the firmware or finite state machine under examination.
  • the method also comprises a step of storing the set of first or G-HASH values as calculated.
  • a database of possible allowable HASH values is generated, being the values that can appear during the runtime of the firmware or finite state machine under examination.
  • the first of G-HASG values are stored in a permanent way in the corresponding component / system implementing the method. In fact, such first or G-HASH values are changed only when a new firmware or finite state machine is compiled and sent for update.
  • the method comprises a second step of calculating second HASH values of each watchpoint during the execution of the firmware or finite state machine using a same HASH function; the second HASH values are herein also indicated as Executable HASH or E-HASH values.
  • the method then comprises a step of comparing the set of first HASH values as stored and the second HASH values as calculated, in particular the G- HASH and E-HASH values respectively, the presence of a second or E-HASH value as calculated in the stored set of first or G-HASH values indicating a correct execution of the firmware or finite state machine under evaluation, the method then validating the corresponding instruction or state as correct.
  • Such a comparison is usually made starting from the first watchpoint in the runtime, while it can start from any watchpoint in the debug and/or validation procedures of the firmware or a finite state machine.
  • the method further comprises a step of calculating cumulated HASH values, also indicated as FT_HASH, of a sequence of instructions/ routines or transitions/ states by linking the HASH value of a watchpoint under examination (watchpoint WP#i) to the HASH value of the previous watchpoints according to the following formula:
  • FT_HASH k HASH[FT_HASH k -i
  • HASH HASH (watchpoint WP#0), being watchpoint WP#0 the starting point of a chain of watchpoints under examination, the cumulated HASH value being thus calculated by applying the HASH function at each step of the routines of a firmware or at each transition between states of a finite state machine.
  • a current or E-HASH value of an end watchpoint of the chain would thus correspond to the last cumulated FT_HASH as calculated following such a chain.
  • the information relating to a watchpoint in a chain of the tree of watchpoints forming the firmware or finite state machine is linked to the information of the watchpoint being upstream in the chain through the cumulated FT_HASH as calculated, such link being made by the HASH function so as to always obtain a result with a fixed size known a priori.
  • the cumulated FTJHASH contains the history of steps to reach at a certain instruction/state of the firmware or finite state machine under examination.
  • the method further comprises a step of storing the different cumulated HASH values as calculated for each watchpoint being examined.
  • the method may also comprise a step of outputting the result of the comparison step between the G-HASH and E-HASH values for indicating a wrong or potentially dangerous sequence of instructions or states for the firmware or finite state machine under examination.
  • the method may output a warning signal for a hypervisor or a user or for internal handling of the sequence of instructions or states of the firmware or finite state machine under examination.
  • the HASH value of a watchpoint is calculated by using the program counter value of the corresponding instruction for a firmware or the status for a finite state machine.
  • FIG 1 is a block diagram of the structure of an example firmware 10 implementing the method according to an embodiment of the present disclosure.
  • the firmware 10 can be used, for instance, in an autonomous vehicle, a traditional non-autonomous vehicle, an emergency vehicle, a service vehicle, or the like. As already indicated, the firmware 10 can be used, for instance, in an airplane or in a plant comprising one or more machinery.
  • the firmware 10 comprises at least a starting point PI, indicated also as Start and an ending point PE, indicated also as End, as well as a plurality of routines R0...Rn interconnected by means of corresponding instructions.
  • the routines R0...Rn can be analog routines, such as the first routine R0 in the figure, digital routines, such as the second routine R1 in the figure, or decisional routines, such as the third routine R2 in the figure.
  • the first routine R0 also receive input values IN I , being provided at the start of the running of the firmware 10.
  • routines such as the fourth routine R3 or a fifth routine R4 could receive eventual additional input values, IN2 and IN3, being for instance analog timing or timeout signals, such additional input values being unpredictable.
  • additional input values can be tied to external actions, such as an action from a user that could occur randomly. This is the case, for instance, of a user that could trigger the working of a specific device of a component/ system running the firmware 10 by pushing a button, or of a signal provided by an internal or external sensor. Additional input values could be also provided internally by a device of the component/ system running the firmware 10, such as by a counter.
  • FIG. 1 the block diagram of figure 1 is a mere example and that its structure, e.g., the number and connection of routines, may be different from the one depicted in figure 1.
  • the method is applied to the firmware 10 and selects a plurality of instructions connecting the routines R0...Rn, then associates a corresponding watchpoint WP#0...WP#n to each of the selected instructions.
  • the watchpoints WP#0...WP#n are suitably inserted during the design of the firmware 10.
  • Such an insertion can be automatic (for instance based on a list) or manual (for instance based on design choices).
  • the corresponding first HASH values i.e. the initial HASH value, also indicated as Golden or G-HASH values, are calculated during the generation of the firmware 10 and stored as a corresponding tree of HASH values, each HASH value being related to a watchpoint.
  • the calculation of a first or G- HASH value of a watchpoint is given to a compiler and/or to a post script processor, the correct data at each watchpoint WP#n (in particular the correct address, the counting of the executed instruction, etc.) being thus used.
  • the example firmware 10 comprises ten routines R0...R9 and ten watchpoints WP#0...WP#9. More particularly, a first watchpoint WP#0 is associated to a begin instructions of the first routine R0. Similarly, second, third, fifth and seventh watchpoints WP# 1 , WP#2, WP#4 and WP#6 are associated to begin instructions of respective second third, fifth and seventh routines Rl , R2, R4 and R6.
  • fourth, sixth, eighth, ninth and tenth watchpoints WP#3, WP#5, WP#7, WP#8 and WP#9 are associated to end instructions of corresponding fourth, sixth, eighth, ninth and tenth routines R3, R5, R7, R8 and R9.
  • a first HAS value or G-HASH value is calculated for each watchpoint when the firmware 10 is generated or compiled, a corresponding tree of HASH values being stored, such a tree being substantially a shot of the correct working of the firmware 10 as initially conceived or programmed.
  • a second HASH value also indicated as Executable or E-HASH value
  • E-HASH value is calculated for a watchpoint under examination during the running of the firmware 10 and compared to the stored initial first or G-HASH values as expected to be reached after such a watchpoint according to the tree of G-HASH values as stored.
  • the E-HASH value can be thus also indicated as the current HASH value of a watchpoint, i.e. the HASH value of such a watchpoint while the firmware 10 is running.
  • the tree of initial or G-HASH values would indicate, for instance, that starting from the fourth watchpoint WP#3 a correct working of the firmware 10 could lead to the fifth watchpoint WP#4 or to the tenth watchpoint WP#9 and no other.
  • the current E-HASH value calculated following the fourth WP#3 during the running of the firmware 10 would correspond to the initial G-HASH values of these fifth watchpoint WP#4 or tenth watchpoint WP#9, the firmware 10 is correctly running and the working of the component/ system comprising the same is in turn correct.
  • a portion of the firmware 10 is shown in figure 2, in particular the sequence of steps of the first, second and third routines R0, R1 and R2 and the associated first, second and third watchpoints WP#0, WP# 1 and WP#2.
  • the portion of firmware 10 reported in figure 2 is an example portion and it will be clear how to apply the disclosure to other different portions.
  • the method according to an embodiment of the disclosure when dealing with a firmware applies the selected HASH function to the program counter PC which is usually associated to a corresponding instruction INSTR of the firmware 10, as indicated in figure 2. It is in fact clear that an information tied to the position attained by the firmware during its running, and thus the corresponding routine being executed, could be easily derived from the program counter PC.
  • the method also provides for the calculation of cumulated HASH values (or FT_HASH) of a sequence of instructions and routines by linking the HASH value of a watchpoint under examination (watchpoint#i) to the HASH value of the previous watchpoints according to the following formula:
  • FT_HASH k HASH[FT_HASHk-i
  • the program counter PC suitably allows to link each watchpoint WP#i to a specific instruction within a routine in the code of the firmware 10.
  • the method according to an embodiment of the disclosure can be applied also to a finite state machine.
  • An example finite state machine is shown in figure 3A.
  • the finite state machine comprises a plurality of states and a corresponding plurality of transition between states and the method according to an embodiment of the disclosure comprises a preliminary step of evaluating the finite state machine structure and selecting a plurality of significant states of interest, to be then associates to corresponding watchpoints.
  • the watchpoints are inserted during the design of the finite state machine.
  • the example finite state machine 20 of figure 3A thus comprises a plurality of states S l ...Sn interconnected by means of corresponding transitions.
  • the states S0...Sn can be of the analog type, such as the first state SO in the figure, of the decisional type, such as the second state S I in the figure, or of the digital type, such as the third state S2 in the figure.
  • the first state SO also receive input values IN I and IN2, being provided at the begin of the running of the finite state machine 20.
  • the fifth state S4 correspond to an end state of the finite state machine 20.
  • Other states such as the second state R1 or a fourth state S3 or an eighth state S7 could receive eventual additional input values, IN3, IN4 and IN5, being for instance analog timing or timeout signals, such additional input values being unpredictable, i.e. tied to actions that could occur randomly, as previously explained in relation to the example firmware 10 of figure 1.
  • the method is applied to the finite state machine 20 and comprises a step of selecting a plurality of states of interest S0...Sn, then associating a corresponding watchpoint WP#0...WP#n to each of the selected state.
  • the watchpoints of the finite state machine 20 are suitably inserted during the design of the same in an automatic (for instance base on a list) or manual (for instance based on the design choices) manner during the generation of the finite state machine, in particular by means of a compiler and/or a tool generating the hardware code of the component/ system running the finite state machine 20.
  • FIG. 3B The working of the finite state machine 20 is schematically shown in figure 3B.
  • a current status (n) is linked to a following status (n+ 1) by means of a combinatory network RC, the transitions between states being clocked by a clock signal CLK.
  • a status indicates the current working point of the finite state machine 20, in a similar manner as the program counter PC of the firmware 10.
  • cumulated HASH values could be calculated by applying the HASH function to the status according to following formula:
  • HASH (watchpoint WP#i) HASH (status)
  • the cumulated HASH values are calculate by linking the HASH value of a watchpoint under examination (watchpoint WP#i) to the HASH value of the previous watchpoints according to the following formula:
  • FTJdASH k HASH [FT_HASH k. 1 1 HASH(watchpoint WP#i)], being k the current clock period;
  • Figure 4 shows an example path of states under examination in the finite state machine 20 of figure 3A.
  • the FT_HASH value at the end state S4 following the bolded path BP is calculated as follows:
  • FT_HASH ] HASH (FT_HASH 0
  • FT_HASH 2 HASH (FT_HASHi
  • E-HASH FT_HASH 2
  • the current HASH value or E-HASH obtained at the fifth state S4 corresponding to the end state of the path BP under examination is then compared with the initial first or G-HASH value as calculated for the end state according to a correct working of the finite state machine 20.
  • G_HASH ⁇ H I , H2, H3, H4, H5 ⁇
  • H I HASH along the path -> watchpoint WP#0, watchpoint WP# 1 , watchpoint WP#4, corresponding to the current E-HASH value as above calculated for the path under examination;
  • H2 HASH along the path -> watchpoint WP#0, watchpoint WP#2, watchpoint WP#5, watchpoint WP#4
  • H3 HASH along the path -> watchpoint WP#0, watchpoint WP# 1 , watchpoint WP#3, watchpoint WP#5, watchpoint WP#4
  • H4 HASH along the path -> watchpoint WP#0, watchpoint WP#3, watchpoint WP#5, watchpoint WP#4
  • H5 HASH along the path -> watchpoint WP#0, watchpoint WP#2, watchpoint WP#4
  • a current or E-HASH value being different from H 1 ,...H5 indicates that a bad transition happened in the running of the finite state machine 20 and thus that an unwanted or even dangerous situation may occur.
  • the finite state machine 20 could be explored and the allowed set of HASH values can be calculated according to any known technique or graph visit algorithm.
  • the not allowed HASH values could be also casted according to a policy of severity.
  • a not allowed HASH value corresponding to a not allowed path among the states of the finite state machine, could be indicated as simply erroneous or as illegal or even as dangerous. In such an event, an alert is provided so that a corrective action may be taken.
  • the set of initial first or G-HASH values is definable at each intermediate status of the finite state machine, so as to perform the check of the finite state machine several times (if needed) during the finite state machine evolution.
  • the calculation of a new set of initial first or G-HASH values could be made before a critical command execution. For instance, considering a finite state machine executed in a vehicle, new set of initial first or G-HASH values are calculated before the brake or throttle activation.
  • the HASH function allow to collapse all the history of a watchpoint, i.e. the path followed in order to reach the state corresponding to such watchpoint in a value of a fixed length.
  • the method can be also applied only in a portion of the finite state machine 20, in particular a sub-fmite state machine or subnet 20’ to monitoring only the eventual critical state transitions, as shown for instance in figure 5.
  • the initial watchpoint and the last watchpoint in the example of figure 5 the watchpoints WP#0 and WP#4, are placed on the subnet 20’ to be monitored.
  • Figure 6A shows a block diagram of a method 30 according to an embodiment of the present disclosure.
  • Method 30 comprises, at step 31 , calculating, based on a predefined function, a current unique value of a watchpoint associated to a significative instruction when executing a sequence of instructions.
  • the calculating may include calculating a HASH function of the watchpoint and may be carried out by an HASH calculator, as described below.
  • the watchpoint may correspond to an instruction of a firmware, as shown in Figures 1 and 2, or to a state of a finite state machine, as shown in Figures 3A-3B, 4 and 5.
  • Method 30 further comprises, at step 32, comparing the current unique value of the watchpoint as calculated with a set of stored unique values.
  • the set of stored unique values may comprise unique values associated to all allowable paths in the sequence of instructions corresponding to a correct working of the sequence of instructions.
  • the stored unique values may have been computed used the same predefined function of step 31 , and the set of stored unique values may have been stored, e.g., in non-volatile memory.
  • the operations of step 32 may be carried out by a comparator, for example a HASH comparator, as described below.
  • Method 30 further comprises, at step 33, validating the instruction of the watchpoint as correct if its current unique value is comprised in the set of stored unique values.
  • Validation may assert that a state of a finite state machine associated to the watchpoint is a valid state, following the current one, according to an initial programming of the finite state machine, i.e. an allowed state or that an instruction of a firmware following a current one is among the allowed instruction according to the correct sequence of instruction of the firmware.
  • step 32 results in the current unique value is not comprised in the set of stored unique values
  • the validating results in asserting that the instruction of the firmware or the state of the finite state machine is incorrect; in such an event an alert is provided so that a corrective action may be taken.
  • the validating may be carried out by a instruction/ state validator, as described below.
  • Figure 6B shows a block diagram of a method 40 according to another embodiment of the present disclosure.
  • Method 40 comprises, at step 41 , analyzing a firmware or a finite state machine, decomposing the same into a plurality of routines or states and individuating significative instructions or states and, at step 42, associating each significative instruction or state with a watchpoint.
  • Method 40 further comprises, at step 43, calculating first HASH values of the watchpoints by means of a HASH function before running the firmware or finite state machine for all allowable paths in the firmware or finite state machine corresponding to a correct working of the same.
  • method 40 comprises, at step 44, storing the set of first HASH values as calculated.
  • the set of first HASH values may be stored, e.g., in non volatile memory.
  • Method 40 then comprises, at step 45, calculating second HASH values of the watchpoints by means of a HASH function when running of the firmware or finite state machine.
  • the calculating first and second HASH values of the watchpoints by means of the HASH function may be carried out by a HASH calculator, as described below.
  • Method 40 further comprises, at step 46, comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values. The comparing of step 46 may be carried out by a HASH comparator, as described below. [00118] Method 40 further comprises, at step 47, validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths, i.e. an allowed state or that an instruction of a firmware following a current one is among the allowed instruction according to the correct sequence of instruction of the firmware.
  • step 46 results in the second HASH value is not comprised in the stored set of first HASH values
  • the validating results in asserting that the instruction of the firmware or the state of the finite state machine is incorrect; in such an event an alert is provided so that a corrective action may be taken.
  • the validating may be carried out by an instruction/ state validator, as described below.
  • a component or system implementing the method for detecting bad firmware or finite state machine behaviors of a firmware or a finite state machine running in the component/ system is provided.
  • a component could be a memory device associated with a microcontroller, usually provided with its own firmware managing the working of the memory device itself.
  • a system could be a home automation application running on a smartphone and receiving information from a plurality of sensors or a board comprising a plurality of electronic devices.
  • Such a simple component or more complex system running a firmware or a finite state machine and implementing the above described method comprises means for calculating a HASH value corresponding to each watchpoint by means of a HASH function.
  • the means for calculating HASH values calculates first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine.
  • the means for calculating HASH values could be comprised into a compiler and/or a tool generating the hardware code of the component or system.
  • the component or system also comprises storing means for storing the initial first or G-HASH values as calculated before the running of the firmware or finite state machine.
  • the component or system also comprises means for comparing the stored initial first or G-HASH values and the current second or E-HASH value for each watchpoint and means for validating the instruction or state of a watchpoint as correct if its current second or E-HASH value is comprised in the initial first or G-HASH values of the allowed path starting from the watchpoint under examination.
  • the component or system comprises means for calculating the cumulated HASH values as above indicated and an additional register to store the cumulated HASH values corresponding to all the already visited watchpoints of the firmware /FSM.
  • the component or system may further comprise suitable output means able to provide the result of the comparison between the G-HASH and E-HASH values, for instance in the form of a warning signal for a hypervisor or an user, when such a comparison has indicated a wrong or potentially dangerous sequence of instructions or states for the firmware or FSM under examination.
  • FIG. 7A An apparatus, namely a vehicle, comprising the component or system running a firmware or a finite state machine and implementing the above described method is schematically shown in Figure 7A.
  • Figure 7B A corresponding diagram block also showing the structure of the component / system is shown in Figure 7B.
  • the apparatus 50 for instance a vehicle, comprises a component 51 running a firmware or a finite state machine stored in a microprocessor or a memory 52 as means for storing the firmware or finite state machine and implementing the above described method.
  • the apparatus 50 also comprises sensors, 53 I -53 3 , and actuators, 54i- 54 4 , as well as an engine 55. More particularly, the sensors, 53i-53 3 are connected to the component 51 and provide thereto corresponding input signals. Similarly, the actuators, 54 I -54 are connected to the component 51 and receive therefrom corresponding control signals, being able to control the working of the actuator. Moreover, the engine 55 is connected to the component 51 and exchange control and powering signals with it in a bidirectional manner.
  • sensors may comprise a luminosity sensor 531 associated with a roof of the vehicle, a proximity sensor 53 2 associated with a rear portion of the vehicle or a rotational sensor 53 3 associated with the wheels of the vehicle.
  • actuators may comprise front lights 54i , rear lights 54 2 or wheel brake control 54 3 .
  • the component 51 may comprise a memory or a microprocessor 52 running the firmware or finite state machine and implementing the above described method.
  • the component 51 further comprises a HASH calculator 56 as means for calculating HASH values; more particularly, the HASH calculator 56 calculates first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine.
  • the component 51 comprises a HASH storage 57 as storing means for storing the initial first or G-HASH values as calculated before the running of the firmware or finite state machine.
  • the component 51 may comprise an instruction/ state validator 59 as means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths.
  • the component 51 may comprise warning means 60 as output means providing the result of the comparison between the first and second HASH values in the form of a warning signal.
  • the HASH calculator and the HASH comparator, as well as the instruction/ state validator and the warning means 60 may be electronic circuits, microprocessors or microcontrollers and/or portions of an electronic device or microprocessor/microcontroller; they may also be computer instructions stored in a computer-readable medium that may be executed by a controller or a computer.
  • the HASH storage 57 may be a memory, a memory portion of an electronic device or a database.
  • the present disclosure provides that a method for evaluating a firmware or a finite state machine (FSM) to improve safety of a component or system running the same by detecting anomalous sequences of routines or states in such firmware or finite state machine during their execution that could potentially trigger wrong or inconsistent signals leading to potentially dangerous situations for the corresponding component or system.
  • FSM finite state machine
  • the method provides for a safety methodology to check the run-time of the firmware or finite state machine of a component and/or system using:
  • the method provides for a strong contribution to the ASIL, i.e. the Automotive Safety Integrity Level, a risk classification scheme defined by the ISO 26262, associated with a component, especially a memory device. It is in fact well known that using a memory is considered very weak by the safety standards, because the associated index of the memory is very bad; in other word, the memory devices are assumed and not reliable. Using the method as above described would overcome this problem.
  • ASIL i.e. the Automotive Safety Integrity Level
  • ISO 26262 a risk classification scheme defined by the ISO 26262
  • the method according to the present disclosure is an improved methodology to check the component and/or system life phases:
  • the method according to the present disclosure suitably uses the HASH functions and thus is able to avoid collision in un-intended branches, in particular when using the SHA 256.
  • compact the log data are obtained and thus not large log report are required.
  • the history of the execution steps to track the correct execution is reduced and linked as a chain, thanks to the calculation of the HASH value of a watchpoint under examination as linked to the HASH values of the previous watchpoints; in this regards, it should be further remarked that the path is uniquely determined because each watchpoint contributes to the HASH final value.
  • the correctness of all the possible paths from the start point to an end point in a firmware /FSM are suitably traced.
  • a As used herein, "a,” “an,” or “a number of ' something can refer to one or more of such things.
  • a “plurality” of something intends two or more.
  • the term “coupled” may include electrically coupled, directly coupled, and/or directly connected with no intervening elements (e.g., by direct physical contact) or indirectly coupled and/or connected with intervening elements.
  • the term coupled may further include two or more elements that co-operate or interact with each other (e.g., as in a cause and effect relationship).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present disclosure relates to a method comprising the steps of analyzing a firmware or a finite state machine, decomposing the same into a plurality of routines or states and individuating significative instructions or states; associating each significative instruction or state with a watchpoint; calculating first HASH values of the watchpoints by means of a HASH function before running the firmware or finite state machine for all allowable paths in the firmware or finite state machine corresponding to a correct working of the same; storing the set of first HASH values as calculated; calculating second HASH values of the watchpoints by means of a HASH function when running of the firmware or finite state machine; comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the first HASH values of the allowed paths. A related apparatus and a component/ system running the firmware or finite state machine are also described.

Description

Title: METHOD FOR IMPROVING SAFETY OF A COMPONENT OR SYSTEM RUNNING A FIRMWARE OR A FINITE STATE MACHINE
DESCRIPTION
TECHNICAL FIELD
[OOOl] The present disclosure relates generally to components or systems running a firmware or a finite state machine that implements the responses of certain internal or external events, in particular in vehicles, and more particularly to a method for improving safety of such components or systems. Even more particularly, the present disclosure relates to a method for evaluating a firmware or a finite state machine to improve safety of a component or system running the same by avoiding the triggering of wrong or inconsistent instructions leading to potentially dangerous situations.
BACKGROUND
[0002] A task of a component or a system can be executed by running a firmware or a finite state machine, that implements the responses of certain internal events, tied to the working of the component or system, or external events, in particular gathered by sensors.
[0003] For instance, motor vehicles, such as autonomous and/or non- autonomous vehicles (e.g., automobiles, cars, trucks, buses, etc.), can nowadays use sensors, cameras, and communication means to obtain information about their surroundings. Similarly, sensors are used in many other fields, such as in airplanes or in plants comprising one or more machinery managed by a control system.
[0004] Moreover, different conditions can be used to trigger specific function or to ascertain the begin/ end of different state during the working of the component or system. For instance, a specific temperature can be sensed in order to ensure that a threshold value is attained before using a function or component or to end such a use.
[0005] In a general way, a component or a system can execute one or more task by using: - a firmware, in the form of a program in a high level language, such as C++ and/or other custom languages, being compiled to obtain an assembly code executed by a microprocessor; or
- a finite state machine or FSM, usually defined in VHDL, Verilog, SystemC, or represented by a diagram of states being mapped on a programmable logic or FPGA or by an ASIC.
[0006] It is immediate to verify that, in most cases, a firmware and a finite state machine show a large amount of analogies with one another. In particular, they can be essentially seen as a set of transitions between states/routines following specific instructions triggered by internal and/or external events, such as:
analog events (voltage values, current values, timing); and
logical events (Boolean functions of some external/ internal signals).
[0007] When using a firmware or a finite state machine, care should be taken in order to avoid the activation of wrong or inconsistent signals and thus unwanted or inconsistent instruction that can lead to very dangerous situations.
[0008] In this sense, the transitions among the states of a finite state machine or the steps of the routines of a firmware not allowed on the basis of a correct working of the corresponding component/ system running the firmware /finite state machine should be prevented so as to avoid unauthorized access to the component/ system or a portion thereof following a hacking attack.
[0009] These problems are particularly important for autonomous vehicles, i.e. vehicles in which at least a portion of the control over vehicle operations is managed by computer hardware and/or software /firmware, as opposed to a human operator. In fact, an autonomous vehicle can be a driverless vehicle, a computerized system managing the entire working of the vehicle and the safe and correct running of its firmware /finite state machine being of the utmost importance.
[0010] It is desirable to solve the above-mentioned problems, providing a secure and efficient method for ensuring the correct working of a component or system running a firmware or a finite state machine, especially able to avoid the triggering of wrong or inconsistent signals that can lead to unwanted or even dangerous situations. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 shows a block diagram of a firmware implementing a method in accordance with an embodiment of the present disclosure;
[0012] Figure 2 shows a portion of a routine of the firmware of Figure 1 as modified by the method in accordance with an embodiment of the present disclosure;
[0013] Figure 3A and 3B show block diagrams of a finite state machine implementing the method in accordance with an embodiment of the present disclosure;
[0014] Figure 4 shows a block diagram of the finite state machine of figure 3A showing a path being analyzed with the method in accordance with an embodiment of the present disclosure;
[0015] Figure 5 shows a block diagram of a finite state machine including a sub-finite state machine implementing the method in accordance with an embodiment of the present disclosure;
[0016] Figure 6A and 6B show methods in accordance with embodiments of the present disclosure;
[0017] Figure 7A shows an apparatus, namely a vehicle, comprising a component or system running a firmware or a finite state machine implementing a method in accordance with an embodiment of the present disclosure;
[0018] Figure 7B shows a block diagram of the apparatus of Figure 7 A and of the component or system comprised therein.
DETAILED DESCRIPTION
[0019] With reference to those figures, a method for improving safety of a component or system running a firmware or a finite state machine will be disclosed herein.
[0020] More particularly, as it will be described into details in the following, the proposed method is aimed to avoid the triggering of wrong or inconsistent signals leading to potentially dangerous situations by detecting anomalous sequences of routines or states in a firmware or in a finite state machine during their execution.
[0021] An example method includes the steps of:
- analyzing a firmware or a finite state machine, decomposing the same into a plurality of routines or states and individuating significative instructions or states;
- associating each significative instruction or state with a watchpoint;
- calculating first HASH values of the watchpoints by means of a HASH function before running the firmware or finite state machine for all allowable paths in the firmware or finite state machine corresponding to a correct working of the same;
- storing the set of first HASH values as calculated;
- calculating second HASH values of the watchpoints by means of a HASH function when running of the firmware or finite state machine;
- comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths.
[0022] In an embodiment, the significative instructions or states may be begin /end instructions of routines of the firmware or specific executions states of the finite state machine.
[0023] Moreover, the HASH function may be the cryptographic HASH function or Secure Hash Algorithm SHA-256.
[0024] Another example method according to the present disclosure comprises the steps of:
- analyzing a sequence of instructions and individuating significative ones;
- associating each significative instruction with a watchpoint;
- calculating first unique values of the watchpoints by means of a predefined function before executing the sequence of instructions for all allowable paths in the sequence of instructions corresponding to a correct working of the same;
- storing the set of first unique values as calculated; - calculating second unique values of the watchpoints by means of a predefined function when executing the sequence of instructions;
- comparing the second unique value of each watchpoint as calculated with the stored set of first unique values; and
- validating the instruction of a watchpoint as correct if its second unique value is comprised in the first unique values of the allowed paths.
[0025] Another example method according to the present disclosure comprises the steps of:
- calculating, based on a predefined function, a current unique value of a watchpoint associated to a significative instruction when executing a sequence of instructions;
- comparing the current unique value of the watchpoint as calculated with a set of stored unique values; and
- validating the instruction of the watchpoint as correct if its current unique value is comprised in the set of stored unique values.
[0026] The present disclosure also relates to a simple component or a more complex system, generally indicated as component implementing the above method.
[0027] More particularly, the component implementing the above method may comprise:
- means for calculating HASH values associated to watchpoints of significative instructions or states of the firmware or finite state machine by means of a HASH function, the means for calculating HASH values calculating first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine;
- means for storing the set of first HASH values as calculated;
- means for comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths. [0028] The disclosure further relates to an apparatus comprising:
- a component configured to run a firmware or a finite state machine;
- means for storing the firmware or finite state machine;
- a plurality of sensors connected to the component and configured to provide thereto input signals; and
- a plurality of actuators connected to the component and configured to receive therefrom control signals,
the component including:
- means for storing a set of first HASH values;
- means for calculating HASH values associated to watchpoints of significative instructions or states of the firmware or finite state machine by means of a HASH function, the means for calculating HASH values being configured to calculate second HASH values when the component is running the firmware or finite state machine;
- means for comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values.
[0029] The method can be used for enhancing the safety of a component or a system using a firmware or a finite state machine (FSM) indifferently.
[0030] The method essentially provides for individuating significative instruction/ states in a firmware / finite state machine and associating the same with respective watchpoints, then using a HASH function to evaluate a correctness of different sequences of instruction/ states during the running of the firmware/finite state machine. The method provides for verifying if an instruction/ state following a current instruction/ state is among a plurality of correct instructions/states on the basis of the original programming of the corresponding firmware / finite state machine, the correct instructions/ states that could follow each instruction/ state of the firmware / finite state machine being previously stored. [0031] It is noted that, although a preferred embodiment will be described wherein the firmware or finite state machine is used in an apparatus being a vehicle, such as a private vehicle or also a vehicle intended to transport people and/or goods, the present disclosure is not limited thereto and can be also used in other environments or apparatuses, such as in an airplane or in a control system of a plant, such as, for example, a car factory, a chemical plant, a power plant or any other type of factory.
[0032] A finite state machine essentially comprises a plurality of states, each state being executed following a transition from a previous state. Similarly, a firmware essentially comprises a plurality of routines and corresponding instructions to begin/end them. In this way, it is clear that the states of a finite state machine could be considered as equivalent to the instructions to begin/ end a routine of a firmware.
[0033] When dealing with a component/ system running a firmware or a finite state machine, Single Event Upsets (SEUs) or Multiple Event Upsets (MEUs) should be taken into account, being able to trigger unwanted or incorrect instructions or execution of states of the firmware /finite state machine, leading to the activation of some wrong or inconsistent signals for the component/ system itself. The activation of wrong or inconsistent signals can in turn lead to very dangerous situation, such as for example:
in a vehicle, the activation of the brake and throttle system at the same time;
in an airplane, the opening of the landing gear, during cruising; or in a control system of a plant, the activation of some actuators that contrast the activity of others still running.
[0034] With the wording“event upset” it is indicated herein any kind of internal or external action or unwanted /unforecastd event leading to unwanted instructions within a routine of a firmware or transitions between states of a finite state machine.
[0035] This is the case, for instance, of a change of state caused by an ionizing particle (ions, electrons, photons...), that can be from x-ray, power lines on top of roads, alpha-particles, etc. , striking a sensitive node in a micro-electronic device, such as in a semiconductor memory. The free charge so created by ionization in or close to an important node of a logic element (e.g. memory "bit") can cause an unwanted state change and a corresponding error in a corresponding component or system output or operation, also called soft error.
[0036] Making reference to the automotive field, event upsets can occur for instance when a vehicle runs in the vicinity of a generator of electrical noise, such as a radio station plant or high voltage air cables.
[0037] Event upsets can also be caused, for instance, by the malfunctioning of a single device in the component/ system or by an erroneous string of commands provided by a user or also by an attempt of hacking the component /system, usually involving fraudulently changing of the power supplies values. In a general way, event upsets can be accidentally or purposely provoked.
[0038] In essence, an event upset could deviate the correct working of a firmware, in term of sequences of routines, or of a finite state machine, in term of transitions between states, from their original and correct programming, such a deviation being for instance a jump into a routine / state that is not one among the possible correct routines/ states that can follow a current one according to the working established a priori for the firmware or finite state machine, such an unforeseen routine/ state leading to a malfunctioning of the firmware or finite state machine and thus of the component or system comprising it.
[0039] Different other dangerous situations could raise in case of a triggering of wrong or inconsistent signals and it is thus important to detect anomalous sequences of states /routines that can lead to incoherent situations so as to avoid them.
[0040] In the automotive field, methods for testing the integrity of a firmware or finite state machine are provided, for instance, among the safety requirements, based on ISO 26262 for Automotive; it should be remarked that the standard gives recommendation to associate a probability of error, i.e. the so called ASIL level (Automotive Safety Integrity Level), and it does not provide indication on how implement the interception and the action to be done when an error is detected, these choices being left to the developer.
[0041] More particularly, the integrity tests are performed: during the upgrading of the firmware or finite state machine;
during the loading of the firmware or finite state machine in a corresponding component/ system ram able to start the execution of the same; and
during the execution of a firmware instruction or a finite state machine state.
[0042] The method according to the present disclosure detects bad firmware or finite state machine behaviors by evaluating the firmware or finite state machine structure or diagram and in particular the different routines and instructions or states and transitions composing the same in order to select specific instructions/ states wherein inserting corresponding watchpoints to be checked during the running of the firmware or finite state machine.
[0043] More particularly, the method comprises a preliminary step of evaluating the firmware or finite state machine structure decomposing the same into a plurality of states /routines and instructions and selecting a plurality of significant instructions/ states of interest. For instance, inside a firmware, the begin/end instructions of the routines could be selected as significative instructions, while in a finite state machine, specific executions states could be selected as significative states.
[0044] The method then comprises a step of associating a watchpoint to each of the selected significative instructions/ states.
[0045] The method according to the present disclosure provides for calculating a HASH value corresponding to each watchpoint by means of a HASH function.
[0046] A HASH function is a function that is used to map data of arbitrary size into data of a fixed size, returning values being called HASH values. More particularly, a HASH function always provides a result value, also indicated as digest, of a fixed length, starting from an initial data or message of variable length. Moreover, HASH functions are usually not reversible, so that an original data or value cannot be retrieved by the HASH value alone. [0047] It is also not possible to create two different HASH results having a same value starting from different inputs. In this sense, the HASH functions are claimed as having no collisions, also indicated as HASH collision.
[0048] Suitably according to the present disclosure, the method comprises a first step of calculating first HASH values of all the watchpoints of the firmware or finite state machine before running the same, herein also indicated as initial HASH values or Golden HASH values or G-HASH values, indifferently.
[0049] The HASH value of each watchpoint is calculated so as to depend only from an allowable path in the firmware or finite state machine, so tracking the correct execution flow of the firmware or finite state machine. In this way, the different paths between the routines/ states, comprising an unknown length of branches, loops, i.e. analog timings, user inputs, and others, are providing a unique HASH value.
[0050] More particularly, thanks to the HASH values so calculated, the method allows to avoid branch track collisions during the execution of the instructions/ states comprised in a corresponding path within the firmware or finite state machine, a fixed size value being calculated for each end point.
[0051] It is remarked that the HASH functions provide HASH values having a fixed size being known a priori and allow to associate even very long path to a unique HASH value of a fixed size, indeed. In other words, independently from the length of the processed data, the HASH function always output a fixed size result value.
[0052] According to an embodiment, the method exploits a cryptographic HASH functions, more particularly a Secure Hash Algorithm, or SHA. The SHAs are cryptographic HASH functions published by the National Institute of Standards and Technology (NIST) as a U.S. Federal Information Processing Standard (FIPS), the list of allowed HASH functions being regularly updated, while keeping the same size.
[0053] According to an embodiment, the SHA-256 is used, providing HASH values having a size of the 32Bytes and having not shown any collision from its conception up to now. [0054] According to an embodiment of the present disclosure, the first step of calculating the first or G-HASH values is performed for a firmware during a compiling phase and for a finite state machine during a synthesis phase, i.e. according to an original programming of the same, the first or G-HASH values corresponding to all the possible allowable paths to reach an end point of the firmware or finite state machine from a defined starting point. In other words, the first or G-HASH values map the correct paths allowed for the firmware or finite state machine before running them in a component/ system, more particularly, the first or G-HASH values form a tree wherein the watchpoints are connected one another in a correct manner. The tree of first or G-HASH values in particular shows all possible watchpoints (i.e. the correct ones) that could follow a selected watchpoint, being considered as a starting point, on the basis of the correct working programmed for the firmware or finite state machine under examination.
[0055] The method also comprises a step of storing the set of first or G-HASH values as calculated. In particular, a database of possible allowable HASH values is generated, being the values that can appear during the runtime of the firmware or finite state machine under examination.
[0056] It should be remarked that the first of G-HASG values are stored in a permanent way in the corresponding component / system implementing the method. In fact, such first or G-HASH values are changed only when a new firmware or finite state machine is compiled and sent for update.
[0057] Moreover, the method comprises a second step of calculating second HASH values of each watchpoint during the execution of the firmware or finite state machine using a same HASH function; the second HASH values are herein also indicated as Executable HASH or E-HASH values.
[0058] The method then comprises a step of comparing the set of first HASH values as stored and the second HASH values as calculated, in particular the G- HASH and E-HASH values respectively, the presence of a second or E-HASH value as calculated in the stored set of first or G-HASH values indicating a correct execution of the firmware or finite state machine under evaluation, the method then validating the corresponding instruction or state as correct. [0059] Such a comparison is usually made starting from the first watchpoint in the runtime, while it can start from any watchpoint in the debug and/or validation procedures of the firmware or a finite state machine.
[0060] Suitably, the method further comprises a step of calculating cumulated HASH values, also indicated as FT_HASH, of a sequence of instructions/ routines or transitions/ states by linking the HASH value of a watchpoint under examination (watchpoint WP#i) to the HASH value of the previous watchpoints according to the following formula:
FT_HASHk = HASH[FT_HASHk-i | HASH (watchpoint WP#i)], being k the current clock period;
k- 1 the previous clock period; and
I the union between HASH values, starting from an initial value FT_HASHo = HASH (watchpoint WP#0), being watchpoint WP#0 the starting point of a chain of watchpoints under examination, the cumulated HASH value being thus calculated by applying the HASH function at each step of the routines of a firmware or at each transition between states of a finite state machine.
[0061] A current or E-HASH value of an end watchpoint of the chain would thus correspond to the last cumulated FT_HASH as calculated following such a chain.
[0062] In this way, with the method according to an example of the disclosure, the information relating to a watchpoint in a chain of the tree of watchpoints forming the firmware or finite state machine is linked to the information of the watchpoint being upstream in the chain through the cumulated FT_HASH as calculated, such link being made by the HASH function so as to always obtain a result with a fixed size known a priori. In other words, the cumulated FTJHASH contains the history of steps to reach at a certain instruction/state of the firmware or finite state machine under examination.
[0063] Suitably, the method further comprises a step of storing the different cumulated HASH values as calculated for each watchpoint being examined. [0064] Finally, the method may also comprise a step of outputting the result of the comparison step between the G-HASH and E-HASH values for indicating a wrong or potentially dangerous sequence of instructions or states for the firmware or finite state machine under examination.
[0065] More particularly, the method may output a warning signal for a hypervisor or a user or for internal handling of the sequence of instructions or states of the firmware or finite state machine under examination.
[0066] As it will be explained in the following, the HASH value of a watchpoint is calculated by using the program counter value of the corresponding instruction for a firmware or the status for a finite state machine.
[0067] Figure 1 is a block diagram of the structure of an example firmware 10 implementing the method according to an embodiment of the present disclosure. The firmware 10 can be used, for instance, in an autonomous vehicle, a traditional non-autonomous vehicle, an emergency vehicle, a service vehicle, or the like. As already indicated, the firmware 10 can be used, for instance, in an airplane or in a plant comprising one or more machinery.
[0068] The firmware 10 comprises at least a starting point PI, indicated also as Start and an ending point PE, indicated also as End, as well as a plurality of routines R0...Rn interconnected by means of corresponding instructions.
[0069] The routines R0...Rn can be analog routines, such as the first routine R0 in the figure, digital routines, such as the second routine R1 in the figure, or decisional routines, such as the third routine R2 in the figure. The first routine R0 also receive input values IN I , being provided at the start of the running of the firmware 10.
[0070] Moreover, other routines, such as the fourth routine R3 or a fifth routine R4 could receive eventual additional input values, IN2 and IN3, being for instance analog timing or timeout signals, such additional input values being unpredictable.
[0071] In particular, additional input values can be tied to external actions, such as an action from a user that could occur randomly. This is the case, for instance, of a user that could trigger the working of a specific device of a component/ system running the firmware 10 by pushing a button, or of a signal provided by an internal or external sensor. Additional input values could be also provided internally by a device of the component/ system running the firmware 10, such as by a counter.
[0072] It should be noted that the block diagram of figure 1 is a mere example and that its structure, e.g., the number and connection of routines, may be different from the one depicted in figure 1.
[0073] According to an embodiment of the present disclosure, the method is applied to the firmware 10 and selects a plurality of instructions connecting the routines R0...Rn, then associates a corresponding watchpoint WP#0...WP#n to each of the selected instructions.
[0074] More particularly, the watchpoints WP#0...WP#n are suitably inserted during the design of the firmware 10. Such an insertion can be automatic (for instance based on a list) or manual (for instance based on design choices).
[0075] The corresponding first HASH values, i.e. the initial HASH value, also indicated as Golden or G-HASH values, are calculated during the generation of the firmware 10 and stored as a corresponding tree of HASH values, each HASH value being related to a watchpoint.
[0076] According to a preferred embodiment, the calculation of a first or G- HASH value of a watchpoint is given to a compiler and/or to a post script processor, the correct data at each watchpoint WP#n (in particular the correct address, the counting of the executed instruction, etc.) being thus used.
[0077] Making reference to the embodiment of figure 1 , the example firmware 10 comprises ten routines R0...R9 and ten watchpoints WP#0...WP#9. More particularly, a first watchpoint WP#0 is associated to a begin instructions of the first routine R0. Similarly, second, third, fifth and seventh watchpoints WP# 1 , WP#2, WP#4 and WP#6 are associated to begin instructions of respective second third, fifth and seventh routines Rl , R2, R4 and R6. Moreover, fourth, sixth, eighth, ninth and tenth watchpoints WP#3, WP#5, WP#7, WP#8 and WP#9 are associated to end instructions of corresponding fourth, sixth, eighth, ninth and tenth routines R3, R5, R7, R8 and R9. [0078] Suitably, using the method according to an embodiment of the disclosure, a first HAS value or G-HASH value is calculated for each watchpoint when the firmware 10 is generated or compiled, a corresponding tree of HASH values being stored, such a tree being substantially a shot of the correct working of the firmware 10 as initially conceived or programmed.
[0079] Moreover, the method provides that a second HASH value, also indicated as Executable or E-HASH value, is calculated for a watchpoint under examination during the running of the firmware 10 and compared to the stored initial first or G-HASH values as expected to be reached after such a watchpoint according to the tree of G-HASH values as stored. The E-HASH value can be thus also indicated as the current HASH value of a watchpoint, i.e. the HASH value of such a watchpoint while the firmware 10 is running.
[0080] For the example firmware 10 of figure 1 , the tree of initial or G-HASH values would indicate, for instance, that starting from the fourth watchpoint WP#3 a correct working of the firmware 10 could lead to the fifth watchpoint WP#4 or to the tenth watchpoint WP#9 and no other. Hence, if the current E-HASH value calculated following the fourth WP#3 during the running of the firmware 10 would correspond to the initial G-HASH values of these fifth watchpoint WP#4 or tenth watchpoint WP#9, the firmware 10 is correctly running and the working of the component/ system comprising the same is in turn correct. On the contrary, if the current E-HASH value calculated following the fourth WP#3 during the running of the firmware 10 would correspond, for instance, to the initial G-HASH value of the ninth watchpoint WP#8, an error has occurred when running the firmware 10 and the working of the corresponding component /system is not correct and could potentially lead to a dangerous situation. In such an event, an alert is provided so that a corrective action may be taken.
[0081] A portion of the firmware 10 is shown in figure 2, in particular the sequence of steps of the first, second and third routines R0, R1 and R2 and the associated first, second and third watchpoints WP#0, WP# 1 and WP#2. The portion of firmware 10 reported in figure 2 is an example portion and it will be clear how to apply the disclosure to other different portions.
[0082] Suitably, the method according to an embodiment of the disclosure when dealing with a firmware, such as the firmware 10 of figure 1 , applies the selected HASH function to the program counter PC which is usually associated to a corresponding instruction INSTR of the firmware 10, as indicated in figure 2. It is in fact clear that an information tied to the position attained by the firmware during its running, and thus the corresponding routine being executed, could be easily derived from the program counter PC.
[0083] The method also provides for the calculation of cumulated HASH values (or FT_HASH) of a sequence of instructions and routines by linking the HASH value of a watchpoint under examination (watchpoint#i) to the HASH value of the previous watchpoints according to the following formula:
FT_HASHk = HASH[FT_HASHk-i | HASH (watchpoint #i)], being k the current clock period;
k- 1 the previous clock period; and
I the union between HASH values, starting from an initial value FT_HASHo = HASH(watchpoint WP#0), being watchpoint WP#0 the starting point of a chain of watchpoints under examination, wherein
HASH (watchpoint WP#i) = HASH (program counter PC)
[0084] It is remarked that the program counter PC suitably allows to link each watchpoint WP#i to a specific instruction within a routine in the code of the firmware 10.
[0085] As already explained, the method according to an embodiment of the disclosure can be applied also to a finite state machine. An example finite state machine is shown in figure 3A.
[0086] As already indicated, the finite state machine comprises a plurality of states and a corresponding plurality of transition between states and the method according to an embodiment of the disclosure comprises a preliminary step of evaluating the finite state machine structure and selecting a plurality of significant states of interest, to be then associates to corresponding watchpoints. In particular, the watchpoints are inserted during the design of the finite state machine. [0087] The example finite state machine 20 of figure 3A thus comprises a plurality of states S l ...Sn interconnected by means of corresponding transitions.
[0088] The states S0...Sn can be of the analog type, such as the first state SO in the figure, of the decisional type, such as the second state S I in the figure, or of the digital type, such as the third state S2 in the figure. The first state SO also receive input values IN I and IN2, being provided at the begin of the running of the finite state machine 20. The fifth state S4 correspond to an end state of the finite state machine 20.
[0089] Other states, such as the second state R1 or a fourth state S3 or an eighth state S7 could receive eventual additional input values, IN3, IN4 and IN5, being for instance analog timing or timeout signals, such additional input values being unpredictable, i.e. tied to actions that could occur randomly, as previously explained in relation to the example firmware 10 of figure 1.
[0090] According to an embodiment of the present disclosure, the method is applied to the finite state machine 20 and comprises a step of selecting a plurality of states of interest S0...Sn, then associating a corresponding watchpoint WP#0...WP#n to each of the selected state.
[0091] As for the firmware 10, also the watchpoints of the finite state machine 20 are suitably inserted during the design of the same in an automatic (for instance base on a list) or manual (for instance based on the design choices) manner during the generation of the finite state machine, in particular by means of a compiler and/or a tool generating the hardware code of the component/ system running the finite state machine 20.
[0092] The working of the finite state machine 20 is schematically shown in figure 3B. In particular, a current status (n) is linked to a following status (n+ 1) by means of a combinatory network RC, the transitions between states being clocked by a clock signal CLK.
[0093] It is underlined that a status indicates the current working point of the finite state machine 20, in a similar manner as the program counter PC of the firmware 10. [0094] Also for the finite state machine 20, cumulated HASH values (or FT_HASH) could be calculated by applying the HASH function to the status according to following formula:
HASH (watchpoint WP#i) = HASH (status)
[0095] As previously, the cumulated HASH values (or FT_HASH) are calculate by linking the HASH value of a watchpoint under examination (watchpoint WP#i) to the HASH value of the previous watchpoints according to the following formula:
FTJdASHk = HASH [FT_HASHk.1 1 HASH(watchpoint WP#i)], being k the current clock period;
k- 1 the previous clock period; and
I the union between HASH values, starting from an initial value FT_HASHo = HASH(watchpoint WP#0), being watchpoint#0 the starting state.
[0096] Figure 4 shows an example path of states under examination in the finite state machine 20 of figure 3A. In particular, starting from an initial state SO, the FT_HASH value at the end state S4 following the bolded path BP is calculated as follows:
FT_HASHo = HASH (watchpoint WP#0)
FT_HASH] = HASH (FT_HASH0 | HASH (watchpoint WP# 1)) FT_HASH2 = HASH (FT_HASHi | HASH(watchpoint WP#4)) E-HASH = FT_HASH2
[0097] According to the method of an embodiment of the disclosure, the current HASH value or E-HASH obtained at the fifth state S4 corresponding to the end state of the path BP under examination is then compared with the initial first or G-HASH value as calculated for the end state according to a correct working of the finite state machine 20.
[0098] In the example finite state machine of Figure 3, the set of hashes allowed is:
G_HASH = {H I , H2, H3, H4, H5} where: H I = HASH along the path -> watchpoint WP#0, watchpoint WP# 1 , watchpoint WP#4, corresponding to the current E-HASH value as above calculated for the path under examination;
H2 = HASH along the path -> watchpoint WP#0, watchpoint WP#2, watchpoint WP#5, watchpoint WP#4
H3 = HASH along the path -> watchpoint WP#0, watchpoint WP# 1 , watchpoint WP#3, watchpoint WP#5, watchpoint WP#4
H4 = HASH along the path -> watchpoint WP#0, watchpoint WP#3, watchpoint WP#5, watchpoint WP#4
H5 = HASH along the path -> watchpoint WP#0, watchpoint WP#2, watchpoint WP#4
[0099] A current or E-HASH value being different from H 1 ,...H5 indicates that a bad transition happened in the running of the finite state machine 20 and thus that an unwanted or even dangerous situation may occur.
[00100] The finite state machine 20 could be explored and the allowed set of HASH values can be calculated according to any known technique or graph visit algorithm.
[00101] Moreover, according to an alternative embodiment of the method, the not allowed HASH values could be also casted according to a policy of severity. In particular, a not allowed HASH value, corresponding to a not allowed path among the states of the finite state machine, could be indicated as simply erroneous or as illegal or even as dangerous. In such an event, an alert is provided so that a corrective action may be taken.
[00102] The set of initial first or G-HASH values is definable at each intermediate status of the finite state machine, so as to perform the check of the finite state machine several times (if needed) during the finite state machine evolution. In particular, the calculation of a new set of initial first or G-HASH values could be made before a critical command execution. For instance, considering a finite state machine executed in a vehicle, new set of initial first or G-HASH values are calculated before the brake or throttle activation. [00103] It is newly remarked that the HASH function allow to collapse all the history of a watchpoint, i.e. the path followed in order to reach the state corresponding to such watchpoint in a value of a fixed length.
[00104] The method can be also applied only in a portion of the finite state machine 20, in particular a sub-fmite state machine or subnet 20’ to monitoring only the eventual critical state transitions, as shown for instance in figure 5. In that case the initial watchpoint and the last watchpoint, in the example of figure 5 the watchpoints WP#0 and WP#4, are placed on the subnet 20’ to be monitored.
[00105] Figure 6A shows a block diagram of a method 30 according to an embodiment of the present disclosure.
[00106] Method 30 comprises, at step 31 , calculating, based on a predefined function, a current unique value of a watchpoint associated to a significative instruction when executing a sequence of instructions. The calculating may include calculating a HASH function of the watchpoint and may be carried out by an HASH calculator, as described below. The watchpoint may correspond to an instruction of a firmware, as shown in Figures 1 and 2, or to a state of a finite state machine, as shown in Figures 3A-3B, 4 and 5.
[00107] Method 30 further comprises, at step 32, comparing the current unique value of the watchpoint as calculated with a set of stored unique values. The set of stored unique values may comprise unique values associated to all allowable paths in the sequence of instructions corresponding to a correct working of the sequence of instructions. The stored unique values may have been computed used the same predefined function of step 31 , and the set of stored unique values may have been stored, e.g., in non-volatile memory. The operations of step 32 may be carried out by a comparator, for example a HASH comparator, as described below.
[00108] Method 30 further comprises, at step 33, validating the instruction of the watchpoint as correct if its current unique value is comprised in the set of stored unique values.
[00109] Validation may assert that a state of a finite state machine associated to the watchpoint is a valid state, following the current one, according to an initial programming of the finite state machine, i.e. an allowed state or that an instruction of a firmware following a current one is among the allowed instruction according to the correct sequence of instruction of the firmware.
[00110] In the event that the comparing of step 32 results in the current unique value is not comprised in the set of stored unique values, the validating results in asserting that the instruction of the firmware or the state of the finite state machine is incorrect; in such an event an alert is provided so that a corrective action may be taken. The validating may be carried out by a instruction/ state validator, as described below.
[00111] Figure 6B shows a block diagram of a method 40 according to another embodiment of the present disclosure.
[00112] Method 40 comprises, at step 41 , analyzing a firmware or a finite state machine, decomposing the same into a plurality of routines or states and individuating significative instructions or states and, at step 42, associating each significative instruction or state with a watchpoint.
[00113] Method 40 further comprises, at step 43, calculating first HASH values of the watchpoints by means of a HASH function before running the firmware or finite state machine for all allowable paths in the firmware or finite state machine corresponding to a correct working of the same.
[00114] Moreover, method 40 comprises, at step 44, storing the set of first HASH values as calculated. The set of first HASH values may be stored, e.g., in non volatile memory.
[00115] Method 40 then comprises, at step 45, calculating second HASH values of the watchpoints by means of a HASH function when running of the firmware or finite state machine.
[00116] The calculating first and second HASH values of the watchpoints by means of the HASH function may be carried out by a HASH calculator, as described below.
[00117] Method 40 further comprises, at step 46, comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values. The comparing of step 46 may be carried out by a HASH comparator, as described below. [00118] Method 40 further comprises, at step 47, validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths, i.e. an allowed state or that an instruction of a firmware following a current one is among the allowed instruction according to the correct sequence of instruction of the firmware.
[00119] In the event that the comparing of step 46 results in the second HASH value is not comprised in the stored set of first HASH values, the validating results in asserting that the instruction of the firmware or the state of the finite state machine is incorrect; in such an event an alert is provided so that a corrective action may be taken. The validating may be carried out by an instruction/ state validator, as described below.
[00120] According to an embodiment of the present disclosure a component or system implementing the method for detecting bad firmware or finite state machine behaviors of a firmware or a finite state machine running in the component/ system is provided.
[00121] For instance, a component could be a memory device associated with a microcontroller, usually provided with its own firmware managing the working of the memory device itself. Moreover, a system could be a home automation application running on a smartphone and receiving information from a plurality of sensors or a board comprising a plurality of electronic devices.
[00122] Such a simple component or more complex system, generally indicated as component, running a firmware or a finite state machine and implementing the above described method comprises means for calculating a HASH value corresponding to each watchpoint by means of a HASH function.
[00123] According to an embodiment of the disclosure, the means for calculating HASH values calculates first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine.
[00124] More particularly, the means for calculating HASH values could be comprised into a compiler and/or a tool generating the hardware code of the component or system. [00125] The component or system also comprises storing means for storing the initial first or G-HASH values as calculated before the running of the firmware or finite state machine.
[00126] Suitably, the component or system also comprises means for comparing the stored initial first or G-HASH values and the current second or E-HASH value for each watchpoint and means for validating the instruction or state of a watchpoint as correct if its current second or E-HASH value is comprised in the initial first or G-HASH values of the allowed path starting from the watchpoint under examination.
[00127] Moreover, the component or system comprises means for calculating the cumulated HASH values as above indicated and an additional register to store the cumulated HASH values corresponding to all the already visited watchpoints of the firmware /FSM.
[00128] The component or system may further comprise suitable output means able to provide the result of the comparison between the G-HASH and E-HASH values, for instance in the form of a warning signal for a hypervisor or an user, when such a comparison has indicated a wrong or potentially dangerous sequence of instructions or states for the firmware or FSM under examination.
[00129] An apparatus, namely a vehicle, comprising the component or system running a firmware or a finite state machine and implementing the above described method is schematically shown in Figure 7A. A corresponding diagram block also showing the structure of the component / system is shown in Figure 7B.
[00130] The apparatus 50, for instance a vehicle, comprises a component 51 running a firmware or a finite state machine stored in a microprocessor or a memory 52 as means for storing the firmware or finite state machine and implementing the above described method.
[00131] The apparatus 50 also comprises sensors, 53I-533, and actuators, 54i- 544, as well as an engine 55. More particularly, the sensors, 53i-533 are connected to the component 51 and provide thereto corresponding input signals. Similarly, the actuators, 54I-54 are connected to the component 51 and receive therefrom corresponding control signals, being able to control the working of the actuator. Moreover, the engine 55 is connected to the component 51 and exchange control and powering signals with it in a bidirectional manner.
[00132] For instance, sensors may comprise a luminosity sensor 531 associated with a roof of the vehicle, a proximity sensor 532 associated with a rear portion of the vehicle or a rotational sensor 533 associated with the wheels of the vehicle.
[00133] Moreover, actuators may comprise front lights 54i , rear lights 542 or wheel brake control 543.
[00134] In a general manner, a plurality of sensor 53n and a plurality of actuator 54m, as well as the engine 55, are connected to the component 51 , as shown by the block diagram of Figure 7B.
[00135] The component 51 may comprise a memory or a microprocessor 52 running the firmware or finite state machine and implementing the above described method.
[00136] The component 51 further comprises a HASH calculator 56 as means for calculating HASH values; more particularly, the HASH calculator 56 calculates first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine.
[00137] The component 51 comprises a HASH storage 57 as storing means for storing the initial first or G-HASH values as calculated before the running of the firmware or finite state machine.
[00138] Furthermore, the component 51 may comprise an instruction/ state validator 59 as means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths.
[00139] Finally, the component 51 may comprise warning means 60 as output means providing the result of the comparison between the first and second HASH values in the form of a warning signal.
[00140] The HASH calculator and the HASH comparator, as well as the instruction/ state validator and the warning means 60 may be electronic circuits, microprocessors or microcontrollers and/or portions of an electronic device or microprocessor/microcontroller; they may also be computer instructions stored in a computer-readable medium that may be executed by a controller or a computer.
[00141] The HASH storage 57 may be a memory, a memory portion of an electronic device or a database.
[00142] Summing up, the present disclosure provides that a method for evaluating a firmware or a finite state machine (FSM) to improve safety of a component or system running the same by detecting anomalous sequences of routines or states in such firmware or finite state machine during their execution that could potentially trigger wrong or inconsistent signals leading to potentially dangerous situations for the corresponding component or system.
[00143] The method provides for a safety methodology to check the run-time of the firmware or finite state machine of a component and/or system using:
• Pure logic;
• Analog components; and
• Mixed analog/logic signals.
[00144] In this way, the method provides for a strong contribution to the ASIL, i.e. the Automotive Safety Integrity Level, a risk classification scheme defined by the ISO 26262, associated with a component, especially a memory device. It is in fact well known that using a memory is considered very weak by the safety standards, because the associated index of the memory is very bad; in other word, the memory devices are assumed and not reliable. Using the method as above described would overcome this problem.
[00145] Moreover, the method according to the present disclosure is an improved methodology to check the component and/or system life phases:
• Power on
• Secure update
• Run-time
[00146] The method according to the present disclosure suitably uses the HASH functions and thus is able to avoid collision in un-intended branches, in particular when using the SHA 256. Suitably, compact the log data are obtained and thus not large log report are required. Also, the history of the execution steps to track the correct execution is reduced and linked as a chain, thanks to the calculation of the HASH value of a watchpoint under examination as linked to the HASH values of the previous watchpoints; in this regards, it should be further remarked that the path is uniquely determined because each watchpoint contributes to the HASH final value. Finally, the correctness of all the possible paths from the start point to an end point in a firmware /FSM are suitably traced.
[00147] In the preceding detailed description, reference is made to the accompanying drawings that form a part hereof, and in which is shown, by way of illustration, specific examples. In the drawings, like numerals describe substantially similar components throughout the several views. Other examples may be utilized, and structural, logical and/or electrical changes may be made without departing from the scope of the present disclosure.
[00148] Similar elements or components between different figures may be identified by the use of similar digits. As will be appreciated, elements shown in the various embodiments herein can be added, exchanged, and/or eliminated so as to provide a number of additional embodiments of the present disclosure. In addition, as will be appreciated, the proportion and the relative scale of the elements provided in the figures are intended to illustrate the embodiments of the present disclosure and should not be taken in a limiting sense.
[00149] As used herein, "a," "an," or "a number of ' something can refer to one or more of such things. A "plurality" of something intends two or more. As used herein, the term "coupled" may include electrically coupled, directly coupled, and/or directly connected with no intervening elements (e.g., by direct physical contact) or indirectly coupled and/or connected with intervening elements. The term coupled may further include two or more elements that co-operate or interact with each other (e.g., as in a cause and effect relationship).
[00150] Although specific examples have been illustrated and described herein, those of ordinary skill in the art will appreciate that an arrangement calculated to achieve the same results can be substituted for the specific embodiments shown. This disclosure is intended to cover adaptations or variations of one or more embodiments of the present disclosure. It is to be understood that the above description has been made in an illustrative fashion, and not a restrictive one. The scope of one or more examples of the present disclosure should be determined with reference to the appended claims, along with the full range of equivalents to which such claims are entitled.

Claims

1. A method comprising the steps of:
- analyzing a firmware or a finite state machine, decomposing the same into a plurality of routines or states and individuating significative instructions or states;
- associating each significative instruction or state with a watchpoint;
- calculating first HASH values of the watchpoints by means of a HASH function before running the firmware or finite state machine for all allowable paths in the firmware or finite state machine corresponding to a correct working of the same;
- storing the set of first HASH values as calculated;
- calculating second HASH values of the watchpoints by means of a HASH function when running of the firmware or finite state machine;
- comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths.
2. The method of claim 1 , wherein the significative instructions or states are begin/end instructions of routines of the firmware or specific executions states of the finite state machine.
3. The method of claim 1 , wherein the step of calculating the first HASH values and the step of calculating the second HASH values uses a same HASH function.
4. The method of claim 1 , wherein the HASH function is the cryptographic HASH function or Secure Hash Algorithm SHA-256.
5. The method of claim 1 , wherein the step of calculating the first HAS values is performed for a firmware during a compiling phase and for a finite state machine during a synthesis phase.
6. The method of claim 1 , wherein the step of comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values is made starting from the first watchpoint in the runtime of the firmware or finite state machine or from any watchpoint in the debug and/or validation procedures of the firmware or finite state machine.
7. The method of claim 1 , further comprising the step of calculating cumulated HASH values of a sequence of instructions or states by linking a HASH value of a watchpoint under examination to HASH values of previous watchpoints according to the following formula:
FT_HASHk = HASH[FT_HASHk-i | HASH (watchpoint WP#i)], being
FT_HASH: cumulated HASH value;
watchpoint WP#i: watchpoint under examination
k: current clock period;
k- 1 : previous clock period; and
I : union between HASH values, the cumulated HASH value being calculated by applying the HASH function at each step of the routines of a firmware or at each transition between states of a finite state machine.
8. The method of claim 7, wherein the second HASH value of an end watchpoint of the sequence of instructions or states is the last cumulated HASH value as calculated.
9. The method of claim 8, further comprising a step of storing the cumulated HASH values as calculated for each watchpoint being examined.
10. The method of claim 1 , wherein the first and second HASH values of a watchpoint is calculated by using a program counter value of the corresponding instruction for a firmware or a status for a finite state machine.
1 1. The method of claim 1 , further comprising a step of outputting a result of the comparison step between the first and second HASH values for indicating a wrong or potentially dangerous sequence of instructions or states for the firmware or finite state machine under examination in the form of a warning signal.
12. The method of claim 1 , wherein the step of associating the significative instructions or states and the watchpoints is performed in an automatic manner based on a list during the design of the firmware or finite state machine.
13. The method of claim 1 , wherein the step of associating the significative instructions or states and the watchpoints is performed in a manual manner based on design choices during the design of the firmware or finite state machine.
14. A component running a firmware or a finite state machine and comprising:
- means for calculating HASH values associated to watchpoints of significative instructions or states of the firmware or finite state machine by means of a HASH function, the means for calculating HASH values calculating first HASH values before running the firmware or finite state machine and second HASH values when running the firmware or finite state machine;
- means for storing the set of first HASH values;
- means for comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values of the allowed paths.
15. The component of claim 14, further comprising:
- means for calculating cumulated HASH values of a sequence of instructions or states by linking a HASH value of a watchpoint under examination to HASH values of previous watchpoints according to the following formula:
FT_HASHk = HASH[FT_HASHk-i | HASH (watchpoint WP#i)], being
FT_HASH: cumulated HASH value;
watchpoint WP#i: watchpoint under examination
k: current clock period;
k- 1 : previous clock period; and
I : union between HASH values,
the cumulated HASH value being calculated by applying the HASH function at each step of the routines of a firmware or at each transition between states of a finite state machine; and
- an additional register to store the cumulated HASH values corresponding to all the already visited watchpoints of the firmware or finite state machine.
16. The component of claim 14, wherein the means for calculating HASH values are comprised into one of a compiler or a tool generating the hardware code of the component.
17. The component of claim 14, further comprising output means providing the result of the comparison between the first and second HASH values in the form of a warning signal, when such a comparison has indicated a wrong or potentially dangerous sequence of instructions or states for the firmware or finite state machine of the component.
18. The component of claim 14 being included in one of: a vehicle, an airplane or a control system of a plant.
19. A method comprising the steps of:
- analyzing a sequence of instructions and individuating significative ones;
- associating each significative instruction with a watchpoint;
- calculating first unique values of the watchpoints by means of a predefined function before executing the sequence of instructions for all allowable paths in the sequence of instructions corresponding to a correct working of the same;
- storing the set of first unique values as calculated;
- calculating second unique values of the watchpoint by means of a predefined function when executing the sequence of instructions;
- comparing the second unique value of each watchpoint as calculated with the stored set of first unique values; and
- validating the instruction of a watchpoint as correct if its second unique value is comprised in the first unique values of the allowed paths.
20. The method of claim 19, wherein the step of calculating the first unique values and the step of calculating the second unique values uses a same predefined function.
21. The method of claim 19, wherein the step of comparing the second unique value of each watchpoint as calculated with the stored set of first unique values is made starting from the first watchpoint in the runtime of the firmware or finite state machine or from any watchpoint in the debug and/or validation procedures of the firmware or finite state machine.
22. The method of claim 19, farther comprising a step of outputting a result of the comparison step between the first and second unique values for indicating a wrong or potentially dangerous instruction in the sequence in the form of a warning signal.
23. The method of claim 19, wherein the sequence of instructions is a plurality of routines or states of a firmware or a finite state machine and the predefined function is a HASH function.
24. A method comprising the steps of:
- calculating, based on a predefined function, a current unique value of a watchpoint associated to a significative instruction when executing a sequence of instructions;
- comparing the current unique value of the watchpoint as calculated with a set of stored unique values; and
- validating the instruction of the watchpoint as correct if its current unique value is comprised in the set of stored unique values.
25. The method of claim 24, wherein the set of stored unique values comprises unique values associated to all allowable paths in the sequence of instructions corresponding to a correct working of the same.
26. The method of claim 24, wherein the calculating comprises calculating a HASH values.
27. An apparatus comprising:
- a component configured to run a firmware or a finite state machine;
- means for storing the firmware or finite state machine;
- a plurality of sensors connected to the component and configured to provide thereto input signals; and
- a plurality of actuators connected to the component and configured to receive therefrom control signals,
the component including: - means for storing a set of first HASH values;
- means for calculating HASH values associated to watchpoints of significative instructions or states of the firmware or finite state machine by means of a HASH function, the means for calculating HASH values being configured to calculate second HASH values when the component is running the firmware or finite state machine;
- means for comparing the second HASH value of each watchpoint as calculated with the stored set of first HASH values; and
- means for validating the instruction or state of a watchpoint as correct if its second HASH value is comprised in the set of first HASH values.
28. The apparatus of claim 27, wherein the component further comprises output means configured to provide the result of the comparison between the first and second HASH values in the form of a warning signal, when such a comparison has indicated a wrong or potentially dangerous sequence of instructions or states for the firmware or finite state machine of the component.
29. The apparatus of claim 27 being a vehicle, an airplane or a control system of a plant.
PCT/IB2019/000089 2019-02-22 2019-02-22 Method for improving safety of a component or system running a firmware or a finite state machine Ceased WO2020169997A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US16/624,070 US11477030B2 (en) 2019-02-22 2019-02-22 Method for improving safety of a component or system running a firmware or a finite state machine
PCT/IB2019/000089 WO2020169997A1 (en) 2019-02-22 2019-02-22 Method for improving safety of a component or system running a firmware or a finite state machine
CN201980092384.5A CN113474772B (en) 2019-02-22 2019-02-22 Method for improving the security of a component or system running firmware or a finite state machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/IB2019/000089 WO2020169997A1 (en) 2019-02-22 2019-02-22 Method for improving safety of a component or system running a firmware or a finite state machine

Publications (1)

Publication Number Publication Date
WO2020169997A1 true WO2020169997A1 (en) 2020-08-27

Family

ID=65995788

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/IB2019/000089 Ceased WO2020169997A1 (en) 2019-02-22 2019-02-22 Method for improving safety of a component or system running a firmware or a finite state machine

Country Status (3)

Country Link
US (1) US11477030B2 (en)
CN (1) CN113474772B (en)
WO (1) WO2020169997A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102719427B1 (en) * 2019-06-10 2024-10-21 구글 엘엘씨 Secure verification of firmware
US11698969B1 (en) * 2021-06-25 2023-07-11 Amazon Technologies, Inc. Boot security of integrated circuit device
US12358518B2 (en) * 2021-09-24 2025-07-15 Embark Trucks, Inc. Autonomous vehicle automated scenario characterization

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1843250A1 (en) * 2006-04-05 2007-10-10 Texas Instruments France System and method for checking the integrity of computer program code
US20110302651A1 (en) * 2010-06-03 2011-12-08 International Business Machines Corporation Verification of a segmented program on a parallel processing computing system

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7194626B2 (en) * 2002-11-21 2007-03-20 International Business Machines Corporation Hardware-based secure code authentication
DE102007038763A1 (en) * 2007-08-16 2009-02-19 Siemens Ag Method and device for securing a program against a control flow manipulation and against a faulty program sequence
US8904189B1 (en) * 2010-07-15 2014-12-02 The Research Foundation For The State University Of New York System and method for validating program execution at run-time using control flow signatures
US8627097B2 (en) * 2012-03-27 2014-01-07 Igt System and method enabling parallel processing of hash functions using authentication checkpoint hashes
US8843900B2 (en) * 2012-06-12 2014-09-23 Microsoft Corporation Serial debugging experience for parallel programs
US9294282B1 (en) * 2013-07-01 2016-03-22 Amazon Technologies, Inc. Cryptographically verified repeatable virtualized computing
US20160295416A1 (en) * 2015-04-02 2016-10-06 Qualcomm Incorporated Method and apparatus for performing a message integrity check
US10331513B2 (en) * 2015-07-28 2019-06-25 Microchip Technology Incorporated Zero overhead code coverage analysis
US11036866B2 (en) * 2018-10-18 2021-06-15 Denso Corporation Systems and methods for optimizing control flow graphs for functional safety using fault tree analysis

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1843250A1 (en) * 2006-04-05 2007-10-10 Texas Instruments France System and method for checking the integrity of computer program code
US20110302651A1 (en) * 2010-06-03 2011-12-08 International Business Machines Corporation Verification of a segmented program on a parallel processing computing system

Also Published As

Publication number Publication date
US20210344499A1 (en) 2021-11-04
CN113474772A (en) 2021-10-01
CN113474772B (en) 2024-06-07
US11477030B2 (en) 2022-10-18

Similar Documents

Publication Publication Date Title
Abdulkhaleq et al. A comprehensive safety engineering approach for software-intensive systems based on STPA
KR101744226B1 (en) System and method for providing diagnostic fault information
US11477030B2 (en) Method for improving safety of a component or system running a firmware or a finite state machine
CN105912413B (en) Method and device for evaluating the availability of a system, in particular a safety-critical system
Rana et al. Increasing efficiency of iso 26262 verification and validation by combining fault injection and mutation testing with model based development
Rösch et al. Model-based testing of PLC software: test of plants' reliability by using fault injection on component level
CN110245085A (en) The embedded real-time operating system verification method and system examined using on-time model
US9898379B2 (en) Method for measuring the effect of microscopic hardware faults in high-complexity applications implemented in a hardware electronic system, and corresponding system and computer program product
Schildbach On the application of ISO 26262 in control design for automated vehicles
Fritzsch et al. Experiences from large-scale model checking: Verifying a vehicle control system with nusmv
US10437656B2 (en) Method for automatically determining causes of the malfunction of a system made up of a plurality of hardware or software components
US9304171B2 (en) Computer-implemented method for generating software, a battery, and a motor vehicle
Basit-Ur-Rahim et al. Modeling of real-time embedded systems using SysML and its verification using UPPAAL and DiVinE
Przigoda et al. Contradiction analysis for inconsistent formal models
Mueller-Gritschneder et al. System C-based multi-level error injection for the evaluation of fault-tolerant systems
KR101834247B1 (en) Method and apparatus for analyzing safety of automotive software
Chabot et al. Automatic and configurable instrumentation of C programs with temporal assertion checkers
Dong et al. Discovering Blind-Trust Vulnerabilities in PLC Binaries via State Machine Recovery.
Li et al. Fast LTL satisfiability checking by SAT solvers
US12190105B2 (en) Method for controlling a robotic device
CN114003505A (en) Method and device for auditing intelligent contracts
Guerrouat et al. A formal approach for analysis and testing of reliable embedded systems
US12748414B2 (en) Fault injection test method and apparatus, and fault injection method
Popovici et al. Formal model and code verification in Model-Based Design
US20240231347A1 (en) Fault injection test method and apparatus, and fault injection method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19714776

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19714776

Country of ref document: EP

Kind code of ref document: A1