Transform calculation to memory
There's a line of research that studies how to store sensitive data in the CPU's registers instead of RAM.  Here's a seminal paper:


TRESOR Runs Encryption Securely Outside RAM.  Tilo Müller, Felix C. Freiling, Andreas Dewald.  Usenix Security 2011.


There's also work in storing sensitive data in the cache.  Here are two of the seminal papers:


CARMA: A hardware tamper-resistant isolated execution environment on commodity x86 platforms.  Amit Vasudevan, Jonathan McCune, James Newsome, Adrian Perrig, Leendert van Doorn.  ASIACCS 2012.
Copker: Computing with Private Keys without RAM.  Le Guan, Jingqiang Lin, Bo Luo, Jiwu Jing.  NDSS 2014.


There's lots more work on these subjects, but this will get you started.  You can find follow-up papers in the standard ways (Google Scholar, etc.).

You might also be interested in Intel SGX, TrustZone, TPMs, or related schemes for hardware support for secure computation.