Check rng return value when generating SIM/AKA message IVs
authorMartin Willi <martin@revosec.ch>
Fri, 6 Jul 2012 11:52:57 +0000 (13:52 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 16 Jul 2012 12:53:37 +0000 (14:53 +0200)
src/libsimaka/simaka_message.c

index 50bd8b5..e7f902a 100644 (file)
@@ -771,7 +771,10 @@ METHOD(simaka_message_t, generate, bool,
                out = chunk_skip(out, 4);
 
                rng = this->crypto->get_rng(this->crypto);
-               rng->get_bytes(rng, iv.len, out.ptr);
+               if (!rng->get_bytes(rng, iv.len, out.ptr))
+               {
+                       return FALSE;
+               }
 
                iv = chunk_clonea(chunk_create(out.ptr, iv.len));
                out = chunk_skip(out, iv.len);