fclose streams in fips_drbvs.c OpenSSL-fips-2_0-rc2
authorDr. Stephen Henson <steve@openssl.org>
Wed, 9 Nov 2011 14:23:17 +0000 (14:23 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 9 Nov 2011 14:23:17 +0000 (14:23 +0000)
Produced error message for unsupported curves in fips_ecdhvs.c

fips/ecdh/fips_ecdhvs.c
fips/rand/fips_drbgvs.c

index a30e335e2b9fddf35ab476ee1e56f32858af714c..099285aac3d9961385a284b8a94dd48d1093a7cf 100644 (file)
@@ -413,6 +413,11 @@ int main(int argc, char **argv)
                        if (group)
                                EC_GROUP_free(group);
                        group = EC_GROUP_new_by_curve_name(nid);
+                       if (!group)
+                               {
+                               fprintf(stderr, "ERROR: unsupported curve %s\n", buf + 1);
+                               return 1;
+                               }
                        }
 
                if (strlen(buf) > 6 && !strncmp(buf, "[E", 2))
index bcdfa6dac3533a6353527a13aea10465378c84ff..9aae88c3e164b40360b82a15505d35b2abfc89dd 100644 (file)
@@ -176,7 +176,7 @@ int fips_drbgvs_main(int argc,char **argv)
 int main(int argc,char **argv)
 #endif
        {
-       FILE *in, *out;
+       FILE *in = NULL, *out = NULL;
        DRBG_CTX *dctx = NULL;
        TEST_ENT t;
        int r, nid = 0;
@@ -406,6 +406,10 @@ int main(int argc,char **argv)
                        }
 
                }
+       if (in && in != stdin)
+               fclose(in);
+       if (out && out != stdout)
+               fclose(out);
        return 0;
        }