fix(mcp): include scrypt p factor in the maxmem ceiling so it scales with every work factor

This commit is contained in:
Tin Chi Lo 2026-07-10 15:21:17 -07:00
parent ef9637035b
commit 9d87527671

View file

@ -38,7 +38,9 @@ _BEARER_PREFIX = "bearer "
_SCRYPT_N = 2**15
_SCRYPT_R = 8
_SCRYPT_P = 1
_SCRYPT_MAXMEM = 128 * _SCRYPT_N * _SCRYPT_R * 2
# scrypt's working-set is ~128 * N * r * p bytes; cap at twice that so the maxmem ceiling scales
# with every work factor and a future p or r bump does not trip "memory limit exceeded".
_SCRYPT_MAXMEM = 128 * _SCRYPT_N * _SCRYPT_R * _SCRYPT_P * 2
_DERIVED_KEY_BYTES = 32