Hanno Becker 80bb77e16d ECP restart: Don't calculate address of sub ctx if ctx is NULL
All modules using restartable ECC operations support passing `NULL`
as the restart context as a means to not use the feature.

The restart contexts for ECDSA and ECP are nested, and when calling
restartable ECP operations from restartable ECDSA operations, the
address of the ECP restart context to use is calculated by adding
the to the address of the ECDSA restart context the offset the of
the ECP restart context.

If the ECP restart context happens to not reside at offset `0`, this
leads to a non-`NULL` pointer being passed to restartable ECP
operations from restartable ECDSA-operations; those ECP operations
will hence assume that the pointer points to a valid ECP restart
address and likely run into a segmentation fault when trying to
dereference the non-NULL but close-to-NULL address.

The problem doesn't arise currently because luckily the ECP restart
context has offset 0 within the ECDSA restart context, but we should
not rely on it.

This commit fixes the passage from restartable ECDSA to restartable ECP
operations by propagating NULL as the restart context pointer.

Apart from being fragile, the previous version could also lead to
NULL pointer dereference failures in ASanDbg builds which dereferenced
the ECDSA restart context even though it's not needed to calculate the
address of the offset'ed ECP restart context.
2019-07-19 14:44:36 +01:00
..
2019-02-19 17:59:00 +00:00
2019-04-02 10:07:28 -07:00
2019-06-26 12:46:53 +01:00
2019-02-19 17:59:00 +00:00
2019-02-19 17:59:00 +00:00
2019-07-04 12:19:47 +02:00
2019-04-30 16:47:36 +01:00
2019-06-24 15:45:09 +02:00
2019-03-11 16:46:20 +00:00
2015-09-04 14:21:07 +02:00
2019-02-05 05:09:05 -05:00
2019-02-19 17:59:00 +00:00
2019-02-19 17:59:00 +00:00