The Pololu AVR library supports master SPI, which is half of what you need. The library contains the source code, so you can get an idea of how to do it yourself (you can download a zip file of the library here). Implementing the slave side should be pretty straightforward if you look at the ATmega328 datasheet. If there is something you don’t understand about the library code or the datasheet, please ask.