~sircmpwn/hare-ssh

9fe392eb4478dc26680c8c5c42deb87d192447db — Armin Preiml 8 months ago d4bf800
fix uninitialized values

This is a dirty fix to make it compile until a better solution/pattern
is found.
3 files changed, 10 insertions(+), 3 deletions(-)

M format/ssh/cipher.ha
M net/ssh/cipher.ha
M net/ssh/kex.ha
M format/ssh/cipher.ha => format/ssh/cipher.ha +1 -0
@@ 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(),
		...
	});

M net/ssh/cipher.ha => net/ssh/cipher.ha +9 -2
@@ 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;
};

M net/ssh/kex.ha => net/ssh/kex.ha +0 -1
@@ 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 = {