tools: Add util_get_pin helper function

Using this helper PINs can be passed via the command line, stdin and
an environment variable.
For now only used in the openpgp tool.
Quoting from the getenv man page:

As typically implemented, getenv() returns a pointer to a string within the environment list.  The caller must take care  not  to  modify string, since that would change the environment of the process.

This also means that you should not free the string. However, util_get_pin should return a "freeable buffer". simply use strdup.