Commit 06affe3d authored by Richard Levitte's avatar Richard Levitte
Browse files

Initialised 'ok' and redo the logic.



The logic with how 'ok' was calculated didn't quite convey what's "ok",
so the logic is slightly redone to make it less confusing.

Reviewed-by: default avatarAndy Polyakov <appro@openssl.org>
parent b1a5d1c6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ int gost_do_verify(const unsigned char *dgst, int dgst_len,
    BIGNUM *q2 = NULL;
    BIGNUM *u = NULL, *v = NULL, *z1 = NULL, *z2 = NULL;
    BIGNUM *tmp2 = NULL, *tmp3 = NULL;
    int ok;
    int ok = 0;
    BN_CTX *ctx = BN_CTX_new();
    if(!ctx) {
        GOSTerr(GOST_F_GOST_DO_VERIFY, ERR_R_MALLOC_FAILURE);
@@ -208,9 +208,9 @@ int gost_do_verify(const unsigned char *dgst, int dgst_len,
    BN_mod_exp(tmp2, dsa->pub_key, z2, dsa->p, ctx);
    BN_mod_mul(tmp3, tmp, tmp2, dsa->p, ctx);
    BN_mod(u, tmp3, dsa->q, ctx);
    ok = BN_cmp(u, sig->r);
    ok = (BN_cmp(u, sig->r) == 0);

    if (ok != 0) {
    if (!ok) {
        GOSTerr(GOST_F_GOST_DO_VERIFY, GOST_R_SIGNATURE_MISMATCH);
    }
err:
@@ -219,7 +219,7 @@ err:
        BN_CTX_end(ctx);
        BN_CTX_free(ctx);
    }
    return (ok == 0);
    return ok;
}

/*