diff options
author | 2021-01-28 17:19:40 +0000 | |
---|---|---|
committer | 2021-01-28 17:19:40 +0000 | |
commit | a9e3069823853aac108b29b8442bd125a8b06a24 (patch) | |
tree | 00d0ebbecac0450e0935dfc264e8ed4f52f158c6 /lib/libssl/tls12_record_layer.c | |
parent | Move AEAD handling into the new TLSv1.2 record layer. (diff) | |
download | wireguard-openbsd-a9e3069823853aac108b29b8442bd125a8b06a24.tar.xz wireguard-openbsd-a9e3069823853aac108b29b8442bd125a8b06a24.zip |
tpm(4): fix delay units
tpm(4) has timeout constants in milliseconds, e.g.
#define TPM_ACCESS_TMO 2000 /* 2sec */
This is fine.
The odd thing is that tpm(4) first converts these timeouts to counts
of ticks via tpm_tmotohz() before using DELAY() to busy-wait. DELAY()
takes a count of microseconds, which are not equivalent to ticks, so
the units are all screwed up.
Let's correct this:
- Remove tpm_tmotohz(). We're not working with ticks so we don't it.
- Multiply the timeouts to match the delay interval. tpm_request_locality()
and tpm_getburst() use intervals of 10 microseconds, so multiply the
millisecond timeouts by 100. In tpm_waitfor() the delay interval is 1
microsecond, so multiply the millisecond timeout by 1000.
- Update the parameter name in tpm_waitfor() to note that we expect a
count of milliseconds, not "tries".
Discussion: https://marc.info/?l=openbsd-tech&m=160995671326406&w=2
Prompted by kettenis@.
Suspend/resume tested by florian@ on an X1 Gen 2. For the record, it
looks like this:
tpm0 at acpi0 TPM_ addr 0xfed40000/0x5000, device 0x0000104a rev 0x4e
Earlier versions of this patch were reviewed by kn@, but the patch
became more ambitious when kettenis@ got involved so those reviews
are no longer applicable.
jcs@ notes (https://marc.info/?l=openbsd-tech&m=160834427630142&w=2)
in a related discussion that this driver "sucks" and should be
replaced with NetBSD's rewrite. This would get us a cleaner driver
with TPM 2.0 support. So there is future work to do here.
ok kettenis@
Diffstat (limited to 'lib/libssl/tls12_record_layer.c')
0 files changed, 0 insertions, 0 deletions