CPU optimizations.

Use get_shared_key() in more places.