BlackBerry posts small profit as focus shifts to security software