From 9fe392eb4478dc26680c8c5c42deb87d192447db Mon Sep 17 00:00:00 2001 From: Armin Preiml Date: Fri, 23 Jun 2023 08:20:39 +0200 Subject: [PATCH] fix uninitialized values This is a dirty fix to make it compile until a better solution/pattern is found. --- format/ssh/cipher.ha | 1 + net/ssh/cipher.ha | 11 +++++++++-- net/ssh/kex.ha | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/format/ssh/cipher.ha b/format/ssh/cipher.ha index a6c1022..a8b8407 100644 --- a/format/ssh/cipher.ha +++ b/format/ssh/cipher.ha @@ -41,6 +41,7 @@ type aes256ctr = struct { fn aes256ctr_init(handle: io::handle, key: []u8, iv: []u8) *io::stream = { let state = alloc(aes256ctr { + st = *(&([0...]: [size(cipher::ctr_stream)]u8): *cipher::ctr_stream), block = aes::aes(), ... }); diff --git a/net/ssh/cipher.ha b/net/ssh/cipher.ha index d476858..9892c11 100644 --- a/net/ssh/cipher.ha +++ b/net/ssh/cipher.ha @@ -104,13 +104,20 @@ fn aes256_ctr_init( client: *client, kex: *kex, ) *cipher = { - let cipher = alloc(aes_ctr { ... }); + let cipher = alloc(aes_ctr { + name = "aes256-ctr", + keysz = 32, + blksz = 16, + init = &aes256_ctr_init, + ct = aes::aes(), + ctr = *(&([0...]: [size(cipher::ctr_stream)]u8): *cipher::ctr_stream), + ..., + }); let iv: [aes::BLOCKSIZE]u8 = [0...]; let key: [32]u8 = [0...]; const shared = kex_shared(kex); kex_hash(client, kex, hash_type::IV_CLIENT_SERVER, shared, iv); kex_hash(client, kex, hash_type::ENCRYPT_CLIENT_SERVER, shared, key); - cipher.ct = aes::aes(); cipher.ctr = cipher::ctr(handle, &cipher.ct, iv, cipher.ctrbuf); return cipher; }; diff --git a/net/ssh/kex.ha b/net/ssh/kex.ha index e4155bf..d7c016b 100644 --- a/net/ssh/kex.ha +++ b/net/ssh/kex.ha @@ -86,7 +86,6 @@ type kex_curve25519_sha256 = struct { state: ecdh_state, cpkey: x25519::key, cskey: x25519::key, - hostkey: ssh::key, }; fn curve25519_sha256_init() *kex = { -- 2.45.2