CGO: Benchmark encryption operations
We should make sure we're not leaving obvious performance on the ground for our CGO work, by having some benchmarks and doing a bit of optimization.
This is part of #1936 (closed), and a follow-up to #1943 (closed).