Fix memory leaks

I used valgrind on the test programs to find the memory leaks. First we needed some cleanup in the tests, then there were issues on how the SymmetricKey was used.

Just have one tricky issue left for OpenSSL that I was not able to solve. Reporting that back to SOFTHSM-59.