Hi Klaus,

  While running sess_perf.c, I routinely got CKR_BUFFER_TOO_SMALL as the test
called encrypt_DATA during its run.

  I believe this patch fixes the issue, which is that an uninitialized outlen
parameter was being passed into C_EncryptUpdate and C_EncryptFile.  I also
added a return code value from main in this patch.

  Please consider for inclusion in opencryptoki-next.

Thanks,
Kent

Signed-off-by: Kent Yoder <[email protected]>

diff --git a/testcases/driver/sess_perf.c b/testcases/driver/sess_perf.c
index fb02490..80415f6 100755
--- a/testcases/driver/sess_perf.c
+++ b/testcases/driver/sess_perf.c
@@ -93,7 +93,7 @@ int create_des_encrypt_context(CK_SESSION_HANDLE_PTR hsess, 
CK_OBJECT_HANDLE_PTR

 int encrypt_DATA(CK_SESSION_HANDLE hsess, CK_OBJECT_HANDLE hkey, CK_ULONG 
blocklen) {
        CK_RV             rc;
-       CK_ULONG          outlen;
+       CK_ULONG          outlen = 8;
         unsigned long int i;

        for (i = 0; i < DATALEN; i+=outlen) {
@@ -111,7 +111,7 @@ int encrypt_DATA(CK_SESSION_HANDLE hsess, CK_OBJECT_HANDLE 
hkey, CK_ULONG blockl
 int finalize_des_encrypt_context(CK_SESSION_HANDLE hsess)
 {
        CK_RV             rc;
-       CK_ULONG          outlen;
+       CK_ULONG          outlen = DATALEN;

        rc = funcs->C_EncryptFinal(hsess, DUMP, &outlen);
        if (rc != CKR_OK) {
@@ -245,4 +245,5 @@ int main(int argc, char **argv)
                do_SessionPerformance(i);
        }

+       return 0;
 }

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to