Skip to content

Conversation

@ms2008
Copy link
Contributor

@ms2008 ms2008 commented Jul 24, 2025

We use PBKDF2 with SHA-256 (single iteration) on FIPS-mode. However, the SP800-132 compliance checks have constraints, with an iteration count of at least 1000. If we do not disable this check, the following error will occur:

unable to derive session encryption key (kdf:derive: error:1C80007B:Provider routines:kdf_pbkdf2_set_ctx_params:invalid iteration count:implementations/kdfs/pbkdf2.c:208:)

For backwards compatibility, I would tend to disable the checks rather than increase the iteration.

Ref:

We use PBKDF2 with SHA-256 (single iteration) on FIPS-mode. However, the
SP800-132 compliance checks have constraints, with an iteration count of
at least 1000. If we do not disable this check, the following error will
occur:

```
unable to derive session encryption key (kdf:derive: error:1C80007B:
Provider routines:kdf_pbkdf2_set_ctx_params:invalid iteration
count:implementations/kdfs/pbkdf2.c:208:)
```

For backwards compatibility, I would tend to disable the checks rather
than increase the iteration.

Ref:

- https:
  //github.com/openssl/openssl/blob/openssl-3.0.9/providers/implementations/kdfs/pbkdf2.c#L208
- https:
  //github.com/openssl/openssl/commit/f0efeea29eca6e528a976f62ae2422eee34ea0eb
@ms2008 ms2008 force-pushed the fix/disable-pkcs5-checks-for-fips branch from ec8b051 to 6dde03c Compare July 24, 2025 08:56
@ms2008 ms2008 marked this pull request as ready for review July 24, 2025 08:57
Copy link
Owner

@bungle bungle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just simplifying

Comment on lines 595 to 598
-- Disables the SP800-132 compliance checks on FIPS-mode. This checks has constraints for the iteration count is at least 1000.
if is_fips_mode() then
PBKDF2_SHA256_OPTS.pkcs5 = 1
end
Copy link
Owner

@bungle bungle Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-- Disables the SP800-132 compliance checks on FIPS-mode. This checks has constraints for the iteration count is at least 1000.
if is_fips_mode() then
PBKDF2_SHA256_OPTS.pkcs5 = 1
end
-- Disables the SP800-132 compliance checks on FIPS-mode. This checks has constraints for the iteration count is at least 1000.
PBKDF2_SHA256_OPTS.pkcs5 = 1

PBKDF2 is only used in FIPS mode, and we can turn this always on.

Or actually I would put this to top level here:
https://github.com/bungle/lua-resty-session/blob/master/lib/resty/session/utils.lua#L633

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bungle
Copy link
Owner

bungle commented Jul 28, 2025

@bungle bungle merged commit 584072d into bungle:master Jul 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants