Matt Caswell
e4676e900f
Fix probable_prime over large shift
...
In the probable_prime() function we behave slightly different if the number
of bits we are interested in is <= BN_BITS2 (the num of bits in a BN_ULONG).
As part of the calculation we work out a size_limit as follows:
size_limit = (((BN_ULONG)1) << bits) - BN_get_word(rnd) - 1;
There is a problem though if bits == BN_BITS2. Shifting by that much causes
undefined behaviour. I did some tests. On my system BN_BITS2 == 64. So I
set bits to 64 and calculated the result of:
(((BN_ULONG)1) << bits)
I was expecting to get the result 0. I actually got 1! Strangely this...
(((BN_ULONG)0) << BN_BITS2)
...does equal 0! This means that, on my system at least, size_limit will be
off by 1 when bits == BN_BITS2.
This commit fixes the behaviour so that we always get consistent results.
Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-03-17 13:41:49 +00:00
..
2015-03-13 21:10:13 -07:00
2015-03-16 15:54:19 +00:00
2015-01-29 01:54:09 +01:00
2015-03-10 12:32:39 +01:00
2015-03-17 13:41:49 +00:00
2015-02-13 13:50:36 +00:00
2015-02-24 10:11:36 +01:00
2015-02-02 11:11:34 -05:00
2015-01-22 09:20:09 +00:00
2015-03-05 09:09:57 +00:00
2015-01-29 21:38:57 -05:00
2015-02-12 13:00:42 -05:00
2015-02-09 08:58:43 +01:00
2015-03-12 09:22:56 +00:00
2015-03-12 09:23:42 +00:00
2015-03-05 09:09:57 +00:00
2015-03-14 18:23:41 +01:00
2015-03-15 15:56:24 +00:00
2015-03-15 15:56:24 +00:00
2015-03-11 09:29:37 -04:00
2015-03-11 09:29:37 -04:00
2015-03-12 09:19:24 +00:00
2015-02-10 14:32:56 +00:00
2015-01-29 01:54:09 +01:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-28 12:27:23 -05:00
2015-01-22 09:20:09 +00:00
2015-01-29 01:54:09 +01:00
2015-01-29 01:54:09 +01:00
2015-02-06 16:49:17 -05:00
2015-03-17 13:39:53 +00:00
2015-03-05 09:09:57 +00:00
2015-03-12 14:12:17 +00:00
2015-02-06 16:49:17 -05:00
2015-02-24 10:11:36 +01:00
2015-03-16 15:54:19 +00:00
2015-03-16 15:54:19 +00:00
2015-01-30 12:46:49 -05:00
2015-03-05 09:09:57 +00:00
2015-01-29 01:54:09 +01:00
2015-01-29 01:54:09 +01:00
2015-01-24 10:58:38 -05:00
2015-02-03 11:20:56 -05:00
2015-03-12 09:26:14 +00:00
2015-01-22 09:20:09 +00:00
2015-03-08 14:09:32 +01:00
2015-02-03 11:20:56 -05:00
2015-03-17 13:39:53 +00:00
2015-02-06 10:47:53 -05:00
2015-03-05 09:09:57 +00:00
2015-03-12 14:12:17 +00:00
2015-01-27 10:06:22 -05:00
2015-02-21 23:51:05 +01:00
2015-01-22 09:20:10 +00:00
2015-03-16 15:54:19 +00:00
2015-03-12 14:12:17 +00:00
2011-08-12 12:28:52 +00:00
2015-01-23 15:38:41 +01:00
2015-01-22 09:20:09 +00:00
2015-01-23 15:38:41 +01:00
2015-01-04 23:45:08 +01:00
2014-05-04 16:38:32 +02:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-27 16:43:53 -05:00
2015-01-22 09:20:09 +00:00
2015-03-05 18:20:06 +01:00
2015-01-27 17:44:12 -05:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-02-09 12:53:36 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2011-05-07 20:36:05 +00:00
2015-02-06 16:49:17 -05:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-23 15:38:41 +01:00
2015-01-23 19:09:01 +01:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-02-02 11:08:16 -05:00
2015-01-23 11:58:26 -05:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:10 +00:00
2014-12-28 01:17:52 -05:00
2015-01-22 09:20:09 +00:00
2015-03-12 14:12:17 +00:00
2013-06-18 10:37:00 +02:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2014-06-04 08:34:18 +02:00
2015-01-22 09:20:09 +00:00
2011-04-17 12:46:00 +00:00
2015-01-22 09:20:09 +00:00
2013-02-11 10:39:50 +01:00
2015-02-02 11:08:16 -05:00
2015-02-06 14:52:40 -05:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2015-01-22 09:20:09 +00:00
2014-02-14 17:24:12 +01:00
2014-08-09 08:02:20 -04:00