Debian Codegraph @

streamingaead/aesgcmhkdf/parameters_test.go

raw symbols SCIP
1 // Copyright 2025 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package aesgcmhkdf_testscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/
16
17 import (
18 "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/"
19
20 "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/"
21 "github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/"
22 )
23
24 func TestNewParameters_InvalidKeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestNewParameters_InvalidKeySize().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
25 for _, derivedKeySize := range []int{16, 32} {
26 opts := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
27 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: derivedKeySize - 1,
28 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: derivedKeySize,
29 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
30 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
31 }
32 if _, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(opts); err == nil {
33 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("aesgcmhkdf.NewParameters(%v) err = nil, want error", opts)
34 }
35 }
36 }
37
38 func TestNewParameters_InvalidDerivedKeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestNewParameters_InvalidDerivedKeySize().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
39 for _, derivedKeySize := range []int{1, 15, 17, 31, 33} {
40 opts := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
41 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 32,
42 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: derivedKeySize,
43 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
44 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
45 }
46 if _, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(opts); err == nil {
47 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("aesgcmhkdf.NewParameters(%v) err = nil, want error", opts)
48 }
49 }
50 }
51
52 func TestNewParameters_InvalidHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestNewParameters_InvalidHashType().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
53 opts := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
54 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
55 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
56 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.HashTypeUnknownscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/HashTypeUnknown.,
57 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
58 }
59 if _, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(opts); err == nil {
60 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("aesgcmhkdf.NewParameters(%v) err = nil, want error", opts)
61 }
62
63 }
64
65 func TestNewParameters_InvalidSegmentSizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestNewParameters_InvalidSegmentSize().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
66 for _, derivedKeySize := range []int{16, 32} {
67 opts := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
68 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: derivedKeySize,
69 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: derivedKeySize,
70 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
71 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: int32(derivedKeySize) + 24, // 1 byte short of the minimum.
72 }
73 if _, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(opts); err == nil {
74 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("aesgcmhkdf.NewParameters(%v) err = nil, want error", opts)
75 }
76 }
77 }
78
79 func TestNewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestNewParameters().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
80 for _, test := range []struct {
81 name string
82 opts aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#
83 }{
84 {
85 name: "16-byte key, 16-byte derived key, SHA256",
86 opts: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
87 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
88 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
89 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
90 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 16 + 24 + 1, // Minimum segment size.
91 },
92 },
93 {
94 name: "32-byte key, 32-byte derived key, SHA512",
95 opts: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
96 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 32,
97 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 32,
98 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA512scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA512.,
99 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 1024,
100 },
101 },
102 } {
103 t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
104 params, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(test.opts)
105 if err != nil {
106 t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("aesgcmhkdf.NewParameters(%v) err = %v, want nil", test.opts, err)
107 }
108 if params.HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#HasIDRequirement().() {
109 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.HasIDRequirement() = true, want false")
110 }
111 if params.KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#KeySizeInBytes().() != test.opts.KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes. {
112 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.KeySizeInBytes() = %v, want %v", params.KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#KeySizeInBytes().(), test.opts.KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.)
113 }
114 if params.DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#DerivedKeySizeInBytes().() != test.opts.DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes. {
115 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.DerivedKeySizeInBytes() = %v, want %v", params.DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#DerivedKeySizeInBytes().(), test.opts.DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.)
116 }
117 if params.HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#HKDFHashType().() != test.opts.HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType. {
118 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.HKDFHashType() = %v, want %v", params.HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#HKDFHashType().(), test.opts.HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.)
119 }
120 if params.SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#SegmentSizeInBytes().() != test.opts.SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes. {
121 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.SegmentSizeInBytes() = %v, want %v", params.SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/Parameters#SegmentSizeInBytes().(), test.opts.SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.)
122 }
123 otherParams, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(test.opts)
124 if err != nil {
125 t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("aesgcmhkdf.NewParameters(%v) err = %v, want nil", test.opts, err)
126 }
127 if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(params, otherParams); diff != "" {
128 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params.Equal(otherParams) returned unexpected diff (-want +got):\n%s", diff)
129 }
130 })
131 }
132 }
133
134 func TestParametersEqual_FalseIfDifferentscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf_test`/TestParametersEqual_FalseIfDifferent().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
135 for _, test := range []struct {
136 name string
137 opts1 aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#
138 opts2 aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#
139 }{
140 {
141 name: "different key size",
142 opts1: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
143 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
144 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
145 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
146 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
147 },
148 opts2: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
149 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 32,
150 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
151 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
152 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
153 },
154 },
155 {
156 name: "different derived key size",
157 opts1: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
158 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 32,
159 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
160 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
161 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
162 },
163 opts2: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
164 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 32,
165 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 32,
166 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
167 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
168 },
169 },
170 {
171 name: "different hash type",
172 opts1: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
173 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
174 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
175 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
176 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
177 },
178 opts2: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
179 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
180 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
181 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA512scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA512.,
182 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
183 },
184 },
185 {
186 name: "different ciphertext segment size",
187 opts1: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
188 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
189 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
190 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
191 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 4096,
192 },
193 opts2: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.ParametersOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#{
194 KeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#KeySizeInBytes.: 16,
195 DerivedKeySizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#DerivedKeySizeInBytes.: 16,
196 HKDFHashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#HKDFHashType.: aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/SHA256.,
197 SegmentSizeInBytesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/ParametersOpts#SegmentSizeInBytes.: 8192,
198 },
199 },
200 } {
201 t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) {
202 params1, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(test.opts1)
203 if err != nil {
204 t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("aesgcmhkdf.NewParameters(%v) err = %v, want nil", test.opts1, err)
205 }
206 params2, err := aesgcmhkdfscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/streamingaead/aesgcmhkdf`/NewParameters().(test.opts2)
207 if err != nil {
208 t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("aesgcmhkdf.NewParameters(%v) err = %v, want nil", test.opts2, err)
209 }
210 if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(params1, params2); diff == "" {
211 t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("params1.Equal(params2) returned empty diff, want non-empty diff")
212 }
213 })
214 }
215 }