Border Patrol: Improving Hardware Security through Type-Aware Systems Design