aboutsummaryrefslogtreecommitdiff
path: root/hal_io_i2c.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-07-31 23:06:33 -0400
committerPaul Selkirk <paul@psgd.org>2017-07-31 23:06:33 -0400
commit63636301593c8a3952afae61c1b5f279c27f69ea (patch)
treeb3a72e1a154fd2efb6fa66d53619b58b64920df4 /hal_io_i2c.c
parent19f92790c2f9fc7f4e019d7b20663453606f210f (diff)
Unconditionally set the allocated flag when initializing a hash state
structure. When running multiple concurrent unit tests, I observed multiple failures in the hmac tests, which I ultimately tracked down to different clients sharing the same hal_hmac_state struct. hal_hash_initialize is called twice in hal_hmac_initialize (once to get the state structure, then again if the supplied key is too long), and is called in hal_hmac_finalize, to hash the digest with the supplied key. In these subsequent cases, the caller supplies the state structure, which hal_hash_initialize zeroes, but it doesn't set the allocated flag. This marks an in-use struct as available, so it gets reassigned and reinitialized, and Bad Things Happen for both clients that are trying to use it.
Diffstat (limited to 'hal_io_i2c.c')
0 files changed, 0 insertions, 0 deletions