Act nowcan affect a running system
Crypto hardening reaches RSA, P-256 and authenticated tunnels
This complete Tuesday edition combines a broad RSA and CSPRNG hardening pass with strict validation of P-256 public keys. Tunnel handshakes now authenticate their JSON payloads and reject oversized or excessive queued frames. HTTP servers also emit the RFC-required Content-Range header on 416 responses. Direct TBigInt.IsPrime callers must migrate to the new TAesPrngAbstract argument.
TL;DR
- Use build 2.4.17609 for the complete crypto, tunnel and HTTP hardening sequence.
- P-256 ECDH and ECDSA now reject malformed, non-canonical and off-curve public keys before arithmetic.
- Certificate-authenticated tunnel handshakes now cover their JSON payload and enforce frame and queue limits.
- RSA padding, signatures, prime generation and OS-random failure handling receive additional safeguards.
- TBigInt.IsPrime now accepts TAesPrngAbstract instead of PLecuyer; direct callers must migrate.
- HTTP 416 responses now carry one correct Content-Range: bytes */<size> header.
Upgrade advice
Use build 2.4.17609 rather than stopping in the middle of this hardening sequence. Recompile direct TBigInt.IsPrime callers with TAesPrngAbstract, deploy both ends of certificate-authenticated tunnels together, and rerun RSA, P-256, tunnel and HTTP range tests on every Delphi/FPC target you ship.
30 of 30 entries · 31 commits upstream
1
Critical
P-256 operations reject public points outside the curve
The Pascal P-256 backend validates canonical coordinates and the curve equation before ECDH or ECDSA arithmetic, validates private scalars, rejects invalid compressed prefixes and zeroes failed outputs.
Security
mormot.crypt.ecc256r1
3a734d76+107-31
crypt: validate an affine P-256 point before using it for ECC operations
Impact
Untrusted malformed P-256 keys are rejected before scalar multiplication or signature verification in Delphi and FPC builds using the Pascal backend.
Upgrade recommended
Upgrade to build 2.4.17609 and rerun ECDH, ECDSA and certificate tests with malformed and off-curve keys.
Public API
ecdh_shared_secret_pasbehaviour-changed — Returns false and a zeroed secret for malformed, off-curve or invalid-scalar inputs.
2
High
RSA primality tests switch from L'Ecuyer state to a NIST DRBG
TBigInt.IsPrime replaces its optional PLecuyer parameter with TAesPrngAbstract. Internal prime generation now uses TAesPrng.Main for Miller-Rabin witnesses.
Breaking changes
mormot.crypt.rsa
9bce2b48+23-18
crypt: enhanced RSA compliance with NIST recommandations
Impact
Direct callers passing a PLecuyer pointer no longer compile; default callers silently move to the framework's AES-based DRBG on Delphi and FPC.
Migration required
Search for TBigInt.IsPrime calls with a third argument and pass a TAesPrngAbstract instance instead.
Public API
TBigInt.IsPrimesignature-changed — The third parameter is now TAesPrngAbstract instead of PLecuyer.
Units
3
High
Tunnel certificates now authenticate the JSON handshake payload
TTunnelLocal.OpenInternal appends JSON before FrameSign, verifies the signature over the fixed handshake plus JSON ciphertext, validates lengths first and decrypts only after authentication.
Security
mormot.net.tunnel
700b6ad5+42-28
net: tunnel authenticate its JSON handshake payload with certificates
Impact
Certificate-authenticated tunnels detect tampering with InfoNameValue data. Because the signed frame layout changed, both tunnel endpoints should run the same revision.
Upgrade recommended
Deploy both tunnel endpoints together at build 2.4.17609 and test certificate and AppSecret handshake combinations.
Units
4
High
System-random failures now stop security-sensitive operations
TAesPrngAbstract.GetEntropy, TSystemPrng.FillRandom and TCryptRandomSysPrng.Get raise on required OS API failure. TBigInt.FillPrime seeds through FillRandomTrusted and rejects an empty result.
Security
mormot.crypt.core+2
efdf73f3+32-17
crypt: hardened FillSystemRandom() API usage
Impact
Delphi and FPC backends fail explicitly instead of continuing after unavailable OS randomness; RSA key generation now depends on a compliant source being present.
Upgrade recommended
Upgrade and exercise entropy-failure handling on every supported operating system, especially containers and restricted services.
Public API
TAesPrngAbstract.GetEntropybehaviour-changed — System-only modes now raise ESynCrypto when the operating-system source fails.TSystemPrng.FillRandombehaviour-changed — The method now raises ESynCrypto instead of ignoring an OS random-source failure.
5
High
RSA verification rejects non-exact DER and PSS signatures keep fixed width
TRsa.Verify now compares the recovered DigestInfo with the exact DER produced by RsaSignHashToDer. TRsaPss.Sign serializes the CRT result with SaveFixed(fModulusLen).
Security
mormot.crypt.rsa
118b6572+16-26
crypt: some RSA hardening
Impact
Malformed, truncated or extended PKCS#1 v1.5 DigestInfo encodings are rejected, and native PSS signatures retain modulus width across Delphi and FPC.
Upgrade recommended
Upgrade and rerun PKCS#1 v1.5 and PSS known-answer and malformed-signature tests.
Units
6
High
Tunnels reject oversized frames and handshake queue floods
TTunnelLocal.TunnelSend enforces a 72 KB frame ceiling and a 128-frame handshake queue limit. The Info key derivation also gains an explicit domain-separation label.
Security
mormot.net.tunnel
7a471dd7+30-10
net: defensive limits against malformed or excessive tunnel frames
Impact
Malformed relays or peers can no longer enqueue unbounded handshake data or send frames beyond the local receive contract; excessive input now raises ETunnel.
Upgrade recommended
Upgrade tunnel endpoints together and confirm that application frames stay below 72 KB and pre-open queues below 128 frames.
Units
7
High
Miller-Rabin witnesses now follow FIPS 186-5 sampling
TBigInt.FillMillerRabinWitness uses rejection sampling across the candidate's full bit width, then maps accepted values into the FIPS 186-5 B.3.1 witness interval.
Security
mormot.crypt.rsa
319cd63e+19-18
crypt: RSA Miller-Rabin witness selection as described in FIPS 186-5 B.3.1
Impact
RSA prime testing no longer biases witnesses through a truncated modulus; Delphi and FPC key generation gain the final standards-compliance correction.
Upgrade recommended
Use build 2.4.17586 and rerun RSA generation plus independent primality checks.
Units
8
High
Certificate key decompression failures can no longer pass silently
Ecc256r1Uncompress now documents zero output on failure. TEccCertificate.LoadFromStream rejects that output, constructors raise, and Ecc256r1UncompressAsn1 returns an empty result for invalid input.
Security
mormot.crypt.ecc+1
74778eda+17-6
crypt: ensure public keys decompression is validated
Impact
Malformed compressed P-256 certificate keys fail loading or construction instead of leaving a zero public point available to later verification code.
Upgrade recommended
Upgrade and test certificate import with valid keys plus invalid prefixes, non-canonical coordinates and off-curve points.
Public API
Ecc256r1Uncompressbehaviour-changed — Invalid input is represented by a zeroed uncompressed output and is checked by certificate callers.
9
High
PKCS#1 v1.5 encryption padding now uses nonzero CSPRNG bytes
TRsa.Pkcs1Pad replaces SharedRandom.Fill plus byte adjustment with GetDrbg.FillRandomNotZero for EME-PKCS1-v1_5 block type 2 padding.
Security
mormot.crypt.rsa
6a8ede59+8-11
crypt: EME-PKCS1-v1_5 requires non zero unpredictable random padding
Impact
Native RSA encryption no longer derives its mandatory nonzero padding from the lightweight shared generator; ciphertext format and calling APIs remain unchanged.
Upgrade recommended
Upgrade to build 2.4.17609 and rerun RSAES-PKCS1-v1_5 encryption interoperability tests.
Units
10
High
Native RSA signatures verify themselves before returning
TRsa.Sign and TRsaPss.Sign immediately call Verify on each nonempty result and raise ERsaException when the generated signature fails verification.
Security
mormot.crypt.rsa
d4303584+11-3
crypt: self-verification of the RSA/RSA-PSS signature
Impact
Faults or internal arithmetic errors can no longer silently emit an invalid PKCS#1 or PSS signature, at the cost of an additional public-key verification.
Upgrade recommended
Upgrade and account for the extra verification cost in high-rate native RSA signing services.
Units
11
High
The new exponent-65537 filter handles negative accumulators correctly
TBigInt.PrimeAllowedFor65537 changes i, v and sum from PtrUInt to PtrInt because its limb reduction deliberately subtracts values and may produce a negative sum.
Fixes
mormot.crypt.rsa
a580c994+3-3
crypt: fixed previous commit accumulator sign
Impact
The immediately preceding RSA prime-candidate optimization no longer interprets a negative accumulator as unsigned on Delphi or FPC targets.
Upgrade recommended
Do not stop on build 2.4.17594; use build 2.4.17595 or later, preferably 2.4.17609.
Units
12
High
XorRandom now advances through buffers larger than 8 KB
TAesPrngAbstract.XorRandom increments its Buffer pointer after each temporary chunk. Previously every loop XORed the first chunk again while reducing Len.
Fixes
mormot.crypt.core
768b8f66+3-2
crypt: fixed TAesPrngAbstract.XorRandom method
Impact
Calls longer than the internal 8 KB temporary buffer now randomize the complete destination instead of repeatedly modifying only its beginning.
Upgrade recommended
Upgrade to build 2.4.17597 or later and retest every XorRandom call that can exceed 8192 bytes.
Public API
TAesPrngAbstract.XorRandombehaviour-changed — Buffers larger than the internal chunk size are now processed in full.
Units
13
Medium
RSA consistently resolves its configured CSPRNG before use
TRsa.GetDrbg lazily assigns TAesPrng.Main when fDrbg is nil. The Drbg property, hybrid sealing and PSS salt generation now use that accessor and FillRandom.
Security
mormot.crypt.rsa
2f93121c+17-12
crypt: use our CSPRNG for RSA padding/DRBG
Impact
RSA padding and salt paths always operate through a concrete TAesPrngAbstract instance on Delphi and FPC; configured custom generators remain supported.
Public API
TRsa.Drbgbehaviour-changed — Reading the property now materializes and returns TAesPrng.Main instead of returning nil by default.
Units
14
Medium
RSA prime worker secrets are wiped by their destructor
TRsaPrimeWorker.Destroy now calls FillZero(NewPrime), centralizing cleanup for success and early-exit paths instead of wiping only after the normal handoff.
Security
mormot.crypt.rsa
351645ad+10-4
crypt: hardened TRsaPrimeWorker cleanup
Impact
Temporary generated prime material has a narrower lifetime in memory during native RSA generation; application APIs and generated keys are unchanged.
Units
15
Medium
HTTP 416 responses report the unsatisfied representation size
THttpRequestContext.RangeNotSatisfiable adds Content-Range: bytes */<size>, clears rfRange and rfWantRange, and is used by stream, file and progressive static-file paths.
Fixes
mormot.net.http+1
652183f7+71-16
net: send Content-Range: bytes */<size> with a 416 response
Impact
Range clients receive the RFC 9110 size hint and no longer risk a second incorrect Content-Range derived from the generated HTML error body.
Upgrade recommended
Upgrade if serving ranged files and verify 416 responses through both HTTP server families and any reverse proxy.
Public API
THttpRequestContext.RangeNotSatisfiableadded — Adds the RFC 9110 Content-Range header, clears range flags and returns HTTP_RANGENOTSATISFIABLE.
16
Medium
Password generation has a bounded retry loop
MakeStrongPassWord accepts an optional iteration counter and raises ESynCrypto after 128 failed quality checks. TAesPrngAbstract.RandomPassword and TCryptRandom.GetPassword pass counters into it.
Fixes
mormot.crypt.core+1
cb709f73+28-14
crypt: hardened MakeStrongPassWord()
Impact
A weak or broken random provider can no longer keep the standard AES password generator in an unbounded loop; normal generated passwords are unchanged.
Upgrade recommended
Upgrade and ensure callers handle ESynCrypto from password generation when custom random providers are installed.
Public API
MakeStrongPassWordsignature-changed — An optional PInteger retry counter was added; existing one-argument calls remain source-compatible.
17
Medium
RSA prime generation initializes its DRBG before parallel work
TRsa.Generate resolves GetDrbg once before starting prime workers and passes that instance to both sequential and local FillPrime calls; FillPrime removes a redundant nil check.
Fixes
mormot.crypt.rsa
14502d3f+7-7
crypt: some RSA fixed of DRBG
Impact
Custom or default random generators are initialized consistently before RSA prime searches on Delphi and FPC; public key-generation calls do not change.
Upgrade recommended
Take the completed sequence at build 2.4.17609 and test custom TRsa.Drbg implementations.
Units
18
Medium
The AES CSPRNG can now fill buffers without zero bytes
TAesPrngAbstract.FillRandomNotZero first fills the requested buffer, replaces any zero octets from fresh 16-byte blocks, wipes temporary material and raises ESynCrypto if a zero remains.
New features
mormot.crypt.core+1
626baa30+87-28
crypt: new TAesPrngAbstract.FillRandomNotZero method
Impact
Delphi and FPC code that needs PKCS-style nonzero random padding can use one checked CSPRNG operation; existing callers are unchanged.
Public API
TAesPrngAbstract.FillRandomNotZeroadded — Fills a supplied buffer with CSPRNG bytes and guarantees that no byte is zero.
19
Medium
A new helper combines operating-system and hardware randomness
TAesPrngAbstract.FillRandomTrusted requests blocking system randomness and, on supported Intel or AMD CPUs, XORs RDRAND output; it returns an empty string when no accepted source is available.
New features
mormot.core.os+1
fcaa3d81+33-3
crypt: new TAesPrngAbstract.FillRandomTrusted() method
Impact
Native cryptographic seeding can explicitly require combined trusted sources and detect their absence; normal TAesPrng filling remains unchanged.
Public API
TAesPrngAbstract.FillRandomTrustedadded — Returns random bytes from accepted external sources for key seeding, or an empty string on failure.
20
Medium
RSA key generation computes its two primes on separate cores
TRsa.Generate runs p and q prime searches in two worker tasks, coordinates completion and preserves the existing timeout and cleanup paths.
Performance
mormot.crypt.rsa
0f2aa131+103-27
crypt: compute p/q RSA primes in parallel in two CPU cores
Impact
RSA key creation can use two CPU cores and complete faster; generated key formats and application calls are unchanged.
Worth a look
Benchmark key generation and confirm worker-thread limits in constrained services.
Units
21
Low
A base-two pretest rejects composite RSA candidates sooner
TBigInt.IsPrime performs one strong probable-prime test with witness 2 before allocating and running the requested random Miller-Rabin rounds.
Performance
mormot.crypt.rsa
5be3ad0c+46-18
crypt: faster TBigInt.IsPrime by using base-2 pretest
Impact
RSA generation discards many composite candidates more cheaply, improving key-generation time with no application change.
Units
22
Low
RSA prime candidates get a direct exponent-65537 filter
TBigInt.PrimeAllowedFor65537 computes the candidate modulo 65537 directly from its limbs and replaces allocation-heavy Modulo and Compare calls in both prime-generation paths.
Performance
mormot.crypt.rsa
0df7461d+30-5
crypt: new TBigInt.PrimeAllowedFor65537 method
Impact
Native RSA key generation performs less temporary BigInt work when rejecting candidates incompatible with exponent 65537; no public API changes.
Units
23
Low
The common RSA exponent gets a dedicated fast path
TRsaContext detects exponent 65537 and uses a short fixed square-and-multiply sequence instead of the generic exponent loop.
Performance
mormot.crypt.rsa
4f07c5c3+16-12
crypt: optimize exponent common prime 65537
Impact
RSA public operations with exponent 65537 become faster on Delphi and FPC without API or output changes.
Units
24
Low
RSA modular powers use a four-bit sliding window
TRsaContext.ModPower expands its precomputed odd-power table from three to four bits and adjusts the scanning loop accordingly.
Performance
mormot.crypt.rsa
e1d2b232+6-6
crypt: use 4-bit sliding window for TRsaContext.ModPower
Impact
Large private-exponent RSA operations use fewer modular multiplications; callers and serialized results are unchanged.
Units
25
Low
RSA BigInt cleanup makes release-and-nil behavior explicit
TBigInt.IsPrime and TRsaContext.AllocateFromHex replace the legacy Release([@pointer]) overload with direct Release calls followed by explicit nil assignments.
Under the hood
mormot.crypt.rsa
12297671+8-5
crypt: minor RSA code cleanup
Impact
This clarifies ownership and failure cleanup inside the native RSA engine; application code, serialized values and runtime behavior are unchanged.
Units
26
Low
ECC tests cover invalid prefixes, scalars and off-curve points
TTestCoreEcc.ECC adds negative ECDH cases for invalid compressed markers, non-canonical X, a quadratic non-residue, a zero uncompressed point and a zero private scalar.
Tests
c9f379d8+33-2
tests: Validate invalid ecc public keys (out of the curve)
Impact
No application-code change. The Pascal ECC validation paths now have regression coverage for the malformed keys fixed earlier in the edition.
27
Low
Security notes are refreshed for the AES PRNG and native RSA
The TAesPrng design document is rewritten against current trunk and a new mormot.crypt.rsa audit describes BigInt arithmetic, key generation, padding, signatures and trust boundaries.
Docs
c3e08fe8+626-381
doc: enhanced security audit documents
Impact
There is no runtime or application-code change; security reviewers gain current implementation guidance for Delphi and FPC deployments.
28
Low
Tunnel security guidance defines the relay threat boundary
A new mormot.net.tunnel security review documents ECDHE, AES-128-GCM, signatures, AppSecret requirements, relay capabilities, deployment guidance and protocol limitations.
Docs
5336ba7b+531-2
doc: Tunnel usage and security audit
Impact
No runtime change. Deployments gain explicit guidance that ECDHE alone does not authenticate against an active relay without a trusted certificate or strong independent AppSecret.
Worth a look
Audit tunnel deployments for trusted VerifyCert configuration or a confidential independently provisioned AppSecret with at least 128 bits of entropy.
29
Low
SChannel mutual TLS receives a focused security review
A new SChannel-mTLS document records server certificate handling, client-certificate chain validation, callbacks, trust anchors, ownership and known Windows backend boundaries.
Docs
4462e2f5+263-3
doc: new SChannel audit document
Impact
No executable code changes. Teams using native Windows TLS gain explicit deployment constraints for client authentication and callback overrides.
30
Low
Tunnel metadata is documented as obfuscated rather than secret
The TTunnelLocal.Open contract now states that InfoNameValue is obfuscated with AppSecret but must not contain sensitive data.
Docs
mormot.net.tunnel
b44fb747+4-3
doc: precisions about Tunnel Info name/value security expectations
Impact
No runtime change. Applications should keep credentials, tokens and other secrets out of InfoNameValue even when tunnel encryption is enabled.
Worth a look
Review every InfoNameValue payload and remove credentials or other sensitive values.