Skip to content
  • Aaron Jones's avatar
    Build System: Separate the RNG providers & code · d9b514bf
    Aaron Jones authored
    This breaks the existing libathemecore/arc4random.c down into 3 files:
    
    - libathemecore/random_frontend.c
    
      This file is responsible for including one of the frontends below.
      This inclusion approach is elucidiated in commit bf697f05.
    
    - libathemecore/random_fe_internal.c
    
      This frontend is the internal ChaCha20-based fallback RNG taken from
      OpenBSD libc. It is used if no other files below are suitable.
    
    - libathemecore/random_fe_mbedtls.c
    
      This frontend is the RNG based on ARM mbedTLS HMAC-DRBG. This is just
      the code that was already in libathemecore, but in another file
      instead of intertwined with ifdef spaghetti.
    
    Additionally, 2 new frontends are introduced:
    
    - libathemecore/random_fe_openbsd.c
    
      This frontend is used if building on an OpenBSD machine. It uses
      OpenBSD's arc4random(3), located in libc.
    
    - libathemecore/random_fe_sodium.c
    
      This frontend uses the randombytes API in libsodium.
    
    The preferred frontend order is:
    
      - OpenBSD arc4random(3), or
      - libsodium randombytes(3), or
      - ARM mbedTLS hmac_drbg_random(3), or
      - Internal ChaCha20-based Fallback RNG, seeded by:
        - getentropy(3), or
        - getrandom(2), or
        - urandom(4)
    d9b514bf
To find the state of this project's repository at the time of any of these versions, check out the tags.