1
0
forked from pool/boinc-client
boinc-client/boinc-bnc_465676.patch

65 lines
2.6 KiB
Diff

diff -Naur boinc_core_release_6_4_5/lib/crypt.cpp boinc_core_release_6_4_5p/lib/crypt.cpp
--- boinc_core_release_6_4_5/lib/crypt.cpp 2009-02-07 10:15:12.000000000 +0100
+++ boinc_core_release_6_4_5p/lib/crypt.cpp 2009-02-09 01:12:00.000000000 +0100
@@ -243,7 +243,7 @@
// The output block must be decrypted in its entirety.
//
int encrypt_private(R_RSA_PRIVATE_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out) {
- int n, modulus_len;
+ int n, modulus_len, retval;
modulus_len = (key.bits+7)/8;
n = in.len;
@@ -253,15 +253,25 @@
RSA* rp = RSA_new();
private_to_openssl(key, rp);
RSA_private_encrypt(n, in.data, out.data, rp, RSA_PKCS1_PADDING);
+ retval = RSA_private_encrypt(n, in.data, out.data, rp, RSA_PKCS1_PADDING);
+ if (retval < 0) {
+ RSA_free(rp);
+ return ERR_CRYPTO;
+ }
out.len = RSA_size(rp);
RSA_free(rp);
return 0;
}
int decrypt_public(R_RSA_PUBLIC_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out) {
+ int retval;
RSA* rp = RSA_new();
public_to_openssl(key, rp);
- RSA_public_decrypt(in.len, in.data, out.data, rp, RSA_PKCS1_PADDING);
+ retval = RSA_public_decrypt(in.len, in.data, out.data, rp, RSA_PKCS1_PADDING);
+ if (retval < 0) {
+ RSA_free(rp);
+ return ERR_CRYPTO;
+ }
out.len = RSA_size(rp);
return 0;
}
diff -Naur boinc_core_release_6_4_5/lib/error_numbers.h boinc_core_release_6_4_5p/lib/error_numbers.h
--- boinc_core_release_6_4_5/lib/error_numbers.h 2009-02-07 10:15:12.000000000 +0100
+++ boinc_core_release_6_4_5p/lib/error_numbers.h 2009-02-09 01:12:58.000000000 +0100
@@ -185,7 +185,7 @@
#define ERR_RMDIR -227
#define ERR_SYMLINK -229
#define ERR_DB_CONN_LOST -230
-
+#define ERR_CRYPTO -231
// PLEASE: add a text description of your error to
// the text description function boincerror() in str_util.C.
diff -Naur boinc_core_release_6_4_5/lib/str_util.cpp boinc_core_release_6_4_5p/lib/str_util.cpp
--- boinc_core_release_6_4_5/lib/str_util.cpp 2009-02-07 10:15:12.000000000 +0100
+++ boinc_core_release_6_4_5p/lib/str_util.cpp 2009-02-09 01:14:02.000000000 +0100
@@ -735,7 +735,8 @@
case ERR_RMDIR: return "rmdir() failed";
case ERR_SYMLINK: return "symlink() failed";
case ERR_DB_CONN_LOST: return "DB connection lost during enumeration";
- case 404: return "HTTP file not found";
+ case ERR_CRYPTO: return "encryption error";
+ case 404: return "HTTP file not found";
case 407: return "HTTP proxy authentication failure";
case 416: return "HTTP range request error";
case 500: return "HTTP internal server error";