Revise KeymasterMessage versioning system
This CL revamps the KeymasterMessage versioning system, to address a
couple of flaws. First, the message versioning system didn't support
the case where the client was older than the server. Second,
implementations largely weren't actually using the versioning system
at all. Specifically, it:
1. Removes the default of the message version argument from the
KeymasterRequest/Response constructors. Keymaster implementations
had entirely ignored message versioning, resulting in
brittleness. By not providing a default, we force implementors to
think about message versioning, and to use the version negotiation
infrastructure.
2. Adds a new version negotiation mechanism, creatively called
GetVersion2, with corresponding new request and response objects.
The previous mechanism assumed that all adjustment for version
differences between client and server could be done by the client,
but that presumes that the client is always at least as new as the
server, so that it can understand the server version and adapt
accordingly. It turns out that this is a bad assumption; in some
cases the server may be newer than the client. The new approach
is a mutual exchange of maximum message versions understood and
the negotiation consists of both sides using the min of the two
maxes.
3. Defines a protocol for clients and servers to manage the
situation that the other side doesn't underderstand GetVersion2.
Bug: 171846199
Test: keymster_tests
Change-Id: Ibea104c39942c6c88523688306a030f40e9b150f
15 files changed