You are here

public static function ParagonIE_Sodium_Compat::memzero in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::memzero()

It's actually not possible to zero memory buffers in PHP. You need the native library for that.

@param-out string|null $var

@psalm-suppress TooFewArguments

Parameters

string|null $var:

Return value

void

Throws

SodiumException (Unless libsodium is installed)

TypeError

37 calls to ParagonIE_Sodium_Compat::memzero()
ParagonIE_Sodium_Compat::crypto_generichash_final in vendor/paragonie/sodium_compat/src/Compat.php
Get the final BLAKE2b hash output for a given context.
ParagonIE_Sodium_Core32_Ed25519::sign_detached in vendor/paragonie/sodium_compat/src/Core32/Ed25519.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core32_Salsa20::salsa20 in vendor/paragonie/sodium_compat/src/Core32/Salsa20.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core32_Salsa20::salsa20_xor_ic in vendor/paragonie/sodium_compat/src/Core32/Salsa20.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::sign_detached in vendor/paragonie/sodium_compat/src/Core/Ed25519.php
@internal You should not use this directly from another application

... See full list

File

vendor/paragonie/sodium_compat/src/Compat.php, line 3192

Class

ParagonIE_Sodium_Compat

Code

public static function memzero(&$var) {

  /* Type checks: */
  ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1);
  if (self::useNewSodiumAPI()) {

    /** @psalm-suppress MixedArgument */
    sodium_memzero($var);
    return;
  }
  if (self::use_fallback('memzero')) {
    $func = '\\Sodium\\memzero';
    $func($var);
    if ($var === null) {
      return;
    }
  }

  // This is the best we can do.
  throw new SodiumException('This is not implemented in sodium_compat, as it is not possible to securely wipe memory from PHP. ' . 'To fix this error, make sure libsodium is installed and the PHP extension is enabled.');
}