Skip to content

Backport Changes from the Internal Repository#1

Open
josephlr wants to merge 9 commits into
mainfrom
backports
Open

Backport Changes from the Internal Repository#1
josephlr wants to merge 9 commits into
mainfrom
backports

Conversation

@josephlr
Copy link
Copy Markdown
Member

@josephlr josephlr commented May 7, 2026

See the individual commit messages for more information about each change.

The main thing this does it allow the Reference Code to be built without warnings on C11 and to Support OpenSSL 3.6.

Other that that, there are two functional changes:

  • Removing TPM2_CertifyX509 (deprecated in v184)
  • Only enabling TPM_RH_ACT_0 by default (instead of also enabling TPM_RH_ACT_A)

nnooney and others added 9 commits March 12, 2026 00:43
'error: function declaration isn't a prototype [-Werror=strict-prototypes]'

TrustedComputingGroup/TPM-Internal@dbcbb61

Signed-off-by: Joe Richey <joerichey@google.com>
In OpenSSL, `BIGNUM` is defined as:
```c
typedef struct bignum_st BIGNUM;
```
in https://github.com/openssl/openssl/blame/openssl-3.6.0/include/openssl/types.h#L96

This opaque type is defined as
```c
struct bignum_st {
    BN_ULONG *d;
    int top;
    int dmax;
    int neg;
    int flags;
};
```
in an internal header https://github.com/openssl/openssl/blob/openssl-3.6.0/crypto/bn/bn_local.h#L245-L256

Thus, on every OpenSSL version, we need to check that the definition is unchanged.

For OpenSSL 3.6, it is unchanged, so we increment the minimum unsupported version to 3.7.

TrustedComputingGroup/TPM-Internal@0b95067

Signed-off-by: Joe Richey <joerichey@google.com>
In C, empty parameter lists require `void` in the declaration.

This change also gives `UpgradeNvData` internal linkage as it is
not (yet) part of the Platform API.

TrustedComputingGroup/TPM-Internal@8b1dc3a

Signed-off-by: Joe Richey <joerichey@google.com>
This causes a warning (`-Wnewline-eof`) with some compilers/configurations.

For future files, this should be caught by the clang-format presubmit hook.

This was generated by running:
```bash
sed -i '$a\' **/*.h **/*.c
```

TrustedComputingGroup/TPM-Internal@471cf6f

Signed-off-by: Joe Richey <joerichey@google.com>
This was added in C99, and lets us avoid environment specific `ifdef`s.

TrustedComputingGroup/TPM-Internal@023eebd

Signed-off-by: Joe Richey <joerichey@google.com>
This change:
  - Makes the formatting consistent by removing helper macros
  - Adds comments containing the decimal OID for each value
  - Makes the file easier to read by adding more OID prefix constants
  - Follows up on a comment to confirm an OID value

TrustedComputingGroup/TPM-Internal#451

Signed-off-by: Joe Richey <joerichey@google.com>
This change deletes all the code for CertifyX509 (which was deprecated in the 184 spec). Note that the attribute `TPM_A_OBJECT.x509Sign` sticks around. We anticipate re-using it in the future with a differently designed command.

TrustedComputingGroup/TPM-Internal#367

Signed-off-by: Joe Richey <joerichey@google.com>
Similar to `NORETURN`, this uses `FALLTHROUGH` as a placeholder for
`[[fallthrough]]` until C23 is supported.

TrustedComputingGroup/TPM-Internal#450

Signed-off-by: Joe Richey <joerichey@google.com>
When binding to the reference implementation, while it is convient to
have ACT support enabled by default, having two ACTs on by default is
very odd. On systems with ACTs, the vast majority will have only one.

TrustedComputingGroup/TPM-Internal#524

Signed-off-by: Joe Richey <joerichey@google.com>
#if defined _POSIX_
# define FUNCTION_NAME 0
#else
# define FUNCTION_NAME __FUNCTION__
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ssure about this. there are some posix-strict implementations. Do they require this? or does the change to C11 change this on POSIX?

#define TPM_CC_AC_GetCapability (TPM_CC)(0x00000194)
#define TPM_CC_AC_Send (TPM_CC)(0x00000195)
#define TPM_CC_Policy_AC_SendSelect (TPM_CC)(0x00000196)
#define TPM_CC_CertifyX509 (TPM_CC)(0x00000197)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At very least we should leave a define that marks 0x197 forever reserved.

+ CC_AC_GetCapability /* 0x00000194 */ \
+ CC_AC_Send /* 0x00000195 */ \
+ CC_Policy_AC_SendSelect /* 0x00000196 */ \
+ CC_CertifyX509 /* 0x00000197 */ \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto on reserved placeholder. we don't want anyone to think its a usable gap, or worse "fix" the comments.

return result;
}

#endif // CC_ECDH_KeyGen No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could/should we fix all these line ending changes in a single/separate "format-only" change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants