Adds checking of image_ok before writing
Adds checking of image_ok before writing

When image is slot 1 had bad signature, the swap would fail and
try to write image_ok in slot 0 which if that was already a
permanent image would cause a overwrite in flash.

Fix warning/error when slot 0 validation is not enabled.

Signed-off-by: Fabio Utzig <66676b1ceaf93296e098708c09494361103aa635@apache.org>

tamban01/mcuboot,ATmobica/mcuboot,runtimeco/mcuboot,utzig/mcuboot,ATmobica/mcuboot,utzig/mcuboot,utzig/mcuboot,tamban01/mcuboot,tamban01/mcuboot,utzig/mcuboot,tamban01/mcuboot,ATmobica/mcuboot,runtimeco/mcuboot,runtimeco/mcuboot,runtimeco/mcuboot,runtimeco/mcuboot,ATmobica/mcuboot,utzig/mcuboot,ATmobica/mcuboot,tamban01/mcuboot