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 +4 -4
- data/Gemfile.lock +1 -1
- data/ext/openssl_rsa_pss_verify/openssl_rsa_pss_verify_ext.c +26 -16
- data/lib/openssl_rsa_pss_verify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb554544bf4570782eab25d1176881330016c4e
|
4
|
+
data.tar.gz: c01a12c25c075dc9c6605c11f7ce594e3b91b34e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9efc75ce48e569a316c13a077b0510399162e46071b039ce3a9db0e3f1e1468332d0a6b0dfa91c3b2a0d7b3c133e39b5183e3f3fb2062a0ba3d3feb6afee758e
|
7
|
+
data.tar.gz: dfe8f49cc6f6688cf54392496bc601af61e5161f97d55bea294fafb02dd1349f729c682799acdebd3063e1d29e3c34df8cafe869eb41257d5e0a744b5bb3b698
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
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
|
-
|
131
|
-
|
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")),
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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;
|