crypto-native: refactor AES code