Commit b098dcae authored by Viktor Dukhovni's avatar Viktor Dukhovni
Browse files

Fix double-free bugs in EC group precomputation state



Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent 502e1685
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1560,6 +1560,7 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx)

    /* throw away old precomputation */
    EC_nistp224_pre_comp_free(group->pre_comp.nistp224);
    group->pre_comp.nistp224 = NULL;
    if (ctx == NULL)
        if ((ctx = new_ctx = BN_CTX_new()) == NULL)
            return 0;
+1 −0
Original line number Diff line number Diff line
@@ -2185,6 +2185,7 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx)

    /* throw away old precomputation */
    EC_nistp256_pre_comp_free(group->pre_comp.nistp256);
    group->pre_comp.nistp256 = NULL;
    if (ctx == NULL)
        if ((ctx = new_ctx = BN_CTX_new()) == NULL)
            return 0;
+1 −0
Original line number Diff line number Diff line
@@ -2009,6 +2009,7 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx)

    /* throw away old precomputation */
    EC_nistp521_pre_comp_free(group->pre_comp.nistp521);
    group->pre_comp.nistp521 = NULL;
    if (ctx == NULL)
        if ((ctx = new_ctx = BN_CTX_new()) == NULL)
            return 0;
+1 −0
Original line number Diff line number Diff line
@@ -770,6 +770,7 @@ __owur static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)

    /* if there is an old NISTZ256_PRE_COMP object, throw it away */
    EC_nistz256_pre_comp_free(group->pre_comp.nistz256);
    group->pre_comp.nistz256 = NULL;
    generator = EC_GROUP_get0_generator(group);
    if (generator == NULL) {
        ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE, EC_R_UNDEFINED_GENERATOR);