In the prequels we see that both C3PO and R2D2 are Anakin's droids and they clearly both know that he's gone over to the dark side.
I would like to know an in-universe answer for the question; Why did they not tell Luke?
that Vader is Anakin?
I think for C-3PO the situation is clear: After his memory wipe he shouldn't have been able to remember that Vader was Anakin. For R2-D2 it is very likely that the reprogramming prevented him from telling Luke about Skywalker being Vader.
R2-D2 and C3P-O had their memories wiped by Captain Antilles shortly after the birth of both Luke and Leia. If not R2-D2, then at least C3P-O did.
From a scene in Revenge of the Sith: