I have to admit, that I have never been a witness in a criminal case in U.S. However, I asked a lawyer about the swearing to "tell the truth, the whole truth, and nothing but the truth."
Truth is that in the U.S., a witness is not required to tell the whole truth. That means that in a criminal case, if he knows information that would help the prosecutor or defense in the case, he does not need to divulge this information if he is not asked. Someone has told me that in England, it is a requirement, and the witness can be penalized if he doesn't divulge this information. (I can't verify the truth of that info, myself.)
My question here is what halacha is? Does a witness need to divulge information that he knows no matter what, or only if he is specifically asked by the judge?