Factor out repeated code into function

There was a lot of repeated code and an obstruction to factoring this
out into a function was that the move constructors for hwtrust::Csr and
hwtrust::DiceChain were not functional.

Test: atest libkeymint_remote_prov_support_test
Change-Id: I23fbdf00ab4edfa9d34308201edf2a81451b265e
1 file changed