@@ -132,7 +132,7 @@ int TPM2_Keygen_Example(void* userCtx, int argc, char *argv[])
132132 WOLFTPM2_KEYBLOB primaryBlob ; /* Primary key as WOLFTPM2_KEYBLOB */
133133 TPMT_PUBLIC publicTemplate ;
134134 TPMI_ALG_PUBLIC alg = TPM_ALG_RSA ; /* default, see usage() for options */
135- TPMI_ALG_PUBLIC srkAlg = TPM_ALG_ECC ; /* prefer ECC, but allow RSA */
135+ TPMI_ALG_PUBLIC srkAlg = TPM_ALG_RSA ; /* default matches seal.c / keyload.c */
136136 TPM_ALG_ID algSym = TPM_ALG_CTR ; /* default Symmetric Cipher, see usage */
137137 TPM_ALG_ID paramEncAlg = TPM_ALG_NULL ;
138138 WOLFTPM2_SESSION tpmSession ;
@@ -222,8 +222,10 @@ int TPM2_Keygen_Example(void* userCtx, int argc, char *argv[])
222222 XMEMSET (& tpmSession , 0 , sizeof (tpmSession ));
223223 XMEMSET (& auth , 0 , sizeof (auth ));
224224
225- if (alg == TPM_ALG_RSA )
226- srkAlg = TPM_ALG_RSA ;
225+ /* Only use the ECC SRK for ECC child keys; RSA, SYMCIPHER, KEYEDHASH
226+ * all stay on the RSA SRK so that keyload/seal can round-trip them. */
227+ if (alg == TPM_ALG_ECC )
228+ srkAlg = TPM_ALG_ECC ;
227229 if (alg == TPM_ALG_SYMCIPHER ) {
228230 rc = symChoice (symMode , & algSym , & keyBits );
229231 if (rc != TPM_RC_SUCCESS ) {
0 commit comments