It would be difficult to get any more performance out of the CSPRNG layer now: github.com/AndroidHardeni.
ChaCha8 implementation could be much faster which might help. It's just the scalar reference implementation converted into a pure keystream API by removing XOR of the message.
Conversation
The overhead tied to random number generation is acceptable right now but it's going to get higher when a few more features are using it. It needs to be insanely fast for those features to be worth having. There's a limited performance budget with many features to spend it on.
Replying to
maybe switch from chacha to AES on platforms that have hardware acceleration? (which are probably all of the ones that matter)
1
Replying to
AES-CTR via AES-NI on x86 or the ARMv8-A instructions would be a good approach. No need for a fallback implementation which makes it a much simpler problem. Going to try using a basic existing implementation to see how much it helps and then it can be further optimized later on.
1
1
Show replies

