From b94a076955cba4de8e9ad495a35abfd5506733b6 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 12 Oct 2015 23:25:16 +0100 Subject: [PATCH] Since we have bn_restore_invariant, we may as well use it more. --- sshbn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sshbn.c b/sshbn.c index 3afea467..7aa10697 100644 --- a/sshbn.c +++ b/sshbn.c @@ -1142,8 +1142,7 @@ Bignum bignum_from_bytes(const unsigned char *data, int nbytes) (BignumInt)byte << (8*i % BIGNUM_INT_BITS); } - while (result[0] > 1 && result[result[0]] == 0) - result[0]--; + bn_restore_invariant(result); return result; } @@ -1165,8 +1164,7 @@ Bignum bignum_from_bytes_le(const unsigned char *data, int nbytes) (BignumInt)byte << (8*i % BIGNUM_INT_BITS); } - while (result[0] > 1 && result[result[0]] == 0) - result[0]--; + bn_restore_invariant(result); return result; }