blob: f83972bc637d14b9daf4a5ca071fa6c099003866 [file] [log] [blame]
Lorenz Bruna50e8452020-09-09 17:09:27 +02001// Copyright 2020 The Monogon Project Authors.
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17package eventlog
18
19// This file contains compatibility functions for our TPM library
20
21import (
22 "crypto"
23)
24
25// ConvertRawPCRs converts from raw PCRs to eventlog PCR structures
26func ConvertRawPCRs(pcrs [][]byte) []PCR {
27 var evPCRs []PCR
28 for i, digest := range pcrs {
29 evPCRs = append(evPCRs, PCR{DigestAlg: crypto.SHA256, Index: i, Digest: digest})
30 }
31 return evPCRs
32}