29ebeccc | 30-Jan-2023 |
Wei Liu <liuwe@microsoft.com> |
tpm: be more consistent when converting responses
Do the following:
1. Use from_be_bytes to drop mutable slices. 2. Check for the exact buffer size throughout. 3. Simplify ptm_to_request where poss
tpm: be more consistent when converting responses
Do the following:
1. Use from_be_bytes to drop mutable slices. 2. Check for the exact buffer size throughout. 3. Simplify ptm_to_request where possible. 4. Make error messages style consistent.
Fix a typo in code comment while at it.
Signed-off-by: Wei Liu <liuwe@microsoft.com>
show more ...
|
5646a917 | 30-Jan-2023 |
Wei Liu <liuwe@microsoft.com> |
tpm: handle short write
There is no guarantee that the write can send the whole buffer at once.
In those rare occasions, we should return a sensible error.
Signed-off-by: Wei Liu <liuwe@microsoft.
tpm: handle short write
There is no guarantee that the write can send the whole buffer at once.
In those rare occasions, we should return a sensible error.
Signed-off-by: Wei Liu <liuwe@microsoft.com>
show more ...
|
6e22f238 | 30-Jan-2023 |
Wei Liu <liuwe@microsoft.com> |
tpm: save almost 8KB stack space
The largest possible PTM response is only 16 bytes. Size the output buffer correctly.
In the socket read function, rely on the caller to provide a sufficiently larg
tpm: save almost 8KB stack space
The largest possible PTM response is only 16 bytes. Size the output buffer correctly.
In the socket read function, rely on the caller to provide a sufficiently large buffer. That eliminates another large stack variable.
In total this saves almost 8KB stack space.
Signed-off-by: Wei Liu <liuwe@microsoft.com>
show more ...
|
1ce1fe73 | 25-Jan-2023 |
Wei Liu <liuwe@microsoft.com> |
tpm: rework set_buffer_size
Make the code more idiomatic by wrapping the actual size configured in the returning Result type. This further allows simplifying get_buffer_size.
The debug message in s
tpm: rework set_buffer_size
Make the code more idiomatic by wrapping the actual size configured in the returning Result type. This further allows simplifying get_buffer_size.
The debug message in startup_tpm is more useful if it prints out the actual size than the wanted size.
No functional change.
Signed-off-by: Wei Liu <liuwe@microsoft.com>
show more ...
|