diff options
author | schwarze <> | 2017-01-29 23:41:49 +0000 |
---|---|---|
committer | schwarze <> | 2017-01-29 23:41:49 +0000 |
commit | cdcc8ff92546c28c6052f507ba6ff8b82340b5e3 (patch) | |
tree | 83b0e7ffbb25488021b344d6b87cca01b6781a0b | |
parent | 349c6add6442fbf91283c7ec35808acbec836f29 (diff) | |
download | openbsd-cdcc8ff92546c28c6052f507ba6ff8b82340b5e3.tar.gz openbsd-cdcc8ff92546c28c6052f507ba6ff8b82340b5e3.tar.bz2 openbsd-cdcc8ff92546c28c6052f507ba6ff8b82340b5e3.zip |
Seriously warn against calling BN_init(3), BN_MONT_CTX_init(3),
and BN_RECP_CTX_init(3). They are not only deprecated but so
dangerous that they are almost unusable. I found these scary
traps while reading the code in order to document BN_set_flags(3).
While here, delete ERR_get_error(3) from SEE ALSO.
-rw-r--r-- | src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/man/BN_new.3 | 33 |
3 files changed, 75 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 index 8b06cb6217..87f09e3cb6 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.5 2016/12/10 21:13:25 schwarze Exp $ | 1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.6 2017/01/29 23:41:49 schwarze Exp $ |
2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 | 2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: December 10 2016 $ | 51 | .Dd $Mdocdate: January 29 2017 $ |
52 | .Dt BN_MOD_MUL_MONTGOMERY 3 | 52 | .Dt BN_MOD_MUL_MONTGOMERY 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -119,9 +119,12 @@ operations are to be performed using the same modulus. | |||
119 | allocates and initializes a | 119 | allocates and initializes a |
120 | .Vt BN_MONT_CTX | 120 | .Vt BN_MONT_CTX |
121 | structure. | 121 | structure. |
122 | .Pp | ||
122 | .Fn BN_MONT_CTX_init | 123 | .Fn BN_MONT_CTX_init |
123 | initializes an existing uninitialized | 124 | initializes an existing uninitialized |
124 | .Vt BN_MONT_CTX . | 125 | .Vt BN_MONT_CTX . |
126 | It is deprecated and dangerous, see | ||
127 | .Sx CAVEATS . | ||
125 | .Pp | 128 | .Pp |
126 | .Fn BN_MONT_CTX_set | 129 | .Fn BN_MONT_CTX_set |
127 | sets up the | 130 | sets up the |
@@ -213,8 +216,7 @@ The error codes can be obtained by | |||
213 | .Sh SEE ALSO | 216 | .Sh SEE ALSO |
214 | .Xr BN_add 3 , | 217 | .Xr BN_add 3 , |
215 | .Xr BN_CTX_new 3 , | 218 | .Xr BN_CTX_new 3 , |
216 | .Xr BN_new 3 , | 219 | .Xr BN_new 3 |
217 | .Xr ERR_get_error 3 | ||
218 | .Sh HISTORY | 220 | .Sh HISTORY |
219 | .Fn BN_MONT_CTX_new , | 221 | .Fn BN_MONT_CTX_new , |
220 | .Fn BN_MONT_CTX_free , | 222 | .Fn BN_MONT_CTX_free , |
@@ -229,3 +231,20 @@ are available in all versions of SSLeay and OpenSSL. | |||
229 | and | 231 | and |
230 | .Fn BN_MONT_CTX_copy | 232 | .Fn BN_MONT_CTX_copy |
231 | were added in SSLeay 0.9.1b. | 233 | were added in SSLeay 0.9.1b. |
234 | .Sh CAVEATS | ||
235 | .Fn BN_MONT_CTX_init | ||
236 | must not be called on a context that was used previously, or | ||
237 | memory used by the embedded | ||
238 | .Vt BIGNUM | ||
239 | structures is leaked immediately. | ||
240 | Besides, it must not be called on a context created with | ||
241 | .Fn BN_MONT_CTX_new , | ||
242 | or the context itself will likely be leaked later. | ||
243 | It can only be used on a static | ||
244 | .Vt BN_MONT_CTX | ||
245 | structure, on one located on the stack, or on one | ||
246 | .Xr malloc 3 Ap ed | ||
247 | manually, but all these options are discouraged because they | ||
248 | will no longer work once | ||
249 | .Vt BN_MONT_CTX | ||
250 | will be made opaque. | ||
diff --git a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 index 74783b2f55..a24917bef9 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.5 2016/12/10 21:13:25 schwarze Exp $ | 1 | .\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.6 2017/01/29 23:41:49 schwarze Exp $ |
2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 | 2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: December 10 2016 $ | 51 | .Dd $Mdocdate: January 29 2017 $ |
52 | .Dt BN_MOD_MUL_RECIPROCAL 3 | 52 | .Dt BN_MOD_MUL_RECIPROCAL 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -115,9 +115,12 @@ used for temporary variables. | |||
115 | allocates and initializes a | 115 | allocates and initializes a |
116 | .Vt BN_RECP_CTX | 116 | .Vt BN_RECP_CTX |
117 | structure. | 117 | structure. |
118 | .Pp | ||
118 | .Fn BN_RECP_CTX_init | 119 | .Fn BN_RECP_CTX_init |
119 | initializes an existing uninitialized | 120 | initializes an existing uninitialized |
120 | .Vt BN_RECP_CTX . | 121 | .Vt BN_RECP_CTX . |
122 | It is deprecated and dangerous, see | ||
123 | .Sx CAVEATS . | ||
121 | .Pp | 124 | .Pp |
122 | .Fn BN_RECP_CTX_free | 125 | .Fn BN_RECP_CTX_free |
123 | frees the components of the | 126 | frees the components of the |
@@ -185,8 +188,7 @@ The error codes can be obtained by | |||
185 | .Sh SEE ALSO | 188 | .Sh SEE ALSO |
186 | .Xr BN_add 3 , | 189 | .Xr BN_add 3 , |
187 | .Xr BN_CTX_new 3 , | 190 | .Xr BN_CTX_new 3 , |
188 | .Xr BN_new 3 , | 191 | .Xr BN_new 3 |
189 | .Xr ERR_get_error 3 | ||
190 | .Sh HISTORY | 192 | .Sh HISTORY |
191 | .Vt BN_RECP_CTX | 193 | .Vt BN_RECP_CTX |
192 | was added in SSLeay 0.9.0. | 194 | was added in SSLeay 0.9.0. |
@@ -195,3 +197,20 @@ Before that, a function | |||
195 | was used instead, and the | 197 | was used instead, and the |
196 | .Fn BN_mod_mul_reciprocal | 198 | .Fn BN_mod_mul_reciprocal |
197 | arguments were different. | 199 | arguments were different. |
200 | .Sh CAVEATS | ||
201 | .Fn BN_RECP_CTX_init | ||
202 | must not be called on a context that was used previously, or | ||
203 | memory used by the embedded | ||
204 | .Vt BIGNUM | ||
205 | structures is leaked immediately. | ||
206 | Besides, it must not be called on a context created with | ||
207 | .Fn BN_RECP_CTX_new , | ||
208 | or the context itself will likely be leaked later. | ||
209 | It can only be used on a static | ||
210 | .Vt BN_RECP_CTX | ||
211 | structure, on one located on the stack, or on one | ||
212 | .Xr malloc 3 Ap ed | ||
213 | manually, but all these options are discouraged because they | ||
214 | will no longer work once | ||
215 | .Vt BN_RECP_CTX | ||
216 | will be made opaque. | ||
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 index 2b2166ce30..8294a4f4d1 100644 --- a/src/lib/libcrypto/man/BN_new.3 +++ b/src/lib/libcrypto/man/BN_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: BN_new.3,v 1.6 2016/12/22 19:33:57 jmc Exp $ | 1 | .\" $OpenBSD: BN_new.3,v 1.7 2017/01/29 23:41:49 schwarze Exp $ |
2 | .\" OpenSSL doc/man3/BN_new.pod 2457c19d Mar 6 08:43:36 2004 +0000 | 2 | .\" OpenSSL doc/man3/BN_new.pod 2457c19d Mar 6 08:43:36 2004 +0000 |
3 | .\" OpenSSL doc/man7/bn.pod 05ea606a May 20 20:52:46 2016 -0400 | 3 | .\" OpenSSL doc/man7/bn.pod 05ea606a May 20 20:52:46 2016 -0400 |
4 | .\" | 4 | .\" |
@@ -49,7 +49,7 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 51 | .\" |
52 | .Dd $Mdocdate: December 22 2016 $ | 52 | .Dd $Mdocdate: January 29 2017 $ |
53 | .Dt BN_NEW 3 | 53 | .Dt BN_NEW 3 |
54 | .Os | 54 | .Os |
55 | .Sh NAME | 55 | .Sh NAME |
@@ -102,9 +102,12 @@ or accessed directly. | |||
102 | allocates and initializes a | 102 | allocates and initializes a |
103 | .Vt BIGNUM | 103 | .Vt BIGNUM |
104 | structure. | 104 | structure. |
105 | .Pp | ||
105 | .Fn BN_init | 106 | .Fn BN_init |
106 | initializes an existing uninitialized | 107 | initializes an existing uninitialized |
107 | .Vt BIGNUM . | 108 | .Vt BIGNUM . |
109 | It is deprecated and dangerous, see | ||
110 | .Sx CAVEATS . | ||
108 | .Pp | 111 | .Pp |
109 | .Fn BN_clear | 112 | .Fn BN_clear |
110 | is used to destroy sensitive data such as keys when they are no longer | 113 | is used to destroy sensitive data such as keys when they are no longer |
@@ -154,8 +157,7 @@ and sets an error code that can be obtained by | |||
154 | .Xr BN_set_bit 3 , | 157 | .Xr BN_set_bit 3 , |
155 | .Xr BN_set_negative 3 , | 158 | .Xr BN_set_negative 3 , |
156 | .Xr BN_swap 3 , | 159 | .Xr BN_swap 3 , |
157 | .Xr BN_zero 3 , | 160 | .Xr BN_zero 3 |
158 | .Xr ERR_get_error 3 | ||
159 | .Sh HISTORY | 161 | .Sh HISTORY |
160 | .Fn BN_new , | 162 | .Fn BN_new , |
161 | .Fn BN_clear , | 163 | .Fn BN_clear , |
@@ -165,3 +167,26 @@ and | |||
165 | are available in all versions of SSLeay and OpenSSL. | 167 | are available in all versions of SSLeay and OpenSSL. |
166 | .Fn BN_init | 168 | .Fn BN_init |
167 | was added in SSLeay 0.9.1b. | 169 | was added in SSLeay 0.9.1b. |
170 | .Sh CAVEATS | ||
171 | .Fn BN_init | ||
172 | must not be called on a | ||
173 | .Vt BIGNUM | ||
174 | that was used and contains an actual number, or the memory | ||
175 | used for storing the number is leaked immediately. | ||
176 | Besides, it must not be called on a number allocated with | ||
177 | .Fn BN_new , | ||
178 | or the | ||
179 | .Vt BIGNUM | ||
180 | structure itself will likely be leaked later on. | ||
181 | It can only be used on static | ||
182 | .Vt BIGNUM | ||
183 | structures, on | ||
184 | .Vt BIGNUM | ||
185 | structures on the stack, or on | ||
186 | .Vt BIGNUM | ||
187 | structures | ||
188 | .Xr malloc 3 Ap ed | ||
189 | manually, but all of these options are discouraged because they | ||
190 | will no longer work once the | ||
191 | .Vt BIGNUM | ||
192 | data type will be made opaque. | ||