Merge pull request #196 from dengert/master

EC parameters not copied correctly
sc-hsm: Fixed memory checking and removed warning
sc-hsm: Removed compiler warning
pkcs15: Changed encoding for EC public keys in PuKDF to SPKI rather than ECPoint, preserving domain parameter
Check for NULL before dereferencing.

Reported by STACK

http://css.csail.mit.edu/stack/

Change-Id: Id7959c8217f46313ecf35a271efaf5f703fde2dc
pkcs11: Fixed typo
sc_pkcs15_encode_pubkey_as_spki replaces sc_pkcs15_encode_pubkey_with_param.
The name implies what the format of the returned value, a SPKI.

The support for spki as a pkcs15 format of a pubkey, is extended to
work for any algorithm not just EC pubkeys. PKCS#15 appears to allow this.

sc_pkcs15_decode_pubkey_with_param will look for a SPKI
and attempt to use it for any algorithm, including RSA.
(RSA is the null case, as there are no algorithm parameters.)

sc_pkcs15_encode_pubkey_as_spki is exported from libopensc.

pkcs15-piv.c will use sc_pkcs15_encode_pubkey_as_spki to load public keys
as SPKI for RSA and EC.

The pubkey->data is never a SPKI, it is the DER encoding of the
pubkey without the parameters.  If an spki is needed, use the
sc_pkcs15_encode_pubkey_as_spki to get the DER encoding of the spki.

As in the previous set of patches, pkcs15-tool.c will output both
sc_pkcs15_decode_pubkey_with_param and its internal.
This was left for testing, and the pubkey_pem_encode should be deleted
Merge pull request #197 from CardContact/master

Changing EC Public Key format in PuKDF from raw to spki
macosx: silence the deprecation warnings about OpenSSL
macosx: update package building to modern tools

PackageMaker has been deprecated since Xcode 4.6.
pkgbuild and productbuild have been available since 10.6.6
macosx: fix typo in distribution descriptor
pkcs15init: keep certificate's blob in cert. info data

always do it, not only when creating a new 'direct' certificate
pkcs15init: reselect file to delete
pkcs15init: externalize and change name of select_intrinsic_id()
build: suppress warning 'unused-parameter'
pkcs15: in 'pkcs15_object' data: new attr. 'md_flags'

also change name of 'guid' attribute for 'md_guid'
These attributes are used to parse and generate the minidriver CMAP records
pkcs15: remove unused macros "SC_PKCS15_KEY_USAGE_*"
pkcs15: introduce 'cmap-record' data into the private key info

existing  'guid' obejct's data replaced by the one in private-key info
New CMAP record data used by pkcs15init emulator for the cards that have
the MD specific on-card data
md: use if available the GUID from the prkey info ...

the proprietary on-card data can contain the GUIDs created by proprietary MW,
these data are parsed by card driver and put into the internal pkcs15 private key data
to be accesible in the different OpenSC frameworks
pkcs15: include MD data into sc_pkcs15 data type

New data are used to support the card specific minidriver on-card files.
Beeing included into internal pkcs15 data type,
these new data are accessible at the all frameworks: emulation of pkcs15 and pkcs15init, minidriver.