CBC-MAC implementation optimised for 8-bit MCUs
There does seem to be a CBC-MAC in AVR-MAC (https://github.com/mknapik/avr-MAC) in this particular library (the security toolbox): 
https://github.com/mknapik/avr-MAC/blob/master/STB/Src/stb_help.c

However, this is for Atmel's AVR family of 8 bit RISC microcontrollers. You mentioned the AVRs in your question, so I assume that you would not mind modifying some C code to make it work on an 8051. If it's at all possible, that is.