Cbc encryption or open SSL either supply a truly random IV or if you want the IV to be a counter than you have to encrypt a counter using AAS before you actually call a CBC encrypt and you have to that yourself. 