A friend of one of the San Bernardino attackers has been charged in connection with the mass shooting that killed 14.