Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: inside-secure - Prevent missing of processing errors

On systems with coherence issues, packet processed could succeed while
it should have failed, e.g. because of an authentication fail.
This is because the driver would read stale status information that had
all error bits initialised to zero = no error.
Since this is potential a security risk, we want to prevent it from being
a possibility at all. So initialize all error bits to error state, so
that reading stale status information will always result in errors.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@rambus.com>
Acked-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Pascal van Leeuwen and committed by
Herbert Xu
bd03b021 9b20cbf8

+5 -4
+5 -4
drivers/crypto/inside-secure/safexcel_ring.c
··· 236 236 237 237 rdesc->particle_size = len; 238 238 rdesc->rsvd0 = 0; 239 - rdesc->descriptor_overflow = 0; 240 - rdesc->buffer_overflow = 0; 239 + rdesc->descriptor_overflow = 1; /* assume error */ 240 + rdesc->buffer_overflow = 1; /* assume error */ 241 241 rdesc->last_seg = last; 242 242 rdesc->first_seg = first; 243 243 rdesc->result_size = EIP197_RD64_RESULT_SIZE; ··· 245 245 rdesc->data_lo = lower_32_bits(data); 246 246 rdesc->data_hi = upper_32_bits(data); 247 247 248 - /* Clear length & error code in result token */ 248 + /* Clear length in result token */ 249 249 rtoken->packet_length = 0; 250 - rtoken->error_code = 0; 250 + /* Assume errors - HW will clear if not the case */ 251 + rtoken->error_code = 0x7fff; 251 252 252 253 return rdesc; 253 254 }