Don't install SIGILL handler until after sigsetjmp.

Previously, if SIGILL was received between the signal handler being
installed and before the sigsetjmp, the process would longjmp to a
random location.

Change-Id: I9e6143a17ff3db0e1b00ece68fce161801461010
Reviewed-on: https://boringssl-review.googlesource.com/3950
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/cpu-arm.c b/crypto/cpu-arm.c
index 8ca60fb..ba61939 100644
--- a/crypto/cpu-arm.c
+++ b/crypto/cpu-arm.c
@@ -93,10 +93,10 @@
 
   sigset_t original_sigmask;
   sigprocmask(SIG_SETMASK, &sigmask, &original_sigmask);
-  sigaction(SIGILL, &sigill_action, &sigill_original_action);
-
 
   if (sigsetjmp(sigill_jmp, 1 /* save signals */) == 0) {
+    sigaction(SIGILL, &sigill_action, &sigill_original_action);
+
     // This function cannot be inline asm because GCC will refuse to compile
     // inline NEON instructions unless building with -mfpu=neon, which would
     // defeat the point of probing for support at runtime.