Code Monkey home page Code Monkey logo

pkcs11-logger's Issues

Check if attribute value can be read

PKCS#11 v2.20 states on page 133:

If the specified attribute (i.e., the attribute specified by the type field) for the object cannot be revealed because the object is sensitive or unextractable, then the ulValueLen field in that triple is modified to hold the value -1 (i.e., when it is cast to a CK_LONG, it holds -1).

PKCS11-LOGGER does not seem to be checking for this case and as a result might crash when trying to allocate huge buffer:

0x0000053c : 0x00003b0c :    Attribute: 17 (CKA_VALUE)
0x0000053c : 0x00003b0c :    pValue: 000001CE9C210A60
0x0000053c : 0x00003b0c :    ulValueLen: 4294967295
*** crash ***

Build on macOS now fails since 32-bits support has been removed by Apple

On macOS Mojave 10.14 , if I follow the build instructions I get:

$ cd build/osx
$ sh build.sh 
rm -f *.o
rm -f *.dylib
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/init.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/lock.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/log.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/pkcs11-logger.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/translate.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/utils.c
gcc -m32 -dynamiclib -o pkcs11-logger-x86.dylib \
	-Wl,-exported_symbols_list,pkcs11-logger.symbols \
	init.o lock.o log.o pkcs11-logger.o translate.o utils.o \
	-lc -ldl -lpthread
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libdl.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libdl.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libpthread.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libpthread.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libc.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libc.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture i386:
  "___bzero", referenced from:
      _pkcs11_logger_log_nonzero_string in log.o
      _pkcs11_logger_translate_ck_byte_ptr in translate.o
      _pkcs11_logger_utils_get_current_time_str in utils.o
  "___cxa_atexit", referenced from:
      ___GLOBAL_init_65535 in init.o
[...]

Slower process

HI Jariq

Thank you so much for apps you share, but I have one question. Why does PKCS admin if Load library using pkcs logger is faster then not using it ? ex : new Pkcs11Library(pkcs11Library, pkcs11Logger); it take 90ms and if I only use new Pkcs11Library(pkcs11Library); it's takes time 4000ms. please advise

looks like a break is missing in translate.c

Hi,

for me a added "break;" fix this build problem and imho fix a possible wrong return value.

./build.sh
rm -f *.o
rm -f *.so
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/init.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/lock.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/log.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/pkcs11-logger.c
gcc -m32 -Wall -Wextra -Werror -O2 -I../../src -fPIC -c ../../src/translate.c
../../src/translate.c: In function ‘pkcs11_logger_translate_ck_rv’:
../../src/translate.c:295:21: error: this statement may fall through [-Werror=implicit-fallthrough=]
rv_name = "CKR_VENDOR_DEFINED";
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../../src/translate.c:296:9: note: here
default:
^~~~~~~
cc1: all warnings being treated as errors
Makefile.x86:32: recipe for target 'translate.o' failed
make: *** [translate.o] Error 1

Cannot parses environment variables

Hi,
I tried set some environment variables like this:

set PKCS11_LOGGER_LIBRARY_PATH=C:\Windows\SysWOW64\my_pkcs11.dll
set PKCS11_LOGGER_LOG_FILE_PATH=D:\log.txt
set PKCS11_LOGGER_FLAGS=0x40

But the logger functions return CKR_GENERAL_ERROR. I am using VS 2015 and Windows 10. Thanks.

Unable to compile in Centos 6.5 64bit

When running the build.sh, the following error occurs
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [all] Error 1
Did I forget to install any dependent libraries?

Environment variable PKCS11_LOGGER_LIBRARY_PATH is not defined

I know there was a similar ticket from a windows user, but I see no solution for the problem that I could use.

Used OS: CentOS 8

I have added the exports for PKCS11_LOGGER_LIBRARY_PATH and the rest to the .bashrc and when I
run "env | grep PKCS11" the output is as follows:
PKCS11_LOGGER_LOG_FILE_PATH=/home/ejbca/pkcs11_debug.log
PKCS11_LOGGER_LIBRARY_PATH=/usr/lib64/pkcs11/yubihsm_pkcs11.so
PKCS11_LOGGER_FLAGS=16

I have double checked that the yubihsm-library does exist. Is there something obvious I didn't see?

Regard,
Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.