From be740f64cbaab72fd541fa680f43cb0f78b31ee9 Mon Sep 17 00:00:00 2001 From: Isabel Kanis Date: Sat, 6 Nov 2010 20:53:44 +0100 Subject: [PATCH 1/4] add development dependency gems --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index a943354..5d4d824 100644 --- a/Rakefile +++ b/Rakefile @@ -17,7 +17,9 @@ hoe = Hoe.spec 'pkcs11' do developer('Ryosuke Kutsuna', 'ryosuke@deer-n-horse.jp') developer('GOTOU Yuuzou', 'gotoyuzo@notwork.org') developer('Lars Kanis', 'kanis@comcard.de') - + extra_dev_deps << ['yard', '>= 0.6'] + extra_dev_deps << ['rake-compiler', '>= 0.7'] + self.url = 'http://github.com/larskanis/pkcs11' self.summary = 'PKCS#11 binding for Ruby' self.description = 'This module allows Ruby programs to interface with "RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)".' From 4fa3a3cfad1c5a47785ab744b16a62949a442a37 Mon Sep 17 00:00:00 2001 From: Isabel Kanis Date: Sat, 6 Nov 2010 20:58:08 +0100 Subject: [PATCH 2/4] remove yard charset option, this breaked yard on ruby 1.8 --- .yardopts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.yardopts b/.yardopts index 6ccf100..b5cfccd 100644 --- a/.yardopts +++ b/.yardopts @@ -1 +1,2 @@ ---no-private --charset utf-8 lib/**/*.rb ext/*.c ext/*.doc \ No newline at end of file +--no-private lib/**/*.rb ext/*.c ext/*.doc + From cd997ae63f77f22fea9e20a0fa474b77faf42b0f Mon Sep 17 00:00:00 2001 From: Isabel Kanis Date: Sat, 6 Nov 2010 21:57:25 +0100 Subject: [PATCH 3/4] add documentation for CK_MECHANISM --- ext/pk11.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ext/pk11.c b/ext/pk11.c index 5925d93..084c05e 100644 --- a/ext/pk11.c +++ b/ext/pk11.c @@ -1756,6 +1756,11 @@ static VALUE c##s##_set_##f(VALUE o, VALUE v){ \ PKCS11_IMPLEMENT_ALLOCATOR(CK_MECHANISM) +/* + * Spezifies a particularly crypto mechanism. + * @param [Integer, nil] mechanism The mechanism to use (PKCS11::CKM_*) + * @param [String, Integer, PKCS11::CStruct, nil] pParameter optional parameter to the mechanism + */ static VALUE cCK_MECHANISM_initialize(int argc, VALUE *argv, VALUE self) { @@ -1768,8 +1773,13 @@ cCK_MECHANISM_initialize(int argc, VALUE *argv, VALUE self) return self; } +/* rb_define_method(cCK_MECHANISM, "mechanism", cCK_MECHANISM_get_mechanism, 0); */ +/* rb_define_method(cCK_MECHANISM, "mechanism=", cCK_MECHANISM_set_mechanism, 0); */ PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_MECHANISM, mechanism); +/* rb_define_method(cCK_MECHANISM, "pParameter", cCK_MECHANISM_get_pParameter, 0); */ +/* rb_define_method(cCK_MECHANISM, "pParameter=", cCK_MECHANISM_set_pParameter, 0); */ +/* @see PKCS11::CK_MECHANISM#initialize */ static VALUE cCK_MECHANISM_get_pParameter(VALUE self) { @@ -1942,6 +1952,10 @@ Init_pkcs11_ext() rb_define_method(cCK_ATTRIBUTE, "type", ck_attr_type, 0); rb_define_method(cCK_ATTRIBUTE, "value", ck_attr_value, 0); + /* Document-class: PKCS11::CK_MECHANISM + * + * Describes a crypto mechanism CKM_* with optional parameters. */ + /* cCK_MECHANISM = rb_define_class_under(mPKCS11, "CK_MECHANISM", rb_cObject); */ PKCS11_DEFINE_STRUCT(CK_MECHANISM); rb_define_method(cCK_MECHANISM, "initialize", cCK_MECHANISM_initialize, -1); PKCS11_DEFINE_MEMBER(CK_MECHANISM, mechanism); From a227f40fae72bacbca614f9c1d7e8934b3569257 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sat, 6 Nov 2010 23:21:07 +0100 Subject: [PATCH 4/4] clarified comment to CStruct#to_s --- ext/generate_structs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/generate_structs.rb b/ext/generate_structs.rb index 8b30519..3317ea9 100644 --- a/ext/generate_structs.rb +++ b/ext/generate_structs.rb @@ -50,7 +50,7 @@ fd_def.puts "PKCS11_DEFINE_STRUCT(#{struct_name});" fd_doc.puts"class PKCS11::#{struct_name} < PKCS11::CStruct" fd_doc.puts"# Size of corresponding C struct in bytes\nSIZEOF_STRUCT=Integer" - fd_doc.puts"# @return [String] Binary content of the C struct\ndef to_s; end" + fd_doc.puts"# @return [String] Binary copy of the C struct\ndef to_s; end" fd_doc.puts"# @return [Array] Attributes of this struct\ndef members; end" # try to find attributes belonging together