Revert AuthKey changes

This commit is contained in:
Andrew Pau 2021-04-09 10:44:16 -07:00
parent 86670f0fba
commit def8ee8789
No known key found for this signature in database
GPG Key ID: 49D8DE552B3A2FBC
3 changed files with 9 additions and 9 deletions

View File

@ -362,7 +362,7 @@ func CreatePutWrapkeyCommand(objID uint16, label []byte, domains uint16, capabil
return command, nil return command, nil
} }
func CreatePutAuthenticationKeyCommand(objID uint16, label []byte, domains uint16, capabilities, delegated uint64, encKey, macKey []byte) (*CommandMessage, error) { func CreatePutAuthkeyCommand(objID uint16, label []byte, domains uint16, capabilities, delegated uint64, encKey, macKey []byte) (*CommandMessage, error) {
if len(label) > LabelLength { if len(label) > LabelLength {
return nil, errors.New("label is too long") return nil, errors.New("label is too long")
} }
@ -380,7 +380,7 @@ func CreatePutAuthenticationKeyCommand(objID uint16, label []byte, domains uint1
} }
command := &CommandMessage{ command := &CommandMessage{
CommandType: CommandTypePutAuthenticationKey, CommandType: CommandTypePutAuthKey,
} }
payload := bytes.NewBuffer([]byte{}) payload := bytes.NewBuffer([]byte{})
@ -400,7 +400,7 @@ func CreatePutAuthenticationKeyCommand(objID uint16, label []byte, domains uint1
func CreatePutDerivedAuthenticationKeyCommand(objID uint16, label []byte, domains uint16, capabilities uint64, delegated uint64, password string) (*CommandMessage, error) { func CreatePutDerivedAuthenticationKeyCommand(objID uint16, label []byte, domains uint16, capabilities uint64, delegated uint64, password string) (*CommandMessage, error) {
authKey := authkey.NewFromPassword(password) authKey := authkey.NewFromPassword(password)
return CreatePutAuthenticationKeyCommand(objID, label, domains, capabilities, delegated, authKey.GetEncKey(), authKey.GetMacKey()) return CreatePutAuthkeyCommand(objID, label, domains, capabilities, delegated, authKey.GetEncKey(), authKey.GetMacKey())
} }
func CreateSignAttestationCertCommand(keyObjID, attestationObjID uint16) (*CommandMessage, error) { func CreateSignAttestationCertCommand(keyObjID, attestationObjID uint16) (*CommandMessage, error) {

View File

@ -92,7 +92,7 @@ type (
ObjectID uint16 ObjectID uint16
} }
PutAuthenticationKeyResponse struct { PutAuthkeyResponse struct {
ObjectID uint16 ObjectID uint16
} }
@ -167,8 +167,8 @@ func ParseResponse(data []byte) (Response, error) {
return parseGetPseudoRandomResponse(payload), nil return parseGetPseudoRandomResponse(payload), nil
case CommandTypePutWrapKey: case CommandTypePutWrapKey:
return parsePutWrapkeyResponse(payload) return parsePutWrapkeyResponse(payload)
case CommandTypePutAuthenticationKey: case CommandTypePutAuthKey:
return parsePutAuthenticationKeyResponse(payload) return parsePutAuthkeyResponse(payload)
case CommandTypePutOpaque: case CommandTypePutOpaque:
return parsePutOpaqueResponse(payload) return parsePutOpaqueResponse(payload)
case CommandTypeGetOpaque: case CommandTypeGetOpaque:
@ -347,7 +347,7 @@ func parsePutWrapkeyResponse(payload []byte) (Response, error) {
return &PutWrapkeyResponse{ObjectID: objectID}, nil return &PutWrapkeyResponse{ObjectID: objectID}, nil
} }
func parsePutAuthenticationKeyResponse(payload []byte) (Response, error) { func parsePutAuthkeyResponse(payload []byte) (Response, error) {
if len(payload) != 2 { if len(payload) != 2 {
return nil, errors.New("invalid response payload length") return nil, errors.New("invalid response payload length")
} }
@ -358,7 +358,7 @@ func parsePutAuthenticationKeyResponse(payload []byte) (Response, error) {
return nil, err return nil, err
} }
return &PutAuthenticationKeyResponse{ObjectID: objectID}, nil return &PutAuthkeyResponse{ObjectID: objectID}, nil
} }
func parsePutOpaqueResponse(payload []byte) (Response, error) { func parsePutOpaqueResponse(payload []byte) (Response, error) {

View File

@ -23,7 +23,7 @@ const (
CommandTypeStorageStatus CommandType = 0x41 CommandTypeStorageStatus CommandType = 0x41
CommandTypePutOpaque CommandType = 0x42 CommandTypePutOpaque CommandType = 0x42
CommandTypeGetOpaque CommandType = 0x43 CommandTypeGetOpaque CommandType = 0x43
CommandTypePutAuthenticationKey CommandType = 0x44 CommandTypePutAuthKey CommandType = 0x44
CommandTypePutAsymmetric CommandType = 0x45 CommandTypePutAsymmetric CommandType = 0x45
CommandTypeGenerateAsymmetricKey CommandType = 0x46 CommandTypeGenerateAsymmetricKey CommandType = 0x46
CommandTypeSignDataPkcs1 CommandType = 0x47 CommandTypeSignDataPkcs1 CommandType = 0x47