Skip to content

tests: fix negative private key sync test.#8264

Merged
lizan merged 3 commits intoenvoyproxy:masterfrom
ipuustin:fix-crypto-error-in-tests
Sep 18, 2019
Merged

tests: fix negative private key sync test.#8264
lizan merged 3 commits intoenvoyproxy:masterfrom
ipuustin:fix-crypto-error-in-tests

Conversation

@ipuustin
Copy link
Copy Markdown
Member

Description:

Fix a test flake.

If crypto error option is set in the signing test, just leave the digest to zeroes instead of trying to modify it. The digest modification might just cause ASN object structure changes.

BoringSSL source appears to have a similar test where the ASN structure is parsed before modification:
https://github.com/google/boringssl/blob/a7d9ac2af4684747c4524cbeba9737b04dce3e3e/crypto/fipsmodule/ecdsa/ecdsa_test.cc#L143

Risk Level: low
Testing: bazel test //test/extensions/transport_sockets/tls:ssl_socket_test --runs_per_test=1000
Docs Changes: N/A
Release Notes: N/A
Fixes: #8255

If crypto error is set, just leave the hash to zeroes instead of trying
to modify the hash. Hash modification might just cause ASN object
structure changes.

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
@ipuustin ipuustin requested a review from lizan as a code owner September 17, 2019 07:48
Turns out having a zero hash array causes the signing to fail, leading
to testing a different case than intended.

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
// the bits.
if (ops->test_options_.crypto_error_) {
for (size_t i = 0; i < in_len; i++) {
in2.data()[i] ^= in2.data()[i];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need .data() (in2[i] should just work), and this is just clearing in2 to zero? x^x is always 0...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, XOR was supposed to be NOT -- I was trying to flip the bits in the token but managed to think it wrong. :-) I'll make a fix.

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
@lizan lizan merged commit 069f50c into envoyproxy:master Sep 18, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Sep 24, 2019
Description:

Fix a test flake.

If crypto error option is set in the signing test, just leave the digest to zeroes instead of trying to modify it. The digest modification might just cause ASN object structure changes.

BoringSSL source appears to have a similar test where the ASN structure is parsed before modification:
https://github.com/google/boringssl/blob/a7d9ac2af4684747c4524cbeba9737b04dce3e3e/crypto/fipsmodule/ecdsa/ecdsa_test.cc#L143

Risk Level: low
Testing: `bazel test //test/extensions/transport_sockets/tls:ssl_socket_test --runs_per_test=1000`
Docs Changes: N/A
Release Notes: N/A
Fixes: envoyproxy#8255 

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
Description:

Fix a test flake.

If crypto error option is set in the signing test, just leave the digest to zeroes instead of trying to modify it. The digest modification might just cause ASN object structure changes.

BoringSSL source appears to have a similar test where the ASN structure is parsed before modification:
https://github.com/google/boringssl/blob/a7d9ac2af4684747c4524cbeba9737b04dce3e3e/crypto/fipsmodule/ecdsa/ecdsa_test.cc#L143

Risk Level: low
Testing: `bazel test //test/extensions/transport_sockets/tls:ssl_socket_test --runs_per_test=1000`
Docs Changes: N/A
Release Notes: N/A
Fixes: envoyproxy#8255 

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
Description:

Fix a test flake.

If crypto error option is set in the signing test, just leave the digest to zeroes instead of trying to modify it. The digest modification might just cause ASN object structure changes.

BoringSSL source appears to have a similar test where the ASN structure is parsed before modification:
https://github.com/google/boringssl/blob/a7d9ac2af4684747c4524cbeba9737b04dce3e3e/crypto/fipsmodule/ecdsa/ecdsa_test.cc#L143

Risk Level: low
Testing: `bazel test //test/extensions/transport_sockets/tls:ssl_socket_test --runs_per_test=1000`
Docs Changes: N/A
Release Notes: N/A
Fixes: envoyproxy#8255 

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
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.

SslSocketTest.RsaPrivateKeyProviderSyncSignFailure flaky

2 participants