ssl/ssl_test.cc
// OQS note: This test expects a "baseline" TLS 1.3 session
// client hello to be <= 0xfe bytes, a number obtained with
// the assumption that kDefaultGroups[] in t1_lib.cc has 3
// entries. The addition of OQS post-quantum "groups" to
// kDefaultGroups[] increases the client hello size, which
// means the baseline size might have to be adjusted every
// time kDefaultGroups[] is modified. Since this fork is
// intended for prototyping, we've just opted to disable
// this test.
OQS note: This test expects a "baseline" TLS 1.3 session
client hello to be <= 0xfe bytes, a number obtained with
the assumption that kDefaultGroups[] in t1_lib.cc has 3
entries. The addition of OQS post-quantum "groups" to
kDefaultGroups[] increases the client hello size, which
means the baseline size might have to be adjusted every
time kDefaultGroups[] is modified. Since this fork is
intended for prototyping, we've just opted to disable
this test.
OQS note : This test expects a " baseline " TLS 1 . 3 session client hello to be < = 0xfe bytes a number obtained with the assumption that kDefaultGroups [] in t1_lib . cc has 3 entries . The addition of OQS post - quantum " groups " to kDefaultGroups [] increases the client hello size which means the baseline size might have to be adjusted every time kDefaultGroups [] is modified . Since this fork is intended for prototyping we ' ve just opted to disable this test .
TEST(SSLTest, DISABLED_Padding) {
  struct PaddingVersions {
    uint16_t max_version, session_version;
  };
  static const PaddingVersions kPaddingVersions[] = {
      {TLS1_2_VERSION, TLS1_2_VERSION},
      {TLS1_3_VERSION, TLS1_2_VERSION},
      {TLS1_3_VERSION, TLS1_3_VERSION},
  };
  struct PaddingTest {
    size_t input_len, padded_len;
  };
  static const PaddingTest kPaddingTests[] = {
      {0xfe, 0xfe},
      {0xff, 0xff},
      {0x100, 0x200},
      {0x123, 0x200},
      {0x1fb, 0x200},
      {0x1fc, 0x201},
      {0x1fd, 0x202},
      {0x1fe, 0x203},
      {0x1ff, 0x204},
      {0x200, 0x200},
      {0x201, 0x201},
  };
  for (const PaddingVersions &versions : kPaddingVersions) {
    SCOPED_TRACE(versions.max_version);
    SCOPED_TRACE(versions.session_version);
    size_t base_len =
        GetClientHelloLen(versions.max_version, versions.session_version, 1);
    ASSERT_NE(base_len, 0u) << "Baseline length could not be sampled";
    for (const PaddingTest &test : kPaddingTests) {
      SCOPED_TRACE(test.input_len);
      ASSERT_LE(base_len, test.input_len) << "Baseline ClientHello too long";
      size_t padded_len =
          GetClientHelloLen(versions.max_version, versions.session_version,
                            1 + test.input_len - base_len);
      EXPECT_EQ(padded_len, test.padded_len)
          << "ClientHello was not padded to expected length";
    }
  }
}
TEST ( SSLTest , DISABLED_Padding ) { struct PaddingVersions { uint16_t max_version , session_version ; } ; static const PaddingVersions kPaddingVersions [ ] = { { TLS1_2_VERSION , TLS1_2_VERSION } , { TLS1_3_VERSION , TLS1_2_VERSION } , { TLS1_3_VERSION , TLS1_3_VERSION } , } ; struct PaddingTest { size_t input_len , padded_len ; } ; static const PaddingTest kPaddingTests [ ] = { { 0xfe , 0xfe } , { 0xff , 0xff } , { 0x100 , 0x200 } , { 0x123 , 0x200 } , { 0x1fb , 0x200 } , { 0x1fc , 0x201 } , { 0x1fd , 0x202 } , { 0x1fe , 0x203 } , { 0x1ff , 0x204 } , { 0x200 , 0x200 } , { 0x201 , 0x201 } , } ; for ( const PaddingVersions & versions : kPaddingVersions ) { SCOPED_TRACE ( versions . max_version ) ; SCOPED_TRACE ( versions . session_version ) ; size_t base_len = GetClientHelloLen ( versions . max_version , versions . session_version , 1 ) ; ASSERT_NE ( base_len , 0u ) << " " ; for ( const PaddingTest & test : kPaddingTests ) { SCOPED_TRACE ( test . input_len ) ; ASSERT_LE ( base_len , test . input_len ) << " " ; size_t padded_len = GetClientHelloLen ( versions . max_version , versions . session_version , 1 + test . input_len - base_len ) ; EXPECT_EQ ( padded_len , test . padded_len ) << " " ; } } }
OQS note: This test expects a "baseline" TLS 1.3 session
client hello to be <= 0xfe bytes, a number obtained with
the assumption that kDefaultGroups[] in t1_lib.cc has 3
entries.
OQS note : This test expects a " baseline " TLS 1 . 3 session client hello to be < = 0xfe bytes a number obtained with the assumption that kDefaultGroups [] in t1_lib . cc has 3 entries .
// Test the padding extension at TLS 1.2. // Test the padding extension at TLS 1.3 with a TLS 1.2 session, so there // will be no PSK binder after the padding extension. // Test the padding extension at TLS 1.3 with a TLS 1.3 session, so there // will be a PSK binder after the padding extension. // ClientHellos of length below 0x100 do not require padding. // ClientHellos of length 0x100 through 0x1fb are padded up to 0x200. // ClientHellos of length 0x1fc through 0x1ff get padded beyond 0x200. The // padding extension takes a minimum of four bytes plus one required // content // byte. (To work around yet more server bugs, we avoid empty final // extensions.) // Finally, larger ClientHellos need no padding. // Sample a baseline length.