Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3ba6853f
Commit
3ba6853f
authored
Oct 27, 2002
by
James Morris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CRYPTO]: Assert that interfaces are called on correct cipher type.
parent
b4021a7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
include/linux/crypto.h
include/linux/crypto.h
+11
-0
No files found.
include/linux/crypto.h
View file @
3ba6853f
...
...
@@ -221,17 +221,20 @@ static inline size_t crypto_tfm_alg_digestsize(struct crypto_tfm *tfm)
*/
static
inline
void
crypto_digest_init
(
struct
crypto_tfm
*
tfm
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_DIGEST
);
tfm
->
crt_digest
.
dit_init
(
tfm
);
}
static
inline
void
crypto_digest_update
(
struct
crypto_tfm
*
tfm
,
struct
scatterlist
*
sg
,
size_t
nsg
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_DIGEST
);
tfm
->
crt_digest
.
dit_update
(
tfm
,
sg
,
nsg
);
}
static
inline
void
crypto_digest_final
(
struct
crypto_tfm
*
tfm
,
u8
*
out
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_DIGEST
);
tfm
->
crt_digest
.
dit_final
(
tfm
,
out
);
}
...
...
@@ -239,6 +242,7 @@ static inline void crypto_digest_digest(struct crypto_tfm *tfm,
struct
scatterlist
*
sg
,
size_t
nsg
,
u8
*
out
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_DIGEST
);
tfm
->
crt_digest
.
dit_digest
(
tfm
,
sg
,
nsg
,
out
);
}
...
...
@@ -247,40 +251,47 @@ static inline void crypto_digest_hmac(struct crypto_tfm *tfm, u8 *key,
size_t
nsg
,
u8
*
out
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_DIGEST
);
tfm
->
crt_digest
.
dit_hmac
(
tfm
,
key
,
keylen
,
sg
,
nsg
,
out
);
}
static
inline
int
crypto_cipher_setkey
(
struct
crypto_tfm
*
tfm
,
const
u8
*
key
,
size_t
keylen
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
return
tfm
->
crt_cipher
.
cit_setkey
(
tfm
,
key
,
keylen
);
}
static
inline
int
crypto_cipher_encrypt
(
struct
crypto_tfm
*
tfm
,
struct
scatterlist
*
sg
,
size_t
nsg
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
return
tfm
->
crt_cipher
.
cit_encrypt
(
tfm
,
sg
,
nsg
);
}
static
inline
int
crypto_cipher_decrypt
(
struct
crypto_tfm
*
tfm
,
struct
scatterlist
*
sg
,
size_t
nsg
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
return
tfm
->
crt_cipher
.
cit_decrypt
(
tfm
,
sg
,
nsg
);
}
static
inline
void
crypto_cipher_copy_iv
(
struct
crypto_tfm
*
tfm
,
u8
*
src
,
size_t
len
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_CIPHER
);
memcpy
(
tfm
->
crt_cipher
.
cit_iv
,
src
,
len
);
}
static
inline
void
crypto_comp_compress
(
struct
crypto_tfm
*
tfm
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_COMP
);
tfm
->
crt_compress
.
cot_compress
(
tfm
);
}
static
inline
void
crypto_comp_decompress
(
struct
crypto_tfm
*
tfm
)
{
BUG_ON
(
crypto_tfm_alg_type
(
tfm
)
!=
CRYPTO_ALG_TYPE_COMP
);
tfm
->
crt_compress
.
cot_decompress
(
tfm
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment