Initial support for pluggable public key ASN1 support. Process most public
[openssl.git] / crypto / ec / ecp_smpl.c
index 1c0052c5ca99759909585678a545d802b8fc7abf..4d26f8bdf6921f4ae9a9e5be06fbde3f54b55628 100644 (file)
@@ -192,7 +192,7 @@ int ec_GFp_simple_group_set_curve(EC_GROUP *group,
 
        /* group->field */
        if (!BN_copy(&group->field, p)) goto err;
-       BN_set_sign(&group->field, 0);
+       BN_set_negative(&group->field, 0);
 
        /* group->a */
        if (!BN_nnmod(tmp_a, a, p, ctx)) goto err;
@@ -336,7 +336,8 @@ int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
        ret = 1;
 
 err:
-       BN_CTX_end(ctx);
+       if (ctx != NULL)
+               BN_CTX_end(ctx);
        if (new_ctx != NULL)
                BN_CTX_free(new_ctx);
        return ret;