RE: [PATCH 3/3] crypto: caam - add support for RSA algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stephan,

> -----Original Message-----
> >+++ b/drivers/crypto/caam/caam_rsaprivkey.asn1
> >@@ -0,0 +1,11 @@
> >+RsaPrivKey ::= SEQUENCE {
> >+	version		INTEGER,
> >+	n		INTEGER ({ caam_rsa_get_n }),
> >+	e		INTEGER ({ caam_rsa_get_e }),
> >+	d		INTEGER ({ caam_rsa_get_d }),
> >+	prime1		INTEGER,
> >+	prime2		INTEGER,
> >+	exponent1	INTEGER,
> >+	exponent2	INTEGER,
> >+	coefficient	INTEGER
> >+}
> 
> Why do you define your own ASN.1 sequence? Why not using the common
> crypto/rsaprivkey.asn1?
> 

[ta] The functions indicated in crypto/rsaprivkey.asn1 return the key members in MPI format. Our hardware expects the keys as u8 buffers; retrieving the key members in MPI format and then writing them to u8 buffers would be an unnecessary step.

> >diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c
> >new file mode 100644
> >index 0000000..8dd5ff2
> >--- /dev/null
> >+++ b/drivers/crypto/caam/caampkc.c
> >@@ -0,0 +1,616 @@
> >+int caam_rsa_get_n(void *context, size_t hdrlen, unsigned char tag,
> >+		   const void *value, size_t vlen)
> 
> This function and the following functions are very similar to the ones in
> rsa_helper.c -- shouldn't those be used instead?
> 

[ta] Those functions use the MPI lib and I don't need it.

> >+static void rsa_free_key(struct caam_pkc_context *ctx)
> >+{
> >+	kfree(ctx->n);
> >+	ctx->n = NULL;
> >+	kfree(ctx->e);
> >+	ctx->e = NULL;
> >+
> >+	if (ctx->d) {
> >+		memset(ctx->d, '\0', ctx->key_sz);
> >+		kfree(ctx->d);
> 
> kzfree, please
> 

Thanks,
ta


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux