    virtual CK_RV VerifyFinal(const std::string& signature) = 0;
    // Performs an entire operation in a single step (like C_Encrypt). This is
 diff --git a/chaps/session_impl.cc b/chaps/session_impl.cc
-index af625c0..cc3530d 100644
+index af625c0..4c61eea 100644
 --- a/chaps/session_impl.cc
 +++ b/chaps/session_impl.cc
 @@ -282,6 +282,7 @@ CK_RV SessionImpl::OperationUpdate(OperationType operation,

From d93952fe1eaeb179b6de62a7045f47398e1a3b9c Mon Sep 17 00:00:00 2001
From: David Drysdale <drysdale@google.com>
Date: Fri, 3 Oct 2014 11:35:34 +0100
Subject: [PATCH 9/9] Cancel operations on error returns

     return CKR_OPERATION_ACTIVE;
   }
   context->is_incremental_ = true;
@@ -420,6 +436,7 @@ CK_RV SessionImpl::OperationSinglePart(OperationType operation,
   }
   if (context->is_incremental_) {
     LOG(ERROR) << "Operation is incremental.";
+    OperationCancel(operation);
     return CKR_OPERATION_ACTIVE;
   }
   context->is_single_ = true;
@@ -950,7 +967,8 @@ CK_RV SessionImpl::GetOperationOutput(OperationContext* context,
   *required_out_length = out_length;
   if (max_length < out_length)
     return CKR_BUFFER_TOO_SMALL;
