shpedoikal/opencryptoki — pull request #5 by shpedoikal (2011-11-03 16:43:16+00:00)
Title: Internal crypto routines v3

Updates for v3:
- Fixed missing newlines at end of log messages
- Fixed double close of tfm file descriptor
- Fixed strncpy lengths

This update changes the callers of opencryptoki's internal md5/sha1
routines to use the linux kernel's user-space crypto API. To test, this
requires a recent kernel -- this is tested against 3.1.0-rc9+. Given
that this is a linux-specific feature, we'll likely want to push this
into the next major release instead of a minor release.

There are two paths to opencryptoki's internal md5/sha1 routines, one is
through compute_sha/compute_md5 in usr/lib/pkcs11/common/utility.c,
which is called by opencryptoki internally to do things like integrity
checks on the token data objects. The other is through mech_md5.c and
mech_sha1.c in usr/lib/pkcs11/common, which provides the interfaces
called by the application.

This patch only replaces the calls made from utility.c for the internal
crypto routines. Follow on patches will need to replace the application
facing interfaces so that the internal routines can be completely
removed. At that point opencryptoki can be completely independent of any
user-space crypto library.

Signed-off-by: Kent Yoder