Exploiting design-for-debug for flexible SoC security architecture