  #ifndef NO_AES
  
  #include <wolfssl/wolfcrypt/aes.h>
-@@ -1247,6 +1251,11 @@
+@@ -1247,6 +1251,16 @@
      }
  #endif
  
 +    #ifdef AES_TRIG
-+    // trigger set
++    // trigger setup if SSL context was not initialised
++    if (!trigger_active) {
++        trigger_map();
++        trigger_setup();
++        trigger_clr();
++    }
 +    trigger_set();
 +    #endif /* AES_TRIG */
 +
      /*
       * map byte array block to cipher state
       * and add initial round key:
-@@ -1371,6 +1380,12 @@
+@@ -1371,6 +1385,12 @@
      XMEMCPY(outBlock + sizeof(s0),     &s1, sizeof(s1));
      XMEMCPY(outBlock + 2 * sizeof(s0), &s2, sizeof(s2));
      XMEMCPY(outBlock + 3 * sizeof(s0), &s3, sizeof(s3));

     /*
      * map byte array block to cipher state
      * and add initial round key:
@@ -1533,6 +1553,12 @@
     XMEMCPY(outBlock + sizeof(s0),     &s1, sizeof(s1));
     XMEMCPY(outBlock + 2 * sizeof(s0), &s2, sizeof(s2));
     XMEMCPY(outBlock + 3 * sizeof(s0), &s3, sizeof(s3));

 }
 #endif /* HAVE_AES_CBC || WOLFSSL_AES_DIRECT || HAVE_AESGCM */
 
@@ -1411,6 +1431,11 @@
     }
 #endif
 
