php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
libsodium.c File Reference
#include "php.h"
#include "ext/standard/info.h"
#include "php_libsodium.h"
#include "zend_attributes.h"
#include "zend_exceptions.h"
#include <sodium.h>
#include <stdint.h>
#include <string.h>
#include "libsodium_arginfo.h"

Go to the source code of this file.

Macros

#define PHP_SODIUM_ZSTR_TRUNCATE(zs, len)
 
#define crypto_kdf_BYTES_MIN   16
 
#define crypto_kdf_BYTES_MAX   64
 
#define crypto_kdf_CONTEXTBYTES   8
 
#define crypto_kdf_KEYBYTES   32
 
#define crypto_kx_SEEDBYTES   32
 
#define crypto_kx_SESSIONKEYBYTES   32
 
#define crypto_kx_PUBLICKEYBYTES   32
 
#define crypto_kx_SECRETKEYBYTES   32
 
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES   crypto_aead_chacha20poly1305_KEYBYTES
 
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES   crypto_aead_chacha20poly1305_NSECBYTES
 
#define crypto_aead_chacha20poly1305_IETF_ABYTES   crypto_aead_chacha20poly1305_ABYTES
 
#define crypto_pwhash_OPSLIMIT_MIN   crypto_pwhash_OPSLIMIT_INTERACTIVE
 
#define crypto_pwhash_MEMLIMIT_MIN   crypto_pwhash_MEMLIMIT_INTERACTIVE
 
#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN   crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
 
#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN   crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
 

Functions

 PHP_MINIT_FUNCTION (sodium)
 
 PHP_MSHUTDOWN_FUNCTION (sodium)
 
 PHP_MINFO_FUNCTION (sodium)
 
 PHP_FUNCTION (sodium_memzero)
 
 PHP_FUNCTION (sodium_increment)
 
 PHP_FUNCTION (sodium_add)
 
 PHP_FUNCTION (sodium_memcmp)
 
 PHP_FUNCTION (sodium_crypto_shorthash)
 
 PHP_FUNCTION (sodium_crypto_secretbox)
 
 PHP_FUNCTION (sodium_crypto_secretbox_open)
 
 PHP_FUNCTION (sodium_crypto_generichash)
 
 PHP_FUNCTION (sodium_crypto_generichash_init)
 
 PHP_FUNCTION (sodium_crypto_generichash_update)
 
 PHP_FUNCTION (sodium_crypto_generichash_final)
 
 PHP_FUNCTION (sodium_crypto_box_keypair)
 
 PHP_FUNCTION (sodium_crypto_box_seed_keypair)
 
 PHP_FUNCTION (sodium_crypto_box_keypair_from_secretkey_and_publickey)
 
 PHP_FUNCTION (sodium_crypto_box_secretkey)
 
 PHP_FUNCTION (sodium_crypto_box_publickey)
 
 PHP_FUNCTION (sodium_crypto_box_publickey_from_secretkey)
 
 PHP_FUNCTION (sodium_crypto_box)
 
 PHP_FUNCTION (sodium_crypto_box_open)
 
 PHP_FUNCTION (sodium_crypto_box_seal)
 
 PHP_FUNCTION (sodium_crypto_box_seal_open)
 
 PHP_FUNCTION (sodium_crypto_sign_keypair)
 
 PHP_FUNCTION (sodium_crypto_sign_seed_keypair)
 
 PHP_FUNCTION (sodium_crypto_sign_keypair_from_secretkey_and_publickey)
 
 PHP_FUNCTION (sodium_crypto_sign_publickey_from_secretkey)
 
 PHP_FUNCTION (sodium_crypto_sign_secretkey)
 
 PHP_FUNCTION (sodium_crypto_sign_publickey)
 
 PHP_FUNCTION (sodium_crypto_sign)
 
 PHP_FUNCTION (sodium_crypto_sign_open)
 
 PHP_FUNCTION (sodium_crypto_sign_detached)
 
 PHP_FUNCTION (sodium_crypto_sign_verify_detached)
 
 PHP_FUNCTION (sodium_crypto_stream)
 
 PHP_FUNCTION (sodium_crypto_stream_xor)
 
 PHP_FUNCTION (sodium_crypto_aead_aes256gcm_is_available)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_encrypt)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_decrypt)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
 
 PHP_FUNCTION (sodium_bin2hex)
 
 PHP_FUNCTION (sodium_hex2bin)
 
 PHP_FUNCTION (sodium_crypto_scalarmult)
 
 PHP_FUNCTION (sodium_crypto_kx_seed_keypair)
 
 PHP_FUNCTION (sodium_crypto_kx_keypair)
 
 PHP_FUNCTION (sodium_crypto_kx_secretkey)
 
 PHP_FUNCTION (sodium_crypto_kx_publickey)
 
 PHP_FUNCTION (sodium_crypto_kx_client_session_keys)
 
 PHP_FUNCTION (sodium_crypto_kx_server_session_keys)
 
 PHP_FUNCTION (sodium_crypto_auth)
 
 PHP_FUNCTION (sodium_crypto_auth_verify)
 
 PHP_FUNCTION (sodium_crypto_sign_ed25519_sk_to_curve25519)
 
 PHP_FUNCTION (sodium_crypto_sign_ed25519_pk_to_curve25519)
 
 PHP_FUNCTION (sodium_compare)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_keygen)
 
 PHP_FUNCTION (sodium_crypto_aead_chacha20poly1305_ietf_keygen)
 
 PHP_FUNCTION (sodium_crypto_auth_keygen)
 
 PHP_FUNCTION (sodium_crypto_generichash_keygen)
 
 PHP_FUNCTION (sodium_crypto_kdf_keygen)
 
 PHP_FUNCTION (sodium_crypto_secretbox_keygen)
 
 PHP_FUNCTION (sodium_crypto_shorthash_keygen)
 
 PHP_FUNCTION (sodium_crypto_stream_keygen)
 
 PHP_FUNCTION (sodium_crypto_kdf_derive_from_key)
 
 PHP_FUNCTION (sodium_pad)
 
 PHP_FUNCTION (sodium_unpad)
 

Variables

zend_module_entry sodium_module_entry
 

Macro Definition Documentation

◆ crypto_aead_chacha20poly1305_IETF_ABYTES

#define crypto_aead_chacha20poly1305_IETF_ABYTES   crypto_aead_chacha20poly1305_ABYTES

Definition at line 76 of file libsodium.c.

◆ crypto_aead_chacha20poly1305_IETF_KEYBYTES

#define crypto_aead_chacha20poly1305_IETF_KEYBYTES   crypto_aead_chacha20poly1305_KEYBYTES

Definition at line 70 of file libsodium.c.

◆ crypto_aead_chacha20poly1305_IETF_NSECBYTES

#define crypto_aead_chacha20poly1305_IETF_NSECBYTES   crypto_aead_chacha20poly1305_NSECBYTES

Definition at line 73 of file libsodium.c.

◆ crypto_kdf_BYTES_MAX

#define crypto_kdf_BYTES_MAX   64

Definition at line 55 of file libsodium.c.

◆ crypto_kdf_BYTES_MIN

#define crypto_kdf_BYTES_MIN   16

Definition at line 54 of file libsodium.c.

◆ crypto_kdf_CONTEXTBYTES

#define crypto_kdf_CONTEXTBYTES   8

Definition at line 56 of file libsodium.c.

◆ crypto_kdf_KEYBYTES

#define crypto_kdf_KEYBYTES   32

Definition at line 57 of file libsodium.c.

◆ crypto_kx_PUBLICKEYBYTES

#define crypto_kx_PUBLICKEYBYTES   32

Definition at line 63 of file libsodium.c.

◆ crypto_kx_SECRETKEYBYTES

#define crypto_kx_SECRETKEYBYTES   32

Definition at line 64 of file libsodium.c.

◆ crypto_kx_SEEDBYTES

#define crypto_kx_SEEDBYTES   32

Definition at line 61 of file libsodium.c.

◆ crypto_kx_SESSIONKEYBYTES

#define crypto_kx_SESSIONKEYBYTES   32

Definition at line 62 of file libsodium.c.

◆ crypto_pwhash_MEMLIMIT_MIN

#define crypto_pwhash_MEMLIMIT_MIN   crypto_pwhash_MEMLIMIT_INTERACTIVE

Definition at line 87 of file libsodium.c.

◆ crypto_pwhash_OPSLIMIT_MIN

#define crypto_pwhash_OPSLIMIT_MIN   crypto_pwhash_OPSLIMIT_INTERACTIVE

Definition at line 84 of file libsodium.c.

◆ crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN

#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN   crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE

Definition at line 93 of file libsodium.c.

◆ crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN

#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN   crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE

Definition at line 90 of file libsodium.c.

◆ PHP_SODIUM_ZSTR_TRUNCATE

#define PHP_SODIUM_ZSTR_TRUNCATE ( zs,
len )
Value:
do { ZSTR_LEN(zs) = (len); } while(0)
size_t len
Definition apprentice.c:174
#define ZSTR_LEN(zstr)
Definition zend_string.h:69

Definition at line 31 of file libsodium.c.

Function Documentation

◆ PHP_FUNCTION() [1/63]

PHP_FUNCTION ( sodium_add )

Definition at line 239 of file libsodium.c.

◆ PHP_FUNCTION() [2/63]

PHP_FUNCTION ( sodium_bin2hex )

Definition at line 2454 of file libsodium.c.

◆ PHP_FUNCTION() [3/63]

PHP_FUNCTION ( sodium_compare )

Definition at line 3004 of file libsodium.c.

◆ PHP_FUNCTION() [4/63]

Definition at line 1734 of file libsodium.c.

◆ PHP_FUNCTION() [5/63]

Definition at line 2155 of file libsodium.c.

◆ PHP_FUNCTION() [6/63]

Definition at line 2099 of file libsodium.c.

◆ PHP_FUNCTION() [7/63]

Definition at line 2272 of file libsodium.c.

◆ PHP_FUNCTION() [8/63]

Definition at line 2212 of file libsodium.c.

◆ PHP_FUNCTION() [9/63]

Definition at line 3076 of file libsodium.c.

◆ PHP_FUNCTION() [10/63]

Definition at line 3065 of file libsodium.c.

◆ PHP_FUNCTION() [11/63]

PHP_FUNCTION ( sodium_crypto_auth )

Definition at line 2885 of file libsodium.c.

◆ PHP_FUNCTION() [12/63]

PHP_FUNCTION ( sodium_crypto_auth_keygen )

Definition at line 3100 of file libsodium.c.

◆ PHP_FUNCTION() [13/63]

PHP_FUNCTION ( sodium_crypto_auth_verify )

Definition at line 2916 of file libsodium.c.

◆ PHP_FUNCTION() [14/63]

PHP_FUNCTION ( sodium_crypto_box )

Definition at line 728 of file libsodium.c.

◆ PHP_FUNCTION() [15/63]

PHP_FUNCTION ( sodium_crypto_box_keypair )

Definition at line 569 of file libsodium.c.

◆ PHP_FUNCTION() [16/63]

Definition at line 622 of file libsodium.c.

◆ PHP_FUNCTION() [17/63]

PHP_FUNCTION ( sodium_crypto_box_open )

Definition at line 774 of file libsodium.c.

◆ PHP_FUNCTION() [18/63]

PHP_FUNCTION ( sodium_crypto_box_publickey )

Definition at line 678 of file libsodium.c.

◆ PHP_FUNCTION() [19/63]

Definition at line 702 of file libsodium.c.

◆ PHP_FUNCTION() [20/63]

PHP_FUNCTION ( sodium_crypto_box_seal )

Definition at line 818 of file libsodium.c.

◆ PHP_FUNCTION() [21/63]

PHP_FUNCTION ( sodium_crypto_box_seal_open )

Definition at line 852 of file libsodium.c.

◆ PHP_FUNCTION() [22/63]

PHP_FUNCTION ( sodium_crypto_box_secretkey )

Definition at line 655 of file libsodium.c.

◆ PHP_FUNCTION() [23/63]

Definition at line 591 of file libsodium.c.

◆ PHP_FUNCTION() [24/63]

PHP_FUNCTION ( sodium_crypto_generichash )

Definition at line 401 of file libsodium.c.

◆ PHP_FUNCTION() [25/63]

Definition at line 520 of file libsodium.c.

◆ PHP_FUNCTION() [26/63]

Definition at line 441 of file libsodium.c.

◆ PHP_FUNCTION() [27/63]

Definition at line 3111 of file libsodium.c.

◆ PHP_FUNCTION() [28/63]

Definition at line 481 of file libsodium.c.

◆ PHP_FUNCTION() [29/63]

Definition at line 3178 of file libsodium.c.

◆ PHP_FUNCTION() [30/63]

PHP_FUNCTION ( sodium_crypto_kdf_keygen )

Definition at line 3122 of file libsodium.c.

◆ PHP_FUNCTION() [31/63]

Definition at line 2785 of file libsodium.c.

◆ PHP_FUNCTION() [32/63]

PHP_FUNCTION ( sodium_crypto_kx_keypair )

Definition at line 2716 of file libsodium.c.

◆ PHP_FUNCTION() [33/63]

PHP_FUNCTION ( sodium_crypto_kx_publickey )

Definition at line 2761 of file libsodium.c.

◆ PHP_FUNCTION() [34/63]

PHP_FUNCTION ( sodium_crypto_kx_secretkey )

Definition at line 2738 of file libsodium.c.

◆ PHP_FUNCTION() [35/63]

Definition at line 2683 of file libsodium.c.

◆ PHP_FUNCTION() [36/63]

Definition at line 2835 of file libsodium.c.

◆ PHP_FUNCTION() [37/63]

PHP_FUNCTION ( sodium_crypto_scalarmult )

Definition at line 2588 of file libsodium.c.

◆ PHP_FUNCTION() [38/63]

PHP_FUNCTION ( sodium_crypto_secretbox )

Definition at line 318 of file libsodium.c.

◆ PHP_FUNCTION() [39/63]

Definition at line 3133 of file libsodium.c.

◆ PHP_FUNCTION() [40/63]

PHP_FUNCTION ( sodium_crypto_secretbox_open )

Definition at line 360 of file libsodium.c.

◆ PHP_FUNCTION() [41/63]

PHP_FUNCTION ( sodium_crypto_shorthash )

Definition at line 288 of file libsodium.c.

◆ PHP_FUNCTION() [42/63]

Definition at line 3144 of file libsodium.c.

◆ PHP_FUNCTION() [43/63]

PHP_FUNCTION ( sodium_crypto_sign )

Definition at line 1051 of file libsodium.c.

◆ PHP_FUNCTION() [44/63]

PHP_FUNCTION ( sodium_crypto_sign_detached )

Definition at line 1138 of file libsodium.c.

◆ PHP_FUNCTION() [45/63]

Definition at line 2976 of file libsodium.c.

◆ PHP_FUNCTION() [46/63]

Definition at line 2948 of file libsodium.c.

◆ PHP_FUNCTION() [47/63]

PHP_FUNCTION ( sodium_crypto_sign_keypair )

Definition at line 889 of file libsodium.c.

◆ PHP_FUNCTION() [48/63]

Definition at line 942 of file libsodium.c.

◆ PHP_FUNCTION() [49/63]

PHP_FUNCTION ( sodium_crypto_sign_open )

Definition at line 1095 of file libsodium.c.

◆ PHP_FUNCTION() [50/63]

PHP_FUNCTION ( sodium_crypto_sign_publickey )

Definition at line 1027 of file libsodium.c.

◆ PHP_FUNCTION() [51/63]

Definition at line 975 of file libsodium.c.

◆ PHP_FUNCTION() [52/63]

PHP_FUNCTION ( sodium_crypto_sign_secretkey )

Definition at line 1004 of file libsodium.c.

◆ PHP_FUNCTION() [53/63]

Definition at line 911 of file libsodium.c.

◆ PHP_FUNCTION() [54/63]

Definition at line 1177 of file libsodium.c.

◆ PHP_FUNCTION() [55/63]

PHP_FUNCTION ( sodium_crypto_stream )

Definition at line 1209 of file libsodium.c.

◆ PHP_FUNCTION() [56/63]

PHP_FUNCTION ( sodium_crypto_stream_keygen )

Definition at line 3155 of file libsodium.c.

◆ PHP_FUNCTION() [57/63]

PHP_FUNCTION ( sodium_crypto_stream_xor )

Definition at line 1249 of file libsodium.c.

◆ PHP_FUNCTION() [58/63]

PHP_FUNCTION ( sodium_hex2bin )

Definition at line 2478 of file libsodium.c.

◆ PHP_FUNCTION() [59/63]

PHP_FUNCTION ( sodium_increment )

Definition at line 216 of file libsodium.c.

◆ PHP_FUNCTION() [60/63]

PHP_FUNCTION ( sodium_memcmp )

Definition at line 268 of file libsodium.c.

◆ PHP_FUNCTION() [61/63]

PHP_FUNCTION ( sodium_memzero )

Definition at line 192 of file libsodium.c.

◆ PHP_FUNCTION() [62/63]

PHP_FUNCTION ( sodium_pad )

Definition at line 3249 of file libsodium.c.

◆ PHP_FUNCTION() [63/63]

PHP_FUNCTION ( sodium_unpad )

Definition at line 3325 of file libsodium.c.

◆ PHP_MINFO_FUNCTION()

PHP_MINFO_FUNCTION ( sodium )

Definition at line 183 of file libsodium.c.

◆ PHP_MINIT_FUNCTION()

PHP_MINIT_FUNCTION ( sodium )

Definition at line 157 of file libsodium.c.

◆ PHP_MSHUTDOWN_FUNCTION()

PHP_MSHUTDOWN_FUNCTION ( sodium )

Definition at line 177 of file libsodium.c.

Variable Documentation

◆ sodium_module_entry

zend_module_entry sodium_module_entry
Initial value:
= {
sodium_deps,
"sodium",
ext_functions,
PHP_MINIT(sodium),
PHP_MSHUTDOWN(sodium),
PHP_MINFO(sodium),
}
#define NULL
Definition gdcache.h:45
#define PHP_MINFO
Definition php.h:396
#define PHP_MSHUTDOWN
Definition php.h:393
#define PHP_MINIT
Definition php.h:392
#define PHP_SODIUM_VERSION
#define STANDARD_MODULE_PROPERTIES
#define STANDARD_MODULE_HEADER_EX

Definition at line 104 of file libsodium.c.