Browse Source

Fixed argument sequence in HKDF call.

Bernd Fix 2 months ago
parent
commit
beb637e5f5
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/gnunet/crypto/gns.go

+ 2
- 2
src/gnunet/crypto/gns.go View File

@@ -11,14 +11,14 @@ import (
11 11
 // DeriveBlockKey returns a symmetric key and initialization vector to decipher a GNS block.
12 12
 func DeriveBlockKey(label string, pub *ed25519.PublicKey) (iv *SymmetricIV, skey *SymmetricKey) {
13 13
 	// generate symmetric key
14
-	prk := hkdf.Extract(sha512.New, []byte("gns-aes-ctx-key"), pub.Bytes())
14
+	prk := hkdf.Extract(sha512.New, pub.Bytes(), []byte("gns-aes-ctx-key"))
15 15
 	rdr := hkdf.Expand(sha256.New, prk, []byte(label))
16 16
 	skey = NewSymmetricKey()
17 17
 	rdr.Read(skey.AESKey)
18 18
 	rdr.Read(skey.TwofishKey)
19 19
 
20 20
 	// generate initialization vector
21
-	prk = hkdf.Extract(sha512.New, []byte("gns-aes-ctx-iv"), pub.Bytes())
21
+	prk = hkdf.Extract(sha512.New, pub.Bytes(), []byte("gns-aes-ctx-iv"))
22 22
 	rdr = hkdf.Expand(sha256.New, prk, []byte(label))
23 23
 	iv = NewSymmetricIV()
24 24
 	rdr.Read(iv.AESIv)

Loading…
Cancel
Save