Did Jesus know from the outset that He was the Son of God or did Mary tell Him? A Catholic friend of mine asked me this question, and I mentioned this passage:

41 Every year Jesus’ parents went to Jerusalem for the Passover festival. 42 When Jesus was twelve years old, they attended the festival as usual. 43 After the celebration was over, they started home to Nazareth, but Jesus stayed behind in Jerusalem. His parents didn’t miss him at first, 44 because they assumed he was among the other travelers. But when he didn’t show up that evening, they started looking for him among their relatives and friends.
45 When they couldn’t find him, they went back to Jerusalem to search for him there. 46 Three days later they finally discovered him in the Temple, sitting among the religious teachers, listening to them and asking questions. 47 All who heard him were amazed at his understanding and his answers.
48 His parents didn’t know what to think. “Son,” his mother said to him, “why have you done this to us? Your father and I have been frantic, searching for you everywhere.”
49 “But why did you need to search?” he asked. “Didn’t you know that I must be in my Father’s house?” 50 But they didn’t understand what he meant.
51 Then he returned to Nazareth with them and was obedient to them. And his mother stored all these things in her heart.
52 Jesus grew in wisdom and in stature and in favor with God and all the people.
~Luke 2:41–52 (NLT)

So, Jesus certainly knew His identity by 12 years old. However, being God, He could've known this as a baby, and I've heard this opinion expressed by various people. However, I'm wondering: is there a Catholic tradition that answers the question in the title? Do Catholics say Jesus grew up knowing He was the Son of God, or do they say Mary told Him?
Number 79 in the the YouCat asks if Jesus has a soul, a mind and a body just as we do.  I don't think you're going to find a Catholic answer that speculates on what Mary may or may not have said to Him outside of scripture, although there are early extra-biblical accounts of Jesus' miracles during His hidden life.  Some are spontaneous and some are at Mary's prompting, but you don't have to believe them and most Catholics don't even know of them, which is probably a good thing.

So, back to the YouCat, it says Jesus "had a soul and developed psychologically and spiritually."  So, in part, what He knew seems to be constrained to His human faculties.  But, the Doctrine of the Hypo-static union says that His soul is Human and Divine.  So... "In this soul swelled the human identity and his special self-consciousness." 

Furthermore, "Jesus new about his unity with his heavenly Father in the Holy Spirit, by whom he allowed himself to be guided in every situation of his life"

So, I think the answer is that Mary didn't need to tell Him, although there's no reason to suppose that she did and one reason to suppose that she didn't (Our Lady had a tendency to hold things and ponder them in her heart).