Просмотр исходного кода

Use recommended way of generating x25519 curve

tags/1.0^2
9seconds 6 лет назад
Родитель
Сommit
6732e80d06
1 измененных файлов: 4 добавлений и 5 удалений
  1. 4
    5
      tlstypes/server_hello.go

+ 4
- 5
tlstypes/server_hello.go Просмотреть файл

77
 		0x00, 0x20, // 32 bytes of key
77
 		0x00, 0x20, // 32 bytes of key
78
 	})
78
 	})
79
 
79
 
80
-	var dst, in, base [32]byte
80
+	var scalar [32]byte
81
 
81
 
82
-	rand.Read(in[:])   // nolint: errcheck
83
-	rand.Read(base[:]) // nolint: errcheck
84
-	curve25519.ScalarMult(&dst, &in, &base)
85
-	buf.Write(dst[:]) // nolint: errcheck
82
+	rand.Read(scalar[:]) // nolint: errcheck
83
+	curve, _ := curve25519.X25519(scalar[:], curve25519.Basepoint)
84
+	buf.Write(curve) // nolint: errcheck
86
 
85
 
87
 	buf.Write([]byte{ // nolint: errcheck
86
 	buf.Write([]byte{ // nolint: errcheck
88
 		0x00, 0x2b, // Extension - Supported Versions
87
 		0x00, 0x2b, // Extension - Supported Versions

Загрузка…
Отмена
Сохранить