Switch from getSpi to getCurrentSpi.

Crypto primitives' getSpi has a side-effect which modifies the state
of the primitive: it selects an SPI implementation if it hasn't been
selected yet (e.g., Cipher.getInstance("AES") doesn't select an SPI
implementation until Cipher.init). The new method getCurrentSpi has
no side-effects: it simply returns null if no SPI implementation is
selected. The switch to getCurrentSpi lets us avoid side-effects and
throw a more pertinent exception when no SPI is yet selected.

(cherry-picked from bdc1382ac575a06c98cab69117700e081c90c595)

Bug: 18088752
Change-Id: Ib369c7e988329315075aa4e18f720d86f3d96a93
1 file changed