| | 1202 | $oldFastMult = ParagonIE_Sodium_Compat::$fastMult; |
| | 1203 | ParagonIE_Sodium_Compat::$fastMult = true; |
| | 1204 | if ( |
| | 1205 | ! extension_loaded( 'sodium' ) && |
| | 1206 | ! ParagonIE_Sodium_Compat::polyfill_is_fast() |
| | 1207 | ) { |
| | 1208 | $max = ini_get('max_execution_time'); |
| | 1209 | $unsafe = true; |
| | 1210 | if (method_exists('ParagonIE_Sodium_Compat', 'runtime_speed_test')) { |
| | 1211 | // Guard this around a method_exists() to prevent breakage with sodium_compat < 1.9 loaded by plugins |
| | 1212 | $unsafe = ! ParagonIE_Sodium_Compat::runtime_speed_test(25, 5); |
| | 1213 | } |
| | 1214 | if ($unsafe && $max > 0 && $max < 60) { |
| | 1215 | ParagonIE_Sodium_Compat::$fastMult = $oldFastMult; |
| | 1216 | // This cannot be performed in a reasonable amount of time |
| | 1217 | // https://github.com/paragonie/sodium_compat#help-sodium_compat-is-slow-how-can-i-make-it-fast |
| | 1218 | |
| | 1219 | return new WP_Error( |
| | 1220 | 'signature_verification_unsupported', |
| | 1221 | sprintf( |
| | 1222 | /* translators: 1: The filename of the package. */ |
| | 1223 | __('The authenticity of %1$s could not be verified as signature verification is unavailable on this system.'), |
| | 1224 | '<span class="code">' . esc_html($filename_for_errors) . '</span>' |
| | 1225 | ), |
| | 1226 | array( |
| | 1227 | 'php' => phpversion(), |
| | 1228 | 'sodium' => defined('SODIUM_LIBRARY_VERSION') ? SODIUM_LIBRARY_VERSION : (defined('ParagonIE_Sodium_Compat::VERSION_STRING') ? ParagonIE_Sodium_Compat::VERSION_STRING : false), |
| | 1229 | 'polyfill-is-fast' => false, |
| | 1230 | 'max-execution-time' => $max |
| | 1231 | ) |
| | 1232 | ); |
| | 1233 | } |
| | 1234 | } |
| | 1235 | ParagonIE_Sodium_Compat::$fastMult = $oldFastMult; |
| | 1236 | |