+static void padlock_ctr32_encrypt_glue(const unsigned char *in,
+ unsigned char *out, size_t blocks,
+ struct padlock_cipher_data *ctx,
+ const unsigned char *ivec)
+{
+ memcpy(ctx->iv,ivec,AES_BLOCK_SIZE);
+ padlock_ctr32_encrypt(out,in,ctx,AES_BLOCK_SIZE*blocks);
+}
+
+static int
+padlock_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg,
+ const unsigned char *in_arg, size_t nbytes)
+{
+ struct padlock_cipher_data *cdata = ALIGNED_CIPHER_DATA(ctx);
+ unsigned int num = ctx->num;
+
+ CRYPTO_ctr128_encrypt_ctr32(in_arg,out_arg,nbytes,
+ cdata,ctx->iv,ctx->buf,&num,
+ (ctr128_f)padlock_ctr32_encrypt_glue);
+
+ ctx->num = (size_t)num;
+ return 1;
+}
+