]> git.pld-linux.org Git - packages/openssl.git/blame - openssl-sec3.patch
- added smime patch ("make S/MIME encrypt work again"); release 3
[packages/openssl.git] / openssl-sec3.patch
CommitLineData
98b4a6cf 1diff -u -r1.28.2.3 rsa_eay.c
2--- crypto/rsa/rsa_eay.c 30 Jan 2003 17:37:46 -0000 1.28.2.3
3+++ crypto/rsa/rsa_eay.c 16 Mar 2003 10:34:13 -0000
4@@ -195,6 +195,25 @@
5 return(r);
6 }
7
8+static int rsa_eay_blinding(RSA *rsa, BN_CTX *ctx)
9+ {
10+ int ret = 1;
11+ CRYPTO_w_lock(CRYPTO_LOCK_RSA);
12+ /* Check again inside the lock - the macro's check is racey */
13+ if(rsa->blinding == NULL)
14+ ret = RSA_blinding_on(rsa, ctx);
15+ CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
16+ return ret;
17+ }
18+
19+#define BLINDING_HELPER(rsa, ctx, err_instr) \
20+ do { \
21+ if(((rsa)->flags & RSA_FLAG_BLINDING) && \
22+ ((rsa)->blinding == NULL) && \
23+ !rsa_eay_blinding(rsa, ctx)) \
24+ err_instr \
25+ } while(0)
26+
27 /* signing */
28 static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
29 unsigned char *to, RSA *rsa, int padding)
30@@ -239,8 +258,8 @@
31 goto err;
32 }
33
34- if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
35- RSA_blinding_on(rsa,ctx);
36+ BLINDING_HELPER(rsa, ctx, goto err;);
37+
38 if (rsa->flags & RSA_FLAG_BLINDING)
39 if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
40
41@@ -318,8 +337,8 @@
42 goto err;
43 }
44
45- if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
46- RSA_blinding_on(rsa,ctx);
47+ BLINDING_HELPER(rsa, ctx, goto err;);
48+
49 if (rsa->flags & RSA_FLAG_BLINDING)
50 if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
51
52diff -u -r1.30.2.2 rsa_lib.c
53--- crypto/rsa/rsa_lib.c 30 Jan 2003 17:37:46 -0000 1.30.2.2
54+++ crypto/rsa/rsa_lib.c 16 Mar 2003 10:34:13 -0000
55@@ -72,7 +72,13 @@
56
57 RSA *RSA_new(void)
58 {
59- return(RSA_new_method(NULL));
60+ RSA *r=RSA_new_method(NULL);
61+
62+#ifndef OPENSSL_NO_FORCE_RSA_BLINDING
63+ r->flags|=RSA_FLAG_BLINDING;
64+#endif
65+
66+ return r;
67 }
68
69 void RSA_set_default_method(const RSA_METHOD *meth)
70
This page took 0.049748 seconds and 4 git commands to generate.