The e=3 and e=65537 implementations are nearly identical, refactor them down into one. (cherry picked from commit 8fdbf97652) Change-Id: I9f858204d52a0ae880170d955bf8f29fed57ee94
8fdbf97652