Replace index() with strchr()

Bionic (Android) has dropped support for index(), as has POSIX.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
examples: Don't pass uninitialized variables into the library

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
library: Fix handling of empty PIN strings

Commit bcb9124d4 (library: Allow overriding cached PIN) modified the
library behavior such that for any token that required a PIN, a PIN
passed into stoken_compute_tokencode() would override any PIN that was
read from .stokenrc or cached in the library context.  However, some
callers may have passed in an empty string if the PIN was cached.
Currently this may return -EINVAL; change it so it is handled the same
as passing in NULL.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
library: Add note on calling stoken_get_info() post-decryption

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
common: Initialize tomcrypt RSA/SHA1/PKCS#1 support on startup

These are global libtomcrypt settings so they shouldn't be done from
the library (sdtid.c).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
sdtid: Generate valid TKNTrailer sections

The BatchSignature uses v1.5 PKCS#1 signatures, SHA1+RSA, no salt
(RFC 3447).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>