The king can't castle into, out of, or through check. However, if the square the rook begins on, or in the case of queenside castling the square which the rook passes through but the king does not, is attacked by the opponent, castling is still legal.
now i think i know chess a little bit but maybe im wrong.
The question is can you still castle even if one of the squares is controlled by your opponent?