merlin: remove unconditional debug logging

This commit is contained in:
George Tankersley 2019-10-09 23:32:11 -04:00
parent eb1d60f2c0
commit 91c96d8b8d
1 changed files with 0 additions and 9 deletions

View File

@ -2,7 +2,6 @@ package merlin
import ( import (
"encoding/binary" "encoding/binary"
"fmt"
"github.com/mimoo/StrobeGo/strobe" "github.com/mimoo/StrobeGo/strobe"
) )
@ -21,8 +20,6 @@ func NewTranscript(appLabel string) *Transcript {
s: strobe.InitStrobe(merlinProtocolLabel, 128), s: strobe.InitStrobe(merlinProtocolLabel, 128),
} }
fmt.Printf("Initialize STROBE-128(%x)\n", merlinProtocolLabel)
t.AppendMessage([]byte(domainSeparatorLabel), []byte(appLabel)) t.AppendMessage([]byte(domainSeparatorLabel), []byte(appLabel))
return &t return &t
} }
@ -34,15 +31,12 @@ func (t *Transcript) AppendMessage(label, message []byte) {
sizeBuffer := make([]byte, 4) sizeBuffer := make([]byte, 4)
binary.LittleEndian.PutUint32(sizeBuffer[0:], uint32(len(message))) binary.LittleEndian.PutUint32(sizeBuffer[0:], uint32(len(message)))
fmt.Printf("meta-AD : %x || LE32(%d)\t# b\"%s\"\n", label, len(message), label)
// The StrobeGo API does not support continuation operations, // The StrobeGo API does not support continuation operations,
// so we have to pass the label and length as a single buffer. // so we have to pass the label and length as a single buffer.
// Otherwise it will record two meta-AD operations instead of one. // Otherwise it will record two meta-AD operations instead of one.
labelSize := append(label, sizeBuffer...) labelSize := append(label, sizeBuffer...)
t.s.AD(true, labelSize) t.s.AD(true, labelSize)
fmt.Printf("AD : %x\t# b\"%s\"\n", message, message)
t.s.AD(false, message) t.s.AD(false, message)
} }
@ -54,8 +48,6 @@ func (t *Transcript) ExtractBytes(label []byte, outLen int) []byte {
sizeBuffer := make([]byte, 4) sizeBuffer := make([]byte, 4)
binary.LittleEndian.PutUint32(sizeBuffer[0:], uint32(outLen)) binary.LittleEndian.PutUint32(sizeBuffer[0:], uint32(outLen))
fmt.Printf("meta-AD : %x || LE32(%d)\t# b\"%s\"\n", label, outLen, label)
// The StrobeGo API does not support continuation operations, // The StrobeGo API does not support continuation operations,
// so we have to pass the label and length as a single buffer. // so we have to pass the label and length as a single buffer.
// Otherwise it will record two meta-AD operations instead of one. // Otherwise it will record two meta-AD operations instead of one.
@ -64,6 +56,5 @@ func (t *Transcript) ExtractBytes(label []byte, outLen int) []byte {
// a PRF call directly to the output buffer would be better // a PRF call directly to the output buffer would be better
outBytes := t.s.PRF(outLen) outBytes := t.s.PRF(outLen)
fmt.Printf("PRF : %x\n", outBytes)
return outBytes return outBytes
} }