Skip to content
  • Jun Aruga's avatar
    543dd740
    Fix test_pkey_dh.rb in FIPS. · 543dd740
    Jun Aruga authored
    We use dh2048_ffdhe2048.pem file (DH 2048 bits) instead of dh1024.pem file in
    both non-FIPS and FIPS cases. Because the following command fails to generate
    the pem file with 1024 bits. And the OpenSSL FIPS 140-2 security policy
    document explains the DH public keys are allowed from 2048 bits.[1]
    
    ```
    $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
      /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \
      dhparam -out dh1024.pem 1024
    Generating DH parameters, 1024 bit long safe prime
    dhparam: Generating DH key parameters failed
    ```
    
    The dh2048_ffdhe2048.pem file was created by the following command with the
    OpenSSL FIPS configuration file. The logic to generate the DH pem file is
    different between non-FIPS and FIPS cases. In FIPS, it seems that the command
    always returns the text defined as ffdhe2048 in the FFDHE groups in RFC 7919
    unlike non-FIPS.[2]
    
    As the generated pem file is a normal and valid PKCS#3-style group parameter, we
    use the file for the non-FIPS case too.
    
    ```
    $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
      /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \
      dhparam -out dh2048_ffdhe2048.pem 2048
    ```
    
    Note that the hard-coded PEM-encoded string in the `test_DHparams` is
    intentional to avoid modifying the content unintentionally.
    
    * [1] https://www.openssl.org/source/ - OpenSSL 3.0.8 FIPS 140-2 security
      policy document page 25, Table 10 – Public Keys - DH Public
      - DH (2048/3072/4096/6144/8192) public key agreement key
    * [2] RFC7919 - Appendix A.1: ffdhe2048
      https://www.rfc-editor.org/rfc/rfc7919#appendix-A.1
    543dd740
    Fix test_pkey_dh.rb in FIPS.
    Jun Aruga authored
    We use dh2048_ffdhe2048.pem file (DH 2048 bits) instead of dh1024.pem file in
    both non-FIPS and FIPS cases. Because the following command fails to generate
    the pem file with 1024 bits. And the OpenSSL FIPS 140-2 security policy
    document explains the DH public keys are allowed from 2048 bits.[1]
    
    ```
    $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
      /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \
      dhparam -out dh1024.pem 1024
    Generating DH parameters, 1024 bit long safe prime
    dhparam: Generating DH key parameters failed
    ```
    
    The dh2048_ffdhe2048.pem file was created by the following command with the
    OpenSSL FIPS configuration file. The logic to generate the DH pem file is
    different between non-FIPS and FIPS cases. In FIPS, it seems that the command
    always returns the text defined as ffdhe2048 in the FFDHE groups in RFC 7919
    unlike non-FIPS.[2]
    
    As the generated pem file is a normal and valid PKCS#3-style group parameter, we
    use the file for the non-FIPS case too.
    
    ```
    $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
      /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \
      dhparam -out dh2048_ffdhe2048.pem 2048
    ```
    
    Note that the hard-coded PEM-encoded string in the `test_DHparams` is
    intentional to avoid modifying the content unintentionally.
    
    * [1] https://www.openssl.org/source/ - OpenSSL 3.0.8 FIPS 140-2 security
      policy document page 25, Table 10 – Public Keys - DH Public
      - DH (2048/3072/4096/6144/8192) public key agreement key
    * [2] RFC7919 - Appendix A.1: ffdhe2048
      https://www.rfc-editor.org/rfc/rfc7919#appendix-A.1
Loading