Check rng return value when seeding OpenSSL RNG
authorTobias Brunner <tobias@strongswan.org>
Mon, 25 Jun 2012 14:07:12 +0000 (16:07 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 16 Jul 2012 12:53:36 +0000 (14:53 +0200)
src/libstrongswan/plugins/openssl/openssl_plugin.c

index 7daa92b..08d7d15 100644 (file)
@@ -174,7 +174,11 @@ static bool seed_rng()
                                return FALSE;
                        }
                }
-               rng->get_bytes(rng, sizeof(buf), buf);
+               if (!rng->get_bytes(rng, sizeof(buf), buf))
+               {
+                       rng->destroy(rng);
+                       return FALSE;
+               }
                RAND_seed(buf, sizeof(buf));
        }
        DESTROY_IF(rng);