Native speakers are sometimes confused about this.
FIfty years ago, 'educated' speakers used used to almost as a modal verb, and the 'correct' negative was used not to - it was rarely contracted to usedn't to. There are still some people who construct negative and interrogative forms in this way.
Most speakers have always constructed these forms with 'did'; the correct negative is didn't use to. However, in the spoken language, this sounds identical to didn't used to, and some people, incorrectly, write didn't used to. I have even seen the incorrect form in newspapers and magazines. It doesn't really matter - not many people notice it.