Add command line argument to enable key par generation test with an
invalid public exponent.

Signed-off-by: Ramon de Carvalho Valle <[email protected]>
---
 testcases/rsa_keygen/rsa_keygen.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/testcases/rsa_keygen/rsa_keygen.c 
b/testcases/rsa_keygen/rsa_keygen.c
index 8f0465b..1268e55 100755
--- a/testcases/rsa_keygen/rsa_keygen.c
+++ b/testcases/rsa_keygen/rsa_keygen.c
@@ -19,6 +19,8 @@
 
 int do_GetFunctionList(void);
 
+static int inv_pub_exp = 0;
+
 CK_FUNCTION_LIST  *funcs;
 CK_SLOT_ID  SLOT_ID;
 
@@ -103,6 +105,7 @@ do_GenerateRSAKeyPair(CK_ULONG bits)
    }
 
    // Use an invalid pub exp
+   if (inv_pub_exp)
    {
       CK_BYTE   pub_exp[] = { 0x1, 0x0, 0x2 };
 
@@ -169,11 +172,16 @@ main( int argc, char **argv )
          SLOT_ID = atoi(argv[i]);
       }
 
+      if (strcmp(argv[i], "-invpub") == 0)
+         inv_pub_exp = 1;
+
       if (strcmp(argv[i], "-h") == 0) {
-         printf("usage:  %s [-noskip] [-slot <num>] [-h]\n\n", argv[0] );
+         printf("usage:  %s [-invpub] [-noskip] [-slot <num>] [-h]\n\n", 
argv[0] );
          printf("By default, Slot #1 is used\n\n");
          printf("By default we skip anything that creates or modifies\n");
          printf("token objects to preserve flash lifetime.\n");
+         printf("By default does not enable key par generation test\n");
+         printf("with an invalid public exponent.\n");
          return -1;
       }
    }
-- 
1.6.3.3


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to