PHP libsodium change predefined constant

101 Views Asked by At

I am trying to change the below libsoium predefined constant

SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES

from 12 to 20 and I am unable to find where this is being set or even better how I can set it at run time.

I searched my entire server for any possible ini files to no avail.

Any tips greatly appreciated.

PS: There is also no docs for configuration changes https://www.php.net/manual/en/sodium.configuration.php

1

There are 1 best solutions below

0
On

In case someone would need to do this, the only way I managed to work around it is by including the sodium compat library and tweak that one instead of the native one that comes with php.

Sodium Compat

Find CRYPTO_AEAD_AES256GCM_NPUBBYTES and change it from 12 to 20

const CRYPTO_AEAD_AES256GCM_NPUBBYTES = 20;

in file sodium_compat/Compat.php