mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-25 05:09:53 +00:00
core/crypto/noise: Stop cheating and reaching into "opaque" structs
This commit is contained in:
@@ -554,7 +554,7 @@ handshakestate_initialize :: proc(
|
||||
|
||||
if initiator {
|
||||
if slice.contains(message_pattern.pre_messages, Pre_Token.ini_s) {
|
||||
ecdh.public_key_bytes(&s._pub_key, dst)
|
||||
ecdh.private_key_public_bytes(s, dst)
|
||||
symmetricstate_mix_hash(symmetric_state, dst)
|
||||
}
|
||||
if slice.contains(message_pattern.pre_messages, Pre_Token.res_s) {
|
||||
@@ -567,7 +567,7 @@ handshakestate_initialize :: proc(
|
||||
symmetricstate_mix_hash(symmetric_state, dst)
|
||||
}
|
||||
if slice.contains(message_pattern.pre_messages, Pre_Token.res_s) {
|
||||
ecdh.public_key_bytes(&s._pub_key, dst)
|
||||
ecdh.private_key_public_bytes(s, dst)
|
||||
symmetricstate_mix_hash(symmetric_state, dst)
|
||||
}
|
||||
}
|
||||
@@ -665,7 +665,7 @@ handshakestate_write_message :: proc(self: ^Handshake_State, payload, dst: []byt
|
||||
generate_keypair(protocol, &self.e)
|
||||
}
|
||||
e_public := dh_buf[:d_len]
|
||||
ecdh.public_key_bytes(&self.e._pub_key, e_public)
|
||||
ecdh.private_key_public_bytes(&self.e, e_public)
|
||||
n := append(&pattern_buf, ..e_public)
|
||||
ensure(n == d_len, "crypto/noise: truncated append `e`")
|
||||
|
||||
@@ -676,7 +676,7 @@ handshakestate_write_message :: proc(self: ^Handshake_State, payload, dst: []byt
|
||||
|
||||
case .s:
|
||||
s_public := dh_buf[:d_len]
|
||||
ecdh.public_key_bytes(&self.s._pub_key, s_public)
|
||||
ecdh.private_key_public_bytes(&self.s, s_public)
|
||||
|
||||
tmp: [MAX_DH_SIZE+TAG_SIZE]byte = ---
|
||||
dh_buf := tmp[:d_len+TAG_SIZE]
|
||||
|
||||
Reference in New Issue
Block a user