diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 45f63e93..9d17c9f1 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -80,25 +80,6 @@ endif
 libudev = dependency('libudev', required : get_option('udev'))
 libyaml = dependency('yaml-0.1', required : false)
 
-# Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.
-libcrypto = dependency('gnutls', required : false)
-if libcrypto.found()
-    config_h.set('HAVE_GNUTLS', 1)
-else
-    libcrypto = dependency('libcrypto', required : false)
-    if libcrypto.found()
-        config_h.set('HAVE_CRYPTO', 1)
-    endif
-endif
-
-if not libcrypto.found()
-    warning('Neither gnutls nor libcrypto found, all IPA modules will be isolated')
-    summary({'IPA modules signed with': 'None (modules will run isolated)'},
-            section : 'Configuration')
-else
-    summary({'IPA modules signed with' : libcrypto.name()}, section : 'Configuration')
-endif
-
 if liblttng.found()
     tracing_enabled = true
     config_h.set('HAVE_TRACING', 1)
diff --git a/src/meson.build b/src/meson.build
index 165a77bb..208cd760 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,16 +15,30 @@ summary({
          }, section : 'Paths')
 
 # Module Signing
+# Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.
+libcrypto = dependency('gnutls', 'libcrypto', required : false)
 openssl = find_program('openssl', required : false)
-if openssl.found()
+if not libcrypto.found()
+    ipa_sign_module = false
+    warning('Neither gnutls nor libcrypto found, all IPA modules will be isolated')
+    summary({'IPA modules signed with': 'None (modules will run isolated)'},
+            section : 'Configuration')
+elif not openssl.found()
+    ipa_sign_module = false
+    warning('openssl not found, all IPA modules will be isolated')
+    ipa_sign_module = false
+else
+    ipa_sign_module = true
+    config_h.set('HAVE_IPA_PUBKEY', 1)
+    if libcrypto.name() == 'gnutls'
+        config_h.set('HAVE_GNUTLS', 1)
+    else
+        config_h.set('HAVE_CRYPTO', 1)
+    endif
+    summary({'IPA modules signed with' : libcrypto.name()}, section : 'Configuration')
     ipa_priv_key = custom_target('ipa-priv-key',
                                  output : ['ipa-priv-key.pem'],
                                  command : [gen_ipa_priv_key, '@OUTPUT@'])
-    config_h.set('HAVE_IPA_PUBKEY', 1)
-    ipa_sign_module = true
-else
-    warning('openssl not found, all IPA modules will be isolated')
-    ipa_sign_module = false
 endif
 
 # libcamera must be built first as a dependency to the other components.
