Skip to content

Commit

Permalink
Merge branch 'master' of github.com:larskanis/pkcs11
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Dec 11, 2010
2 parents 7d63fbb + a227f40 commit 808cba3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .yardopts
@@ -1 +1,2 @@
--no-private --charset utf-8 lib/**/*.rb ext/*.c ext/*.doc
--no-private lib/**/*.rb ext/*.c ext/*.doc

4 changes: 3 additions & 1 deletion Rakefile
Expand Up @@ -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)".'
Expand Down
2 changes: 1 addition & 1 deletion ext/generate_structs.rb
Expand Up @@ -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<String>] Attributes of this struct\ndef members; end"

# try to find attributes belonging together
Expand Down
14 changes: 14 additions & 0 deletions ext/pk11.c
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 808cba3

Please sign in to comment.