testdata: convert last chunk tests to testkit

This commit is contained in:
Filippo Valsorda
2022-06-15 19:38:18 +02:00
parent a787511e01
commit 787044bdb6
7 changed files with 63 additions and 3 deletions

View File

@@ -130,8 +130,7 @@ func (f *TestFile) HMAC() {
f.HMACLine(h.Sum(nil))
}
func (f *TestFile) Nonce() {
nonce := f.Rand(16)
func (f *TestFile) Nonce(nonce []byte) {
f.streamKey = make([]byte, 32)
hkdf.New(sha256.New, f.fileKey, nonce, []byte("payload")).Read(f.streamKey)
f.Buf.Write(nonce)
@@ -152,7 +151,7 @@ func (f *TestFile) PayloadChunkFinal(plaintext []byte) {
}
func (f *TestFile) Payload(plaintext string) {
f.Nonce()
f.Nonce(f.Rand(16))
f.PayloadChunkFinal([]byte(plaintext))
}