Skip to content

crypto:strong_rand_bytes/1 fails with low_entropy in containerized environments #541

Description

@jax-cn

Description

The application crashes with a low_entropy error when calling crypto:strong_rand_bytes/1 during HTTP signature generation, particularly in containerized or virtualized environments.

Error Details

Error: low_entropy

Stack trace:
crypto:strong_rand_bytes/1 [crypto.erl:1992]
rsa_pss:sign/3 [/home/hb/HyperBEAM_SGLang/src/rsa_pss.erl:44]
dev_codec_httpsig:commit/3 [/home/hb/HyperBEAM_SGLang/src/dev_codec_httpsig.erl:168]
dev_message:commit/3 [/home/hb/HyperBEAM_SGLang/src/dev_message.erl:269]
hb_message:commit/3 [/home/hb/HyperBEAM_SGLang/src/hb_message.erl:341]

Environment

  • OS: Ubuntu
  • Erlang/OTP Version: 27
  • branch: edge

Root Cause

The system's entropy pool is insufficient for crypto:strong_rand_bytes/1, which requires high-quality randomness from /dev/random. This commonly occurs in:

  • Virtual machines with limited entropy sources
  • Container environments without hardware RNG access
  • Systems under high cryptographic load

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions