Skip to content

Commit 0ed5ff7

Browse files
committed
src/crypto: standardize and fix spelling in Go files
receipient -> recipient
1 parent dceb77a commit 0ed5ff7

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/crypto/internal/hpke/hpke.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ type Sender struct {
144144
*context
145145
}
146146

147-
type Receipient struct {
147+
type Recipient struct {
148148
*context
149149
}
150150

@@ -259,7 +259,7 @@ func SetupSender(kemID, kdfID, aeadID uint16, pub *ecdh.PublicKey, info []byte)
259259
return encapsulatedKey, &Sender{context}, nil
260260
}
261261

262-
func SetupReceipient(kemID, kdfID, aeadID uint16, priv *ecdh.PrivateKey, info, encPubEph []byte) (*Receipient, error) {
262+
func SetupRecipient(kemID, kdfID, aeadID uint16, priv *ecdh.PrivateKey, info, encPubEph []byte) (*Recipient, error) {
263263
kem, err := newDHKem(kemID)
264264
if err != nil {
265265
return nil, err
@@ -274,7 +274,7 @@ func SetupReceipient(kemID, kdfID, aeadID uint16, priv *ecdh.PrivateKey, info, e
274274
return nil, err
275275
}
276276

277-
return &Receipient{context}, nil
277+
return &Recipient{context}, nil
278278
}
279279

280280
func (ctx *context) nextNonce() []byte {
@@ -300,7 +300,7 @@ func (s *Sender) Seal(aad, plaintext []byte) ([]byte, error) {
300300
return ciphertext, nil
301301
}
302302

303-
func (r *Receipient) Open(aad, ciphertext []byte) ([]byte, error) {
303+
func (r *Recipient) Open(aad, ciphertext []byte) ([]byte, error) {
304304
plaintext, err := r.aead.Open(nil, r.nextNonce(), ciphertext, aad)
305305
if err != nil {
306306
return nil, err

src/crypto/internal/hpke/hpke_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestRFC9180Vectors(t *testing.T) {
126126
t.Fatal(err)
127127
}
128128

129-
receipient, err := SetupReceipient(
129+
recipient, err := SetupRecipient(
130130
uint16(kemID),
131131
uint16(kdfID),
132132
uint16(aeadID),
@@ -138,7 +138,7 @@ func TestRFC9180Vectors(t *testing.T) {
138138
t.Fatal(err)
139139
}
140140

141-
for _, ctx := range []*context{sender.context, receipient.context} {
141+
for _, ctx := range []*context{sender.context, recipient.context} {
142142
expectedSharedSecret := mustDecodeHex(t, setup["shared_secret"])
143143
if !bytes.Equal(ctx.sharedSecret, expectedSharedSecret) {
144144
t.Errorf("unexpected shared secret, got: %x, want %x", ctx.sharedSecret, expectedSharedSecret)
@@ -164,7 +164,7 @@ func TestRFC9180Vectors(t *testing.T) {
164164
t.Fatal(err)
165165
}
166166
sender.seqNum = uint128{lo: uint64(seqNum)}
167-
receipient.seqNum = uint128{lo: uint64(seqNum)}
167+
recipient.seqNum = uint128{lo: uint64(seqNum)}
168168
expectedNonce := mustDecodeHex(t, enc["nonce"])
169169
computedNonce := sender.nextNonce()
170170
if !bytes.Equal(computedNonce, expectedNonce) {
@@ -181,7 +181,7 @@ func TestRFC9180Vectors(t *testing.T) {
181181
}
182182

183183
expectedPlaintext := mustDecodeHex(t, enc["pt"])
184-
plaintext, err := receipient.Open(mustDecodeHex(t, enc["aad"]), mustDecodeHex(t, enc["ct"]))
184+
plaintext, err := recipient.Open(mustDecodeHex(t, enc["aad"]), mustDecodeHex(t, enc["ct"]))
185185
if err != nil {
186186
t.Fatal(err)
187187
}

src/crypto/tls/ech.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ func decodeInnerClientHello(outer *clientHelloMsg, encoded []byte) (*clientHello
419419
return inner, nil
420420
}
421421

422-
func decryptECHPayload(context *hpke.Receipient, hello, payload []byte) ([]byte, error) {
422+
func decryptECHPayload(context *hpke.Recipient, hello, payload []byte) ([]byte, error) {
423423
outerAAD := bytes.Replace(hello[4:], payload, make([]byte, len(payload)), 1)
424424
return context.Open(outerAAD, payload)
425425
}
@@ -613,7 +613,7 @@ func (c *Conn) processECHClientHello(outer *clientHelloMsg) (*clientHelloMsg, *e
613613
return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKeys PrivateKey: %s", err)
614614
}
615615
info := append([]byte("tls ech\x00"), echKey.Config...)
616-
hpkeContext, err := hpke.SetupReceipient(hpke.DHKEM_X25519_HKDF_SHA256, echCiphersuite.KDFID, echCiphersuite.AEADID, echPriv, info, encap)
616+
hpkeContext, err := hpke.SetupRecipient(hpke.DHKEM_X25519_HKDF_SHA256, echCiphersuite.KDFID, echCiphersuite.AEADID, echPriv, info, encap)
617617
if err != nil {
618618
// attempt next trial decryption
619619
continue

src/crypto/tls/handshake_server_tls13.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
const maxClientPSKIdentities = 5
3131

3232
type echServerContext struct {
33-
hpkeContext *hpke.Receipient
33+
hpkeContext *hpke.Recipient
3434
configID uint8
3535
ciphersuite echCipher
3636
transcript hash.Hash

0 commit comments

Comments
 (0)