代码拉取完成,页面将自动刷新
// Copyright 2019 Canonical Ltd.
// Licensed under the LGPLv3 with static-linking exception.
// See LICENCE file for details.
package util
import (
"errors"
"gitee.com/mysnapcore/mygo-tpm2"
"gitee.com/mysnapcore/mygo-tpm2/mu"
)
// ComputeCpHash computes a command parameter digest from the specified command code, the supplied
// handles (identified by their names) and parameters using the specified digest algorithm.
//
// The required parameters is defined in part 3 of the TPM 2.0 Library Specification for the
// specific command.
//
// The result of this is useful for extended authorization commands that bind an authorization to
// a command and set of command parameters, such as TPMContext.PolicySigned, TPMContext.PolicySecret,
// TPMContext.PolicyTicket and TPMContext.PolicyCpHash.
func ComputeCpHash(alg tpm2.HashAlgorithmId, command tpm2.CommandCode, handles []tpm2.Name, params ...interface{}) (tpm2.Digest, error) {
if !alg.Available() {
return nil, errors.New("algorithm is not available")
}
cpBytes, err := mu.MarshalToBytes(params...)
if err != nil {
return nil, err
}
return tpm2.ComputeCpHash(alg, command, handles, cpBytes), nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。