- AES_ctr128_encrypt(src->iov_base, dst->iov_base, len,
- &aes->key, aes->ivec, aes->ecount, &aes->num);
- ((char *)dst->iov_base)[len] = '\0';
+ ret = EVP_EncryptUpdate(ctx, dst->iov_base, &outlen, src->iov_base, inlen);
+ assert(ret != 0);
+ ret = EVP_EncryptFinal_ex(ctx, dst->iov_base + outlen, &tmplen);
+ assert(ret != 0);
+ outlen += tmplen;
+ ((char *)dst->iov_base)[outlen] = '\0';
+ dst->iov_len = outlen;