openssl_rsa_pss_verify 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c4bb71d22cbc145e4979556197252e5a843fd8
4
- data.tar.gz: 7a64d7620ba2eefccfb4b112597aad5aec82876e
3
+ metadata.gz: cfb554544bf4570782eab25d1176881330016c4e
4
+ data.tar.gz: c01a12c25c075dc9c6605c11f7ce594e3b91b34e
5
5
  SHA512:
6
- metadata.gz: d509de63265a6db4882985b2c3d3e40ab68f6f880738b7d537ad8e4fe56cef357aea8bb9b3aaab9ae7c5efa43234039f75ef81c27fd268bae591d4bc16e88cbc
7
- data.tar.gz: d48eda8588b3bffe41e7e42217dbdb24de8c73e3818aa9558969b3dd8ce456828eaab9b877e0dc37158a50b93962822d9afbbc669130bcee5cf1785721011501
6
+ metadata.gz: 9efc75ce48e569a316c13a077b0510399162e46071b039ce3a9db0e3f1e1468332d0a6b0dfa91c3b2a0d7b3c133e39b5183e3f3fb2062a0ba3d3feb6afee758e
7
+ data.tar.gz: dfe8f49cc6f6688cf54392496bc601af61e5161f97d55bea294fafb02dd1349f729c682799acdebd3063e1d29e3c34df8cafe869eb41257d5e0a744b5bb3b698
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openssl_rsa_pss_verify (0.1.0)
4
+ openssl_rsa_pss_verify (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -30,6 +30,10 @@ static enum ORPV_errors {
30
30
  SET_SALTLEN,
31
31
  } err = OK;
32
32
 
33
+ #define BIND_ERR_STR(str_p) \
34
+ if (ERR_peek_error()) ERR_error_string(ERR_get_error(), (str_p));
35
+
36
+
33
37
  VALUE ORPV__verify_pss_sha1(VALUE self, VALUE vPubKey, VALUE vSig, VALUE vHashData, VALUE vSaltLen) {
34
38
  BIO * pkey_bio = NULL;
35
39
  RSA * rsa_pub_key = NULL;
@@ -38,7 +42,7 @@ VALUE ORPV__verify_pss_sha1(VALUE self, VALUE vPubKey, VALUE vSig, VALUE vHashDa
38
42
  char * pub_key = NULL;
39
43
 
40
44
  int verify_rval = -1, salt_len;
41
- unsigned long ossl_errcode;
45
+ char ossl_err_str[120] = "[no internal OpenSSL error was flagged]";
42
46
 
43
47
  vPubKey = StringValue(vPubKey);
44
48
  vSig = StringValue(vSig);
@@ -127,11 +131,8 @@ Cleanup:
127
131
  case 0:
128
132
  return Qfalse;
129
133
  default:
130
- ossl_errcode = ERR_get_error();
131
- if (ossl_errcode)
132
- rb_raise(rb_cRSAError, "%s", ERR_error_string(ossl_errcode, NULL));
133
- else
134
- rb_raise(rb_cRSAError, "An unknown error occurred during validation.");
134
+ BIND_ERR_STR(ossl_err_str)
135
+ rb_raise(rb_cRSAError, "An error occurred during validation.\n%s", ossl_err_str);
135
136
  }
136
137
  break;
137
138
 
@@ -139,34 +140,43 @@ Cleanup:
139
140
  rb_raise(rb_cRSAError, "Your public key is too big. How is that even possible?");
140
141
  break;
141
142
  case NOMEM:
142
- rb_raise(rb_const_get_at(rb_mErrno, rb_intern("ENOMEM")), NULL);
143
+ rb_raise(rb_const_get_at(rb_mErrno, rb_intern("ENOMEM")), "Insufficient memory to allocate pubkey copy. Woof.");
143
144
  break;
144
145
  case PUBKEY_PARSE:
145
- rb_raise(rb_cRSAError, "Error parsing public key");
146
+ BIND_ERR_STR(ossl_err_str);
147
+ rb_raise(rb_cRSAError, "Error parsing public key\n%s", ossl_err_str);
146
148
  break;
147
149
  case PKEY_INIT:
148
- rb_raise(rb_cRSAError, "Failed to initialize PKEY");
150
+ BIND_ERR_STR(ossl_err_str);
151
+ rb_raise(rb_cRSAError, "Failed to initialize PKEY\n%s", ossl_err_str);
149
152
  break;
150
153
  case RSA_ASSIGN:
151
- rb_raise(rb_cRSAError, "Failed to assign RSA object to PKEY");
154
+ BIND_ERR_STR(ossl_err_str);
155
+ rb_raise(rb_cRSAError, "Failed to assign RSA object to PKEY\n%s", ossl_err_str);
152
156
  break;
153
157
  case PKEY_CTX_INIT:
154
- rb_raise(rb_cRSAError, "Failed to initialize PKEY context.");
158
+ BIND_ERR_STR(ossl_err_str);
159
+ rb_raise(rb_cRSAError, "Failed to initialize PKEY context.\n%s", ossl_err_str);
155
160
  break;
156
161
  case VERIFY_INIT:
157
- rb_raise(rb_cRSAError, "Failed to initialize verification process.");
162
+ BIND_ERR_STR(ossl_err_str);
163
+ rb_raise(rb_cRSAError, "Failed to initialize verification process.\n%s", ossl_err_str);
158
164
  break;
159
165
  case SET_SIG_MD:
160
- rb_raise(rb_cRSAError, "Failed to set signature message digest to SHA1.");
166
+ BIND_ERR_STR(ossl_err_str);
167
+ rb_raise(rb_cRSAError, "Failed to set signature message digest to SHA1.\n%s", ossl_err_str);
161
168
  break;
162
169
  case SET_PADDING:
163
- rb_raise(rb_cRSAError, "Failed to set PSS padding.");
170
+ BIND_ERR_STR(ossl_err_str);
171
+ rb_raise(rb_cRSAError, "Failed to set PSS padding.\n%s", ossl_err_str);
164
172
  break;
165
173
  case SET_SALTLEN:
166
- rb_raise(rb_cRSAError, "Failed to set salt length.");
174
+ BIND_ERR_STR(ossl_err_str);
175
+ rb_raise(rb_cRSAError, "Failed to set salt length.\n%s", ossl_err_str);
167
176
  break;
168
177
  default:
169
- rb_raise(rb_eRuntimeError, "Something has gone horribly wrong.");
178
+ BIND_ERR_STR(ossl_err_str);
179
+ rb_raise(rb_eRuntimeError, "Something has gone horribly wrong.\n%s", ossl_err_str);
170
180
  }
171
181
 
172
182
  return Qnil;
@@ -1,3 +1,3 @@
1
1
  module OpenSSL_RSA_PSS_Verify
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl_rsa_pss_verify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Distad