Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure service indicator is incremented only once, update RSA and ED2…
…5519 to ensure the state is locked (#2112) ### Issues: Resolves P186477736 ### Description of changes: Currently the service indicator checks that `before != after` and multiple approved APIs might call each other. If a lock is missed a lower approved algorithm will increment the count which incorrectly marks the higher level API as approved. This is happening in three spots: 1. Approved API's self tests run and increment the service indicator on first use 2. In Ed25519 sign/verify the calls to SHA were incrementing the indicator 3. In the Ec25519 and RSA keygen the PCT sign/verify was incrementing the count This change updates the service indicator to enforce `before + 1 == after` with a debug assert. ### Call-outs This doesn't change the external behavior of the service indicator, what algorithms are approved, or what APIs are approved. The service indicator tests are unchanged. This change just ensures what we expect to be modifying the indicator is in the thing doing the update. ### Testing: The existing service indicator tests cover all approved APIs, and the new requirement that `before + 1 = after` ensures only one thing per call increments the count. I took out a lock and verified it failed as expected: ``` [ RUN ] ServiceIndicatorTest.ED25519KeyGen Assertion failed: (before + 1 == after), function TestBody, file service_indicator_test.cc, line 5184. OPENSSL_armcap=0x3D crypto/crypto_test [shard 8/10] crypto/crypto_test failed to complete: signal: abort trap ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
- Loading branch information