[Open Crypto Project] #63: RPC does not recover gracefully from lost synchronization

Open Crypto Project trac at cryptech.is
Fri Jul 8 00:18:05 UTC 2016


#63: RPC does not recover gracefully from lost synchronization
---------------------+---------------------------------------
  Reporter:  sra     |      Owner:
      Type:  defect  |     Status:  closed
  Priority:  major   |  Milestone:  Alpha board DNSSEC signer
 Component:  HAL     |    Version:
Resolution:  fixed   |   Keywords:
Blocked By:          |   Blocking:
---------------------+---------------------------------------
Changes (by pselkirk):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 It's a nasty bit of timing. After the probe, there are 2 bytes left in the
 receive buffer. When it get the initial {{{SLIP_END}}} from the next
 legitimate request, it flushes the two bytes to
 {{{hal_rpc_server_dispatch}}}, which sends a {{{HAL_ERROR_BAD_FUNCTION}}}
 response. The next byte of the incoming request hits
 {{{HAL_UART2_RxCpltCallback}}}, which calls {{{HAL_UART_Receive_IT}}}, but
 the uart is locked, so it fails with {{{HAL_BUSY}}}. We never retry, so
 the HSM goes deaf on the user port.

 One piece of the solution is to actually check the {{{xdr_decode}}} return
 values, and drop this "packet" (a legitimate request is a minimum of 8
 bytes).

 The other piece of the solution is to signal {{{dispatch_thread}}} to call
 {{{HAL_UART_Receive_IT}}} after it's done transmitting.

 Fixed in commits ec8b12c (libhal) and b3bce36 (stm32).

--
Ticket URL: <https://trac.cryptech.is/ticket/63#comment:1>
Open Crypto Project <https://wiki.cryptech.is/>



More information about the Ticket-BCC mailing list