Skip to content

Commit

Permalink
Clean up endianness doc.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Oct 11, 2023
1 parent 7b317c0 commit b8d92d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
18 changes: 9 additions & 9 deletions doc/api/common_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,27 +299,27 @@ Enumeration value used for the `libspdm_set_data` and/or `libspdm_get_data` func
- Specifies how verification of asymmetric signatures is handled when the negotiated SPDM
version is 1.0 or 1.1. Its value is one of
- `LIBSPDM_SPDM_10_11_VERIFY_SIGNATURE_ENDIAN_BIG_ONLY`
- The endianness of the signature is only interpreted as big-endian.
- The endianness of the signature is only interpreted as big-endian. (default)
- `LIBSPDM_SPDM_10_11_VERIFY_SIGNATURE_ENDIAN_LITTLE_ONLY`
- The endianness of the signature is only interpreted as little-endian.
- `LIBSPDM_SPDM_10_11_VERIFY_SIGNATURE_ENDIAN_BIG_OR_LITTLE`
- The endianness of the signature is first interpreted as big-endian. If verification
fails then little-endian is tried.
- `LIBSPDM_DATA_SEQUENCE_NUMBER_ENDIAN`
- Specifies the endianness of the AEAD sequence number used in secured message encryption and
decryption. Its value is one of
decryption when the negotiated secured SDPM version is 1.0 or 1.1. Its value is one of
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_LITTLE_DEC_LITTLE`
- Data is both encrypted and decrypted with a little-endian sequence number. (default)
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_LITTLE_DEC_BOTH`
- Data is encrypted with a little-endian sequence number and data is initially decrypted
with a little-endian sequence number. If decryption fails then a big-endian sequence
number is tried.
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_LITTLE_DEC_LITTLE`
- Data is both encrypted and decrypted with a little-endian sequence number.
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_BIG_DEC_BIG`
- Data is both encrypted and decrypted with a big-endian sequence number.
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_BIG_DEC_BOTH`
- Data is encrypted with a big-endian sequence number and data is initially decrypted
with a big-endian sequence number. If decryption fails then a little-endian sequence
number is tried.
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_BIG_DEC_BIG`
- Data is both encrypted and decrypted with a big-endian sequence number.
- For practical purposes `*_BOTH` only applies to Responder endpoints. In the scenario where
Requester and Responder exclusively support different endianness encodings, the Responder may
return a `DecryptError` to the Requester or it may not return an error and terminate the
Expand Down Expand Up @@ -367,9 +367,9 @@ Enumeration value used for the `libspdm_set_data` and/or `libspdm_get_data` func
- This value is only applicable when the local endpoint is in the
`LIBSPDM_SESSION_STATE_ESTABLISHED` state.
- `LIBSPDM_DATA_SESSION_SEQUENCE_NUMBER_ENDIAN`
- For a given session ID, returns the endianness of the AEAD sequence number. Its value is one
of
- For a given session ID, returns the endianness of the AEAD sequence number when the
negotiated secured SDPM version is 1.0 or 1.1. Its value is one of
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_LITTLE_DEC_LITTLE`
- The endianness of the sequence number is little-endian.
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_BIG_DEC_BOTH`
- `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_BIG_DEC_BIG`
- The endianness of the sequence number is big-endian.
9 changes: 6 additions & 3 deletions doc/crypto_endianness.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ When the negotiated SPDM version is 1.2 or later libspdm follows these definitio
SPDM 1.0 and 1.1 did not specify the endianness of the RSA and ECDSA digital signatures. libspdm
allows an Integrator to specify the endianness when verifying RSA and ECDSA signatures through
`LIBSPDM_DATA_SPDM_VERSION_10_11_VERIFY_SIGNATURE_ENDIAN` when the negotiated SPDM version is 1.0 or
1.1.
1.1. The default value is `LIBSPDM_SPDM_10_11_VERIFY_SIGNATURE_ENDIAN_BIG_ONLY`.
Please refer to [common_api](https://github.com/DMTF/libspdm/blob/main/doc/api/common_api.md).

## Endianness of key exchange data

Expand All @@ -26,5 +27,7 @@ libspdm follows that for SPDM 1.1+. Because the definition aligns with existing

Versions 1.0 and 1.1 of the Secured Messages using SPDM specification do not explicitly specify how
the AEAD IV is formed. In particular the endianness of the sequence number is either missing (1.0)
or ill-defined (1.1). As such libspdm supports both little-endian and big-endian encoding of the
sequence number, as well as automatically swapping endianness if decryption fails.
or ill-defined (1.1). libspdm allows an Integrator to specify the endianness encoding of the
sequence number through `LIBSPDM_DATA_SEQUENCE_NUMBER_ENDIAN` when the negotiated Secured SPDM
version is 1.0 or 1.1. The default value is `LIBSPDM_DATA_SESSION_SEQ_NUM_ENC_LITTLE_DEC_LITTLE`.
Please refer to [common_api](https://github.com/DMTF/libspdm/blob/main/doc/api/common_api.md).

0 comments on commit b8d92d4

Please sign in to comment.