~sircmpwn/hare-ssh

d4bf8009b172ce06a12f604beb28799ebd2725d9 — Armin Preiml 8 months ago 7664482
rsa: fix clearing privkey params on decode
1 files changed, 16 insertions(+), 8 deletions(-)

M format/ssh/rsa.ha
M format/ssh/rsa.ha => format/ssh/rsa.ha +16 -8
@@ 143,20 143,28 @@ fn rsa_decoderawpriv(key: *key, src: io::handle) (void | error) = {
	};

	let d = readumpint(src)?;
	defer bytes::zero(d);
	defer free(d);
	defer {
		bytes::zero(d);
		free(d);
	};

	priv.iq = readumpint(src)?;
	defer bytes::zero(priv.iq);
	defer free(priv.iq);
	defer {
		bytes::zero(priv.iq);
		free(priv.iq);
	};

	priv.p = readumpint(src)?;
	defer bytes::zero(priv.p);
	defer free(priv.p);
	defer {
		bytes::zero(priv.p);
		free(priv.p);
	};

	priv.q = readumpint(src)?;
	defer bytes::zero(priv.q);
	defer free(priv.q);
	defer {
		bytes::zero(priv.q);
		free(priv.q);
	};

	assert(len(key.pubkey) > 0, "pubkey required when decoding privkey");
	let pubp = rsa::pubkey_params(key.pubkey);