forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CRYPTO] scatterwalk: Move scatterwalk.h to linux/crypto
The scatterwalk infrastructure is used by algorithms so it needs to move out of crypto for future users that may live in drivers/crypto or asm/*/crypto. Signed-off-by: Herbert Xu <[email protected]>
- Loading branch information
Showing
8 changed files
with
42 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
* Kazunori Miyazawa <[email protected]> | ||
*/ | ||
|
||
#include <crypto/scatterwalk.h> | ||
#include <linux/crypto.h> | ||
#include <linux/err.h> | ||
#include <linux/hardirq.h> | ||
|
@@ -27,7 +28,6 @@ | |
#include <linux/rtnetlink.h> | ||
#include <linux/slab.h> | ||
#include <linux/scatterlist.h> | ||
#include "internal.h" | ||
|
||
static u_int32_t ks[12] = {0x01010101, 0x01010101, 0x01010101, 0x01010101, | ||
0x02020202, 0x02020202, 0x02020202, 0x02020202, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/* | ||
* Cryptographic API. | ||
* Cryptographic scatter and gather helpers. | ||
* | ||
* Copyright (c) 2002 James Morris <[email protected]> | ||
* Copyright (c) 2002 Adam J. Richter <[email protected]> | ||
* Copyright (c) 2004 Jean-Luc Cooke <[email protected]> | ||
* Copyright (c) 2007 Herbert Xu <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
|
@@ -15,10 +16,41 @@ | |
#ifndef _CRYPTO_SCATTERWALK_H | ||
#define _CRYPTO_SCATTERWALK_H | ||
|
||
#include <asm/kmap_types.h> | ||
#include <crypto/algapi.h> | ||
#include <linux/hardirq.h> | ||
#include <linux/highmem.h> | ||
#include <linux/kernel.h> | ||
#include <linux/mm.h> | ||
#include <linux/scatterlist.h> | ||
|
||
#include "internal.h" | ||
static inline enum km_type crypto_kmap_type(int out) | ||
{ | ||
enum km_type type; | ||
|
||
if (in_softirq()) | ||
type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0; | ||
else | ||
type = out * (KM_USER1 - KM_USER0) + KM_USER0; | ||
|
||
return type; | ||
} | ||
|
||
static inline void *crypto_kmap(struct page *page, int out) | ||
{ | ||
return kmap_atomic(page, crypto_kmap_type(out)); | ||
} | ||
|
||
static inline void crypto_kunmap(void *vaddr, int out) | ||
{ | ||
kunmap_atomic(vaddr, crypto_kmap_type(out)); | ||
} | ||
|
||
static inline void crypto_yield(u32 flags) | ||
{ | ||
if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) | ||
cond_resched(); | ||
} | ||
|
||
static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, | ||
struct scatter_walk *walk_out) | ||
|