krypt-provider-openssl 0.0.1 → 0.0.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a49d108af14bfc93b37ddfd78f793d818e0e4fc
4
+ data.tar.gz: 47c086c1bec091c894b284b03722df3ce70779d4
5
+ SHA512:
6
+ metadata.gz: ec45052585088c6cdbccf9f667ebe70e7de9f87fafb8fead511d5b2294a4d6395d0d859d1d40e0ff3f57dc021cfe5d67095c4c609274d6397fe19e815c081b3a
7
+ data.tar.gz: 4cd0973daa001f597b511e625748841c228bf7554d041022cebc152003934c244be9764ddae4103daf813c5bcb338e9a82ed79a38d6ebfb5e897fbf127b7a990
@@ -49,9 +49,12 @@ extern "C" {
49
49
  #include <openssl/ssl.h>
50
50
 
51
51
  extern krypt_provider krypt_provider_ossl;
52
+ krypt_provider *krypt_ossl_provider_get(void);
52
53
 
53
- krypt_md * krypt_ossl_md_new_oid(krypt_provider *provider, const char *oid);
54
- krypt_md * krypt_ossl_md_new_name(krypt_provider *provider, const char *name);
54
+ void krypt_ossl_init(krypt_provider *provider, void *args);
55
+ void krypt_ossl_finalize(krypt_provider *provider);
56
+ krypt_md *krypt_ossl_md_new_oid(krypt_provider *provider, const char *oid);
57
+ krypt_md *krypt_ossl_md_new_name(krypt_provider *provider, const char *name);
55
58
 
56
59
  #if defined(__cplusplus)
57
60
  }
@@ -72,15 +72,11 @@ struct krypt_interface_md_st {
72
72
  /* Provider */
73
73
  struct krypt_provider_st {
74
74
  const char *name;
75
+ void (*init)(krypt_provider *provider, void *args);
76
+ void (*finalize)(krypt_provider *provider);
75
77
  krypt_md *(*md_new_oid)(krypt_provider *provider, const char *oid);
76
78
  krypt_md *(*md_new_name)(krypt_provider *provider, const char *name);
77
79
  };
78
80
 
79
- /* Can be called from within a provider implementation to indicate errors */
80
- extern void krypt_error_add(const char * format, ...);
81
-
82
- /* May be used to register a singleton provider upon initialization */
83
- extern void krypt_provider_register(krypt_provider *provider);
84
-
85
81
  #endif /* _KRYPT_PROVIDER_H_ */
86
82
 
@@ -31,17 +31,35 @@
31
31
 
32
32
  krypt_provider krypt_provider_ossl = {
33
33
  "openssl",
34
+ krypt_ossl_init,
35
+ krypt_ossl_finalize,
34
36
  krypt_ossl_md_new_oid,
35
37
  krypt_ossl_md_new_name
36
38
  };
37
39
 
40
+ krypt_provider *
41
+ krypt_ossl_get_provider(void) {
42
+ return &krypt_provider_ossl;
43
+ }
44
+
38
45
  void
39
- Init_kryptprovideropenssl(void)
46
+ krypt_ossl_init(krypt_provider *provider, void *args)
40
47
  {
41
48
  OpenSSL_add_ssl_algorithms();
42
49
  OpenSSL_add_all_algorithms();
43
50
  ERR_load_crypto_strings();
44
51
  SSL_load_error_strings();
52
+ }
53
+
54
+ void
55
+ krypt_ossl_finalize(krypt_provider *provider)
56
+ {
57
+ /* do nothing */
58
+ }
45
59
 
46
- krypt_provider_register(&krypt_provider_ossl);
60
+ void
61
+ Init_kryptprovideropenssl(void)
62
+ {
63
+ /* do nothing */
47
64
  }
65
+
@@ -30,5 +30,32 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
30
 
31
31
  =end
32
32
 
33
- require 'kryptprovideropenssl.so'
33
+ require 'ffi'
34
+
35
+ module Krypt
36
+ module Provider
37
+
38
+ class OpenSSL < Krypt::FFI::Provider
39
+
40
+ def initialize
41
+ super(Handle.krypt_ossl_get_provider)
42
+ end
43
+
44
+ module Handle
45
+ extend ::FFI::Library
46
+
47
+ # We cannot require the C extension in JRuby by default
48
+ if RUBY_PLATFORM =~ /java/
49
+ ffi_lib File.expand_path('../../kryptprovideropenssl.so', File.dirname(__FILE__))
50
+ else
51
+ require'kryptprovideropenssl.so'
52
+ ffi_lib ::FFI::CURRENT_PROCESS
53
+ end
54
+
55
+ attach_function :krypt_ossl_get_provider, [], :pointer
56
+ end
57
+ end
58
+
59
+ end
60
+ end
34
61
 
metadata CHANGED
@@ -1,16 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krypt-provider-openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2.rc1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Hiroshi Nakamura, Martin Bosslet
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
14
27
  description: Implementation of the krypt-provider API using OpenSSL
15
28
  email: Martin.Bosslet@gmail.com
16
29
  executables: []
@@ -19,36 +32,34 @@ extensions:
19
32
  extra_rdoc_files: []
20
33
  files:
21
34
  - LICENSE
22
- - ext/krypt/provider/openssl/krypt_ossl_digest.c
23
35
  - ext/krypt/provider/openssl/extconf.rb
24
- - ext/krypt/provider/openssl/krypt_provider_ossl.c
25
36
  - ext/krypt/provider/openssl/krypt-provider-ossl.h
26
37
  - ext/krypt/provider/openssl/krypt-provider.h
27
- - lib/kryptprovideropenssl.so
28
- - lib/krypt-provider-openssl.rb
38
+ - ext/krypt/provider/openssl/krypt_ossl_digest.c
39
+ - ext/krypt/provider/openssl/krypt_provider_ossl.c
40
+ - lib/krypt/provider/openssl.rb
29
41
  homepage: https://github.com/krypt/krypt-provider-openssl
30
42
  licenses:
31
43
  - MIT
44
+ metadata: {}
32
45
  post_install_message:
33
46
  rdoc_options: []
34
47
  require_paths:
35
48
  - lib
36
49
  required_ruby_version: !ruby/object:Gem::Requirement
37
- none: false
38
50
  requirements:
39
- - - ! '>='
51
+ - - ">="
40
52
  - !ruby/object:Gem::Version
41
53
  version: 1.9.3
42
54
  required_rubygems_version: !ruby/object:Gem::Requirement
43
- none: false
44
55
  requirements:
45
- - - ! '>='
56
+ - - ">"
46
57
  - !ruby/object:Gem::Version
47
- version: '0'
58
+ version: 1.3.1
48
59
  requirements: []
49
60
  rubyforge_project:
50
- rubygems_version: 1.8.23
61
+ rubygems_version: 2.2.0
51
62
  signing_key:
52
- specification_version: 3
63
+ specification_version: 4
53
64
  summary: Default provider for C(++)-based Rubies
54
65
  test_files: []
Binary file