1
0
mirror of https://github.com/opencryptoki/opencryptoki.git synced 2026-10-28 18:37:25 +03:00
Commit Graph

63 Commits

Author SHA1 Message Date
Nathan Williams
eaf724913d Patch out the recursive chmod -R in pkcs_slot 2011-01-13 10:56:23 -02:00
Chris Masone
64a9232029 Make pkcsslotd grab the shared memory it needs, even if it wasnt freed by a previous instance 2011-01-13 10:53:59 -02:00
Norikatsu Shigemura
e238c83f49 Add support more signal informations
Hi Klaus.

	Add support more signal informations to pkcsslotd/err.c.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2011-01-04 16:52:41 -02:00
Norikatsu Shigemura
f22421a0ad dlopen(3) assumes relative path, but...
Hi Klaus.

	On openCryptoki, dlopen(3) assumes that resolve relative path
	by /etc/ld.so.conf.d/opencryptoki.conf.  However, on FreeBSD,
	even if 'ldconfig -m /usr/local/lib/opencryptoki/stdll' (same
	as /etc/ld.so.conf.d/opencryptoki.conf), dlopen(3) doesn't
	resolve relative path (path name required .so.1 suffix).  So
	libopencryptoki.so can't load STDLLs.

	I made a patch to fix this issue by absolute path instead of
	relative path.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2011-01-04 15:46:02 -02:00
Norikatsu Shigemura
331bfb666a reduce diff other OS
Hi Klaus.

	There are some linux/limits.h, but it isn't always used.  I think
	that should be used limits.h instead of linux/limits.h.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$ grep -r limits.h .
./usr/sbin/pkcsslotd/pkcsslotd.h:#include <linux/limits.h>
./usr/sbin/pkcsslotd/slotd_msg.h:#include <limits.h>
./usr/sbin/pkcsconf/pkcsconf_msg.h:#include <limits.h>
./usr/lib/pkcs11/common/linuxdef.h:  #include <limits.h>
./usr/lib/pkcs11/cca_stdll/cca_specific.c:#include <limits.h>
./usr/include/pkcs11/apictl.h:#include <linux/limits.h>
./usr/include/pkcs11/slotmgr.h:#include <linux/limits.h>
./usr/include/pkcs11/stdll.h:#include <linux/limits.h>
./configure.in:AC_CHECK_HEADERS([fcntl.h limits.h strings.h sys/file.h syslog.h unistd.h])
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	So reduce different from other OS like FreeBSD, I made a patch.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2011-01-04 15:35:53 -02:00
Kent Yoder
3af1ac7d67 pkcsconf: Allow backspace, disable echoing stars for PIN
This patch enables the use of backspace when entering PINs
  in the pkcsconf tool. It also disables any form of echoing
  (e.g., stars) when keys are pressed

  Tested on opensuse 11.3 only so far.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-10-06 09:31:01 -03:00
Klaus Heinrich Kiwi
915368c1d6 pkcsconf: Important fixes and changes
* Fix init_user_pin() and set_user_pin() always acting on
      first slot
    * Fix token initialization (and token info, slot info) by requiring
      a single slot to be specified in the command-line.
    * Only allow one slot specification in command-line arguments.
      Also do the same for SO PIN, user PIN and new PIN
    * Removed one warning from display_pkcs11_info(), plus
      re-indented affected functions.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-09-13 22:39:06 -03:00
Klaus Heinrich Kiwi
0667a2d197 Get rid of useless pkcsconf.msg file
pkcsconf.msg was being used to generate pkcsconf_msg.h, but that
    is not true anymore.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-09-13 22:39:06 -03:00
Klaus Heinrich Kiwi
8af4c963e0 Fix pkcs11_startup to look for correct cca lib
pkcs11_startup was still looking for an old library filename in
    order to determine if the CCA 4+ library is really installed or not.

    This was preventing the CCA token from being properly configured in
    opencryptoki 2.3 and later.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-09-10 15:46:21 -03:00
Kent Yoder
d123a2f480 pkcsconf updates
This patch makes 3 changes to pkcsconf:

1. removes the code inside #define SHM, which appears to be a relic from a bygone era, when apps started pkcsslotd themselves
2. changes the prototype of get_slot_list(), which can be simplified now that SHM is removed
3. always return a non-zero return code to the command line

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 usr/sbin/pkcsconf/pkcsconf.c |  183 +-----------------------------------------
 1 files changed, 4 insertions(+), 179 deletions(-)
2010-08-30 12:06:04 -03:00
Kent Yoder
d9e45b9f64 pkcsconf return errors to the command line
This patch allows pkcsconf to return a non-zero return code when a failure occurs.  This is helpful when pkcsconf is called from a script because its a simple way to test for success or failure.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 usr/sbin/pkcsconf/pkcsconf.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
2010-08-27 11:30:41 -03:00
Kent Yoder
e09f238f65 make pkcsconf respect -c when printing slot/token info
pkcsconf currently prints all token/slot info for every slot available. This happens even when providing -c <slot_id>. This patch makes pkcsconf print only 1 slot/token's info if -c is provided.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 usr/sbin/pkcsconf/pkcsconf.c |  187 +++++++++++++++++++++++++-----------------
 1 files changed, 113 insertions(+), 74 deletions(-)
2010-08-25 07:43:01 -03:00
Klaus Heinrich Kiwi
64f650435f Interpret error codes in pkcsconf using p11util funcs
Use p11_get_ckr() function from p11util.c to add human-readable
  codes to pkcsconf error messages.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-18 11:50:22 -03:00
Klaus Heinrich Kiwi
ceee7028f8 Move specific documentation to doc/
Documentation files were scattered across different places. Consolidate
them in doc/ to make packaging easier, while avoiding collisions.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-07-20 13:39:33 -03:00
Klaus Heinrich Kiwi
93ada245fd Create local state directories when installing
* Create the local state directory for opencryptoki (usually
  $prefix/var/lib/opencryptoki) when installing pkcs_slot.
  pkcs_slot can take care of creating it on the first execution,
  but creating it on 'make install' allow us to proper package
  it.

* The pkcs_slot script already creates those directories
  if not present, but explicitly creating them in 'make install'
  allows us to better packaging

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-07-20 13:38:59 -03:00
Kent Yoder
ad9d1c67fa Print readable mechanism info in pkcsconf -m output, round 2
This patch adds the text of the mechanism type and its flags to the output of pkcsconf -m.

Old:
Mechanism #2
        Mechanism: 0x131
        Key Size: 24-24
        Flags: 0x8001
Mechanism #3
        Mechanism: 0x1
        Key Size: 512-2048
        Flags: 0x67B01

New:
Mechanism #2
        Mechanism: 0x131 (CKM_DES3_KEY_GEN)
        Key Size: 24-24
        Flags: 0x8001 (CKF_HW|CKF_GENERATE)
Mechanism #3
        Mechanism: 0x1 (CKM_RSA_PKCS)
        Key Size: 512-2048
        Flags: 0x67B01 (CKF_HW|CKF_ENCRYPT|CKF_DECRYPT|CKF_SIGN|CKF_SIGN_RECOVER|CKF_VERIFY|CKF_VERIFY_RECOVER|CKF_WRAP|CKF_UNWRAP)

Addressed Klaus Kiwi's concerns on using the mechanism and flag values from pkcs11types.h.

This patch should apply cleanly to the opencryptoki-next branch.

signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-06-23 13:23:03 -03:00
Klaus Heinrich Kiwi
8444db63db Fix minor typo in pkcsconf output
Fix minor typo in pkcsconf ouput when no slots were found.
C_GetSlotCount is in reality C_GetSlotList

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-06-11 12:03:14 -03:00
Dan Horák
248606bef0 print usage information when no option is given
When no option is given pkcsconf does nothing and quits silently with a zero
return code. It should output the usage information and return non-zero code.

Signed-off-by: Dan Horák <dan@danny.cz>
2010-05-19 17:00:22 -03:00
Dan Horák
d0c56c2b21 add -h command line option
The recent code treats -h as unknown options and throws an error.

Signed-off-by: Dan Horák <dan@danny.cz>
2010-05-19 17:00:16 -03:00
Klaus Heinrich Kiwi
789d86ee16 Merge branch 'master' into opencryptoki-next
* master:
  Fixed the pkcsslotd init script to make it return codes according to LSB specification.
  Version update.
  Fix wrong log message for "API already initialized" condition
  Check for vendor-defined object classes
  Fix public exponent attribute endianness bug
  AES support included into the CCA token.
  Makes pkcscca_migrate tool link dynamically to libcsulcca.so by using dlopen() instead.

Conflicts:
	configure.in - took version number from master ("2.3.1")

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-05-04 10:51:38 -03:00
Rajiv Andrade
d335aa391e Makes pkcscca_migrate tool link dynamically to libcsulcca.so by using dlopen() instead.
Removed its TODO entry.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
2010-01-26 00:35:07 -02:00
Klaus Heinrich Kiwi
e1956cf493 configure.in: complete refactor.
Unfortunately I couldn't split this patch in a sane way, because
essentially we're rewriting configure.in here.

In summary, the main changes are:

 * Use AC_ARG_ENABLE() only to enable/disable building certain parts
   of the code
 * Use AC_ARG_WITH() only to specify libraries that may be needed by
   certain portions of the code
 * All AC_ARG_ENABLE() macros comes with architecture-independent
   defaults. This means that we won't be trying to guess what
   features (tokens) we should or should not be building.
 * All AC_ARG_WITH() macros have 'check' as the default (check for
   that library in the default search path)
 * IMPORTANT: Separate pkcscca_migrate from cca token build, as only
   the former requires the CCA libraries to link.
 * No more dependencies of what stdll can be built based on arch.
   Theoretically all stdll can be built on all archs, given that
   it has the relevant libraries also (we know this is not always
   true, so sometimes the user needs to explicitly disable a token
   with --without-FEATURE to build on certain archs)
 * The (special case of) ica stdll: builds ica_s390_stdll on s390
   archs while using ica_stdll on any other arch.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-01-12 16:09:31 -02:00
Klaus Heinrich Kiwi
6e2e807422 Process pkcs11_startup.in at build time instead of configure time
Like other patches in this series, this patch avoids doing pathname
resolution at configure time by using sed to process scripts at
build time.

Also fixed to use standard directories and utilities variables

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-01-12 15:57:06 -02:00
Klaus Heinrich Kiwi
ef7980e1fc Process pkcs_slot.in at build time instead of configure time
This patch moves the processing of usr/sbin/pkcs_slot/pkcs_slot.in
to use a sed script at build time instead of relying on configure
to process it at configure time.

Also use the right autoconf macros to try to identify where
(and what) utilities to use.

In addition, try to use standard directory variables.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-01-12 15:55:11 -02:00
Klaus Heinrich Kiwi
cf7d65f352 Add CCA Token to pkcs11_startup and pkcs_slot + minor cleanups
- add CCA Token support for both pkcs11_startup and pkcs_slot scripts
- pkcs11_startup cleanups:
  * Fix 4758_status command pathname
  * Use the same pathname for both checking and calling
    the 4758_status command.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2009-07-31 13:18:22 -03:00
phreakz
592822d196 Consider also the case in which the backspace key is mapped to delete character (ASCII code = 0x7f). 2008-12-18 17:40:58 +00:00
phreakz
3d4d6b4d10 Fixed bug in get_pin() loop when entering user pin, now the user can proceed entering the new user pin. 2008-12-17 13:30:50 +00:00
mhalcrow
ae12f47cfa The backspace code is buggy, per LTC bugzilla ticket 40960. Since the
characters are not echoed to the terminal, it is probably best to just
terminate the PIN attempt if the Backspace key is pressed and start
over in order to avoid potential human error.
2008-07-25 19:36:00 +00:00
mhalcrow
ca8ca46c21 This patch is as a result of feedback of an audit of opencryptoki,
performed in order to include opencryptoki into Ubuntu main, as a build
dependency for ecryptfs-utils.
 * https://bugs.launchpad.net/bugs/247593

In this patch, I attempted to find all hard coded values of 2048 that
pertained to paths.  I created #define'd a MAX_PATH value to 4096 and
changed all references I could find to that.

Note that this is entirely untested, though assuming it compiles, it
should be a rather simple (though comprehensive) set of changes.

Dustin Kirkland <kirkland@canonical.com>
2008-07-16 22:27:47 +00:00
kyoder
647576d3e8 fixed bugs in testing PIN input 2007-12-07 21:06:27 +00:00
kyoder
55636db5ab removed no-op lsmod command in detection of ica token 2007-11-08 22:06:17 +00:00
kyoder
aeabd6b00b fix for s390, which now uses the ica tok as a swtok 2007-09-26 22:40:26 +00:00
tlendacky
ed54582070 cca token support and some fixups 2007-09-06 15:40:08 +00:00
danielhjones
9049befbce Compiler warning cleanup. Fix end of line chars on text files. 2006-06-15 21:58:22 +00:00
danielhjones
25feaa2bc1 Changes made to enable 64bit daemon/tools on 64bit platforms. Some
structures padded due to alignment variations between x86_64 64bit
and 32 bit (i386) binaries.
Full path removed from pk_config_data file. Library paths added to
ld.so.conf.d files for library location.
2006-04-17 18:23:06 +00:00
kyoder
f789042d44 merge with cleanup branch 2006-04-05 20:07:40 +00:00
mhalcrow
b4c31d84e4 This memory in the proc_t struct needs to be allocated before it is used (BugZilla ticket #22308) 2006-03-09 17:21:01 +00:00
mhalcrow
1bcd37bbd1 Fix write to uninitialized memory (SF Request #1413862) 2006-01-24 17:18:25 +00:00
mhalcrow
d63b183451 Remove redundant build #define name 2005-12-12 23:35:04 +00:00
mhalcrow
2b63027634 Update the library version number to pull value from AC_INIT() macro version. 2005-12-12 21:33:22 +00:00
kyoder
eb554ce341 print out more informative slot info flags 2005-08-11 21:00:57 +00:00
kyoder
417fcb1959 print out more informative token info flags 2005-08-11 20:53:51 +00:00
mhalcrow
71566d1a5b Error message in the event that the map file exists. 2005-07-25 21:24:48 +00:00
kyoder
bfba3ad63d fixed hard coded path to pkcs11_startup 2005-06-03 16:07:39 +00:00
tlendacky
4235d84e64 init routine fix 2005-05-31 22:02:43 +00:00
mhalcrow
aea9ee5d15 More minor fixes to the build and install process 2005-05-12 14:57:45 +00:00
kyoder
e986264709 fchown and fchmod the mapfile on creation 2005-05-06 21:20:57 +00:00
tlendacky
994dd07b39 Remove hardcoded path 2005-05-06 21:00:49 +00:00
kyoder
fc42b38452 don't create tpmtok/TOK_OBJ.. the stdll will create tpmtok/username/TOK_OBJ automatically 2005-05-06 20:16:46 +00:00
mhalcrow
0c039a9cfa SPEC file updates to reflect new location 2005-05-06 20:01:34 +00:00