Thanks for the feedback! I will re-send the patch.

On Tue, 2010-02-23 at 11:40 -0300, Klaus Heinrich Kiwi wrote:
> On Tue, 2010-02-23 at 11:16 -0300, Ramon de Carvalho Valle wrote:
> > Add command line argument to enable key par generation test with an
> > invalid public exponent.
> 
> Thanks. Some comments inlined below.
> 
> > Signed-off-by: Ramon de Carvalho Valle <[email protected]>
> > ---
> >  testcases/rsa_keygen/rsa_keygen.c |   39 
> > +++++++++++++++++++++---------------
> >  1 files changed, 23 insertions(+), 16 deletions(-)
> > 
> > diff --git a/testcases/rsa_keygen/rsa_keygen.c 
> > b/testcases/rsa_keygen/rsa_keygen.c
> > index 8f0465b..44c3aa7 100755
> > --- a/testcases/rsa_keygen/rsa_keygen.c
> > +++ b/testcases/rsa_keygen/rsa_keygen.c
> > @@ -16,6 +16,7 @@
> >  #include "pkcs11types.h"
> >  #include "regress.h"
> > 
> > +static int inv_pub_exp = 0;
> > 
> >  int do_GetFunctionList(void);
> > 
> > @@ -102,24 +103,27 @@ do_GenerateRSAKeyPair(CK_ULONG bits)
> > 
> >     }
> > 
> > +   if (inv_pub_exp) {
> >     // Use an invalid pub exp
> 
> I think you could just add the conditional above (without new curly
> brackets) and reuse the existing block below, leaving changes to a
> minimum.
> 
> > -   {
> > -      CK_BYTE   pub_exp[] = { 0x1, 0x0, 0x2 };
> > -
> > -      CK_ATTRIBUTE pub_tmpl[] =
> >        {
> > -         {CKA_MODULUS_BITS,    &bits,    sizeof(bits)    },
> > -         {CKA_PUBLIC_EXPONENT, &pub_exp, sizeof(pub_exp) }
> > -      };
> > +         CK_BYTE   pub_exp[] = { 0x1, 0x0, 0x2 };
> > +
> > +         CK_ATTRIBUTE pub_tmpl[] =
> > +         {
> > +            {CKA_MODULUS_BITS,    &bits,    sizeof(bits)    },
> > +            {CKA_PUBLIC_EXPONENT, &pub_exp, sizeof(pub_exp) }
> > +         };
> > +
> > +         rc = funcs->C_GenerateKeyPair( session,   &mech,
> > +                                        pub_tmpl,   2,
> > +                                        NULL,       0,
> > +                                        &publ_key, &priv_key );
> > +         if (rc != CKR_FUNCTION_FAILED) {
> > +            show_error("   C_GenerateKeyPair #3", rc );
> > +            return rc;
> > +         }
> > 
> > -      rc = funcs->C_GenerateKeyPair( session,   &mech,
> > -                                     pub_tmpl,   2,
> > -                                     NULL,       0,
> > -                                     &publ_key, &priv_key );
> > -      if (rc != CKR_FUNCTION_FAILED) {
> > -         show_error("   C_GenerateKeyPair #3", rc );
> > -         return rc;
> > -   }
> > +      }
> > 
> >     }
> > 
> > @@ -169,8 +173,11 @@ main( int argc, char **argv )
> >           SLOT_ID = atoi(argv[i]);
> >        }
> > 
> > +      if (strcmp(argv[i], "-i") == 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 [-i] [-noskip] [-slot <num>] [-h]\n\n", 
> > argv[0] );
> 
> Might just be a testcase but we need a little more documentation than
> that. Either briefly describe it here or in the top-level documentation
> (or both), your choice.
> 
> >           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");
> 


-- 
Ramon de Carvalho Valle
Software Engineer
IBM Linux Technology Center
E-Mail: [email protected]

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
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