Bug 67985 - correctly derivate CKA_MODULUS_BITS in RSA C_ObjectCreate
Bug 67985 - correctly derivate CKA_MODULUS_BITS in RSA C_ObjectCreate

On Wed, Nov 10, 2010 at 03:09:03PM -0200, Klaus Heinrich Kiwi wrote:
>    OpenCryptoki is not correctly derivating CKA_MODULUS_BITS when
>    creating an object with C_ObjectCreate(). This value must be
>    derivated from CKA_MODULUS which is a required attribute for
>    C_ObjectCreate() when dealing with RSA Public Keys.
>
>    The most obvios symptom is a CKR_FUNCTION_FAILED for the
>    C_VerifyRecover() function when using NSS to create a
>    self-signed certificate (NSS tries to import the public
>    key into a session object using C_ObjectCreate())

  Looks good to me, Klaus.  template_attribute_find will correctly
return 0 when the base template passed in is NULL, so that should be
safe.

  I noticed that the rsa_keygen test tries that validate that
CKR_FUNCTION_FAILED is returned when an even RSA public exponent is
passed in.  That test now fails, did that check change recently?

  Attached is an updated rsa_keygen.c that tests the stuff in this
patch.

Acked-by: Kent Yoder <a62f2225bf70bfaccbc7f1ef2a397836717377de@linux.vnet.ibm.com>

fingunter/OpenCryptoki,fingunter/OpenCryptoki,joylatten/opencryptoki,shpedoikal/opencryptoki,joylatten/opencryptoki,shpedoikal/opencryptoki,shpedoikal/opencryptoki,fingunter/OpenCryptoki,joylatten/opencryptoki,joylatten/opencryptoki,shpedoikal/opencryptoki,fingunter/OpenCryptoki,joylatten/opencryptoki