@@ -201,7 +201,7 @@ func serializePublicKey(pub crypto.PublicKey) (string, error) {
201201// Unfortunatelly some TPMs have a non rsa2048 key in the commonRSAEkEquivalentHandle
202202// handle location. Thus we need an alternative handle to use for both creating
203203// and searching for the rsa2048 ek.
204- // The "Registry-of-Reserved-TPM-2.0-Handles-and-Localities-Version 1.2" section 2.3.4
204+ // The "Registry-of-Reserved-TPM-2.0-Handles-and-Localities-Version 1.2" section 2.3.1
205205// asserts that persistent EK handles should be in the range 0x8101000-0x810100FF
206206// Thus any value in this range is acceptable, so we arbitrarily chose
207207// a value inmediatelly after the ECC (p256) handle.
@@ -228,11 +228,11 @@ func (t *wrappedTPM20) getKeyHandleKeyMap() (map[string]tpmutil.Handle, map[tpmu
228228 if pub .RSAParameters != nil || pub .ECCParameters != nil {
229229 key , err := pub .Key ()
230230 if err != nil {
231- return nil , nil , err
231+ return nil , nil , fmt . Errorf ( "failed to obtain public key for handle %x: %w" , keyHandle , err )
232232 }
233233 serializedKey , err := serializePublicKey (key )
234234 if err != nil {
235- return nil , nil , err
235+ return nil , nil , fmt . Errorf ( "failed to serialize public key for handle %x: %w" , keyHandle , err )
236236 }
237237 key2Handle [serializedKey ] = keyHandle
238238 handleFound [keyHandle ] = struct {}{}
@@ -258,7 +258,7 @@ func (t *wrappedTPM20) create2048RSAEKInAvailableSlot(handleFoundMap map[tpmutil
258258 }
259259 return targetHandle , nil
260260 }
261- return tpmutil .Handle (0 ), fmt .Errorf ("could not create rsa 2048 key in persistent handle" )
261+ return tpmutil .Handle (0 ), fmt .Errorf ("no available handles to create RSA 2048 key in persistent handle" )
262262}
263263
264264func (t * wrappedTPM20 ) ekCertificates () ([]EK , error ) {
0 commit comments