pkcs11-tool: check for buffer overflows

Check the subject, issuer and serialNumber will encode in the allocated
space before copying the data.

Thanks to Umberto Rustichelli for the bug report
https://sourceforge.net/p/opensc/mailman/message/32210626/
Fix memory leak, sc_pkcs15_cert_t *cert is never freed
Mention that create_slots_for_pins can be used to get opensc-onepin behavior.
Remove the bogus javacard "driver".

I had some ideas on how to improve the experience for JavaCards
but that path did not get implemented further and my approach now
is very different.

While it would be nice if OpenSC (command line) detected
somehow blank JavaCard-s and informed the user that steps a-b-c
should be taken to make use of it, it doesn't really fit in.
Set missing default create_slots_flags.

Without this pkcs11 cant be used without a configuration file
or a configfile without pkcs11 block due to the missing initialization
of default flag.
Call dlclose() only when having a valid handle.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
fixed PUK handling

Note that
`SC_PKCS15_PIN_AUTH_TYPE_PIN` is used for `sc_pkcs15_auth_info_t.auth_type`
`SC_PKCS15_TYPE_AUTH_PIN`     is used for `sc_pkcs15_object_t.type`
When setting pointers to a template, ensure they do not get out of scope prior of being used.

This was causing issues when using pkcs11-tool with opencryptoki:
https://bugzilla.redhat.com/show_bug.cgi?id=1062307

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
EstEID: match card only based on presence of application.

Contact cards have ATR-s, contactless not. Only contact
cards should be broken so that they answer 0x9000 to application
selection, so this should be failsafe.
libopensc: export 'iasecc_sdo_encode_update_field'

used by 'local SMM' module
fixed compiler warnings (partially submitted)

Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>

PR-222: commit https://github.com/frankmorgner/OpenSC/commit/0b567dbaa83741675497a76d867645675f57262c
partially submitted by Viktor Tarasov
fixed incompatible function usage

Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>
westcos: fixed initialization of driver data

Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>

Updated by Viktor Tarasov
dnie: dont ignore error on sm free operation

Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>
cardos,incrypto34: restored semantics of select_pin_reference
fixed one more warning
build: return to standard use of 'autoconf'

Following http://sourceforge.net/p/opensc/mailman/message/32009859/

* 'configure.ac' is not mored created by bootstrap script, but present in source
* 'version.m4' is introduced and contains the 'volatile' package settings:
   settings that can be changed for the needs of particular build (ex. change PACKAGE_SUFFIX using the Git 'describe' or 'commit' data)
* 'bootstrap' script facilitate change of the package setting during the 'autoconf' phase
build: bootstrap script has expected content

added CI specific 'bootstrap' script version: with parameters it creates the 'm4.version.ci' -- CI specific 'm4.version'
build: uninstall-hook for opensc.conf
build: by default enable SM support