- Added rsa random deadlock test

diff --git a/tests/suites/test_suite_rsa.function b/tests/suites/test_suite_rsa.function
index 896eebb..6b5c0ac 100644
--- a/tests/suites/test_suite_rsa.function
+++ b/tests/suites/test_suite_rsa.function
@@ -16,6 +16,14 @@
 
     return( rand() );
 }
+
+static int badrand( void *rng_state )
+{
+    if( rng_state != NULL )
+        rng_state  = NULL;
+
+    return( 0 );
+}
 END_HEADER
 
 BEGIN_CASE
@@ -282,6 +290,39 @@
 END_CASE
 
 BEGIN_CASE
+rsa_pkcs1_encrypt_bad_rng:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:input_E:result_hex_str:result
+{
+    unsigned char message_str[1000];
+    unsigned char output[1000];
+    unsigned char output_str[1000];
+    rsa_context ctx;
+    int msg_len;
+    int res;
+
+    rsa_init( &ctx, {padding_mode}, 0, &badrand, NULL );
+    memset( message_str, 0x00, 1000 );
+    memset( output, 0x00, 1000 );
+    memset( output_str, 0x00, 1000 );
+
+    ctx.len = {mod} / 8;
+    TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 );
+    TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 );
+
+    TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 );
+
+    msg_len = unhexify( message_str, {message_hex_string} );
+
+    TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, RSA_PUBLIC, msg_len, message_str, output ) == {result} );
+    if( {result} == 0 )
+    {
+        hexify( output_str, output, ctx.len );
+
+        TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 );
+    }
+}
+END_CASE
+
+BEGIN_CASE
 rsa_pkcs1_decrypt:message_hex_string:padding_mode:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:max_output:result_hex_str:result
 {
     unsigned char message_str[1000];