Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 1/3] crypto: scatterwak - Add scatterwalk_sg_copychunks
@ 2016-02-22  9:16 Tudor Ambarus
  2016-02-22  9:16 ` [PATCH 2/3] crypto: scatterwalk - export scatterwalk_pagedone Tudor Ambarus
  2016-02-22  9:16 ` [PATCH 3/3] crypto: caam - add support for RSA algorithm Tudor Ambarus
  0 siblings, 2 replies; 10+ messages in thread
From: Tudor Ambarus @ 2016-02-22  9:16 UTC (permalink / raw)
  To: herbert
  Cc: linux-crypto, cristian.stoica, horia.geanta, alexandru.porosanu,
	Tudor Ambarus

This patch adds the function scatterwalk_sg_copychunks which writes
a chunk of data from a scatterwalk to another scatterwalk.
It will be used by caam driver to remove the leading zeros of RSA's
algorithm output.

Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com>
---
 crypto/scatterwalk.c         | 26 ++++++++++++++++++++++++++
 include/crypto/scatterwalk.h |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index ea5815c..bc3222d 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -125,6 +125,32 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
 }
 EXPORT_SYMBOL_GPL(scatterwalk_map_and_copy);
 
+void scatterwalk_sg_copychunks(struct scatter_walk *dest,
+			       struct scatter_walk *src, size_t nbytes)
+{
+	for (;;) {
+		unsigned int len_this_page = scatterwalk_pagelen(dest);
+		u8 *vaddr;
+
+		if (len_this_page > nbytes)
+			len_this_page = nbytes;
+
+		vaddr = scatterwalk_map(dest);
+		scatterwalk_copychunks(vaddr, src, len_this_page, 0);
+		scatterwalk_unmap(vaddr);
+
+		scatterwalk_advance(dest, len_this_page);
+
+		if (nbytes == len_this_page)
+			break;
+
+		nbytes -= len_this_page;
+
+		scatterwalk_pagedone(dest, 0, 1);
+	}
+}
+EXPORT_SYMBOL_GPL(scatterwalk_sg_copychunks);
+
 int scatterwalk_bytes_sglen(struct scatterlist *sg, int num_bytes)
 {
 	int offset = 0, n = 0;
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 35f99b6..8b799c5 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -86,6 +86,8 @@ static inline void scatterwalk_unmap(void *vaddr)
 void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg);
 void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
 			    size_t nbytes, int out);
+void scatterwalk_sg_copychunks(struct scatter_walk *dest,
+			       struct scatter_walk *src, size_t nbytes);
 void *scatterwalk_map(struct scatter_walk *walk);
 void scatterwalk_done(struct scatter_walk *walk, int out, int more);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH v5 0/3] crypto: caam - add support for RSA algorithm
@ 2016-05-12 15:06 Tudor Ambarus
  2016-05-12 15:06 ` [PATCH 3/3] " Tudor Ambarus
  0 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2016-05-12 15:06 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, Tudor Ambarus

Depends on:
[PATCH v2] crypto: rsa - return raw integers for the ASN.1 parser

Changes from v4:
- sync with ASN.1 parser

Changes from v3:
- sync with ASN.1 parser

Changes from v2:
- sync with ASN.1 parser

Changes from initial patch:
- fix memory leaks on error path
- rename struct akcipher_alg rsa to caam_rsa

Tudor Ambarus (3):
  crypto: scatterwak - Add scatterwalk_sg_copychunks
  crypto: scatterwalk - export scatterwalk_pagedone
  crypto: caam - add support for RSA algorithm

 crypto/scatterwalk.c           |  31 ++-
 drivers/crypto/caam/Kconfig    |  12 ++
 drivers/crypto/caam/Makefile   |   4 +
 drivers/crypto/caam/caampkc.c  | 466 +++++++++++++++++++++++++++++++++++++++++
 drivers/crypto/caam/caampkc.h  |  94 +++++++++
 drivers/crypto/caam/desc.h     |   2 +
 drivers/crypto/caam/pdb.h      |  16 +-
 drivers/crypto/caam/pkc_desc.c | 138 ++++++++++++
 include/crypto/scatterwalk.h   |   4 +
 9 files changed, 764 insertions(+), 3 deletions(-)
 create mode 100644 drivers/crypto/caam/caampkc.c
 create mode 100644 drivers/crypto/caam/caampkc.h
 create mode 100644 drivers/crypto/caam/pkc_desc.c

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH v7 0/3] crypto: caam - add support for RSA algorithm
@ 2016-06-07 14:24 Tudor Ambarus
  2016-06-07 14:24 ` [PATCH 3/3] " Tudor Ambarus
  0 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2016-06-07 14:24 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, horia.geanta, Tudor Ambarus

Depends on:
[PATCH v3] crypto: rsa - return raw integers for the ASN.1 parser

Changes in v7:
- sync with ASN.1 parser

Changes in v6:
- write descriptor PDB fields with inline append
- move Protocol Data Block (pdb) structures to pdb.h
- move setting of PDB fields in new functions
- unmap sec4_sg_dma on done callback
- remove redundant clean code on error path
- fix doc typos

Changes in v5:
- sync with ASN.1 parser

Changes in v4:
- sync with ASN.1 parser

Changes in v3:
- sync with ASN.1 parser

Changes in v2:
- fix memory leaks on error path
- rename struct akcipher_alg rsa to caam_rsa

Tudor Ambarus (3):
  crypto: scatterwak - Add scatterwalk_sg_copychunks
  crypto: scatterwalk - export scatterwalk_pagedone
  crypto: caam - add support for RSA algorithm

 crypto/scatterwalk.c              |  31 +-
 drivers/crypto/caam/Kconfig       |  12 +
 drivers/crypto/caam/Makefile      |   4 +
 drivers/crypto/caam/caampkc.c     | 637 ++++++++++++++++++++++++++++++++++++++
 drivers/crypto/caam/caampkc.h     |  72 +++++
 drivers/crypto/caam/compat.h      |   3 +
 drivers/crypto/caam/desc.h        |   2 +
 drivers/crypto/caam/desc_constr.h |   7 +
 drivers/crypto/caam/pdb.h         |  51 ++-
 drivers/crypto/caam/pkc_desc.c    |  36 +++
 include/crypto/scatterwalk.h      |   4 +
 11 files changed, 856 insertions(+), 3 deletions(-)
 create mode 100644 drivers/crypto/caam/caampkc.c
 create mode 100644 drivers/crypto/caam/caampkc.h
 create mode 100644 drivers/crypto/caam/pkc_desc.c

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-06-07 14:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22  9:16 [PATCH 1/3] crypto: scatterwak - Add scatterwalk_sg_copychunks Tudor Ambarus
2016-02-22  9:16 ` [PATCH 2/3] crypto: scatterwalk - export scatterwalk_pagedone Tudor Ambarus
2016-02-22  9:16 ` [PATCH 3/3] crypto: caam - add support for RSA algorithm Tudor Ambarus
2016-02-22 10:10   ` Stephan Mueller
2016-02-22 11:40     ` Tudor-Dan Ambarus
2016-02-27 17:08       ` Herbert Xu
2016-03-01 11:29         ` Tudor-Dan Ambarus
  -- strict thread matches above, loose matches on Subject: below --
2016-05-12 15:06 [PATCH v5 0/3] " Tudor Ambarus
2016-05-12 15:06 ` [PATCH 3/3] " Tudor Ambarus
2016-05-12 19:20   ` Horia Ioan Geanta Neag
2016-06-07 14:24 [PATCH v7 0/3] " Tudor Ambarus
2016-06-07 14:24 ` [PATCH 3/3] " Tudor Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox