The 4th amendment to the Constitution provides protection against illegal search and seizure. The police must have your permission or a court order to search your trunk. The exception is "Probable Cause". If an officer sees you put contraband in your trunk he/she can retrieve it. Also, if you are arrested a thorough inventory (including the contents of the trunk) will be inventoried. Many cops use this as a way around the 4th amendment.
The best advice is to not travel with contraband, or if you have already been caught with contraband, hire the best attorney you can possibly afford.