Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
9f75e1ef
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9f75e1ef
编写于
10月 29, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
上级
b1459461
1b40efd7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
64 addition
and
113 deletion
+64
-113
crypto/api.c
crypto/api.c
+4
-1
crypto/hmac.c
crypto/hmac.c
+5
-14
crypto/tcrypt.c
crypto/tcrypt.c
+17
-39
drivers/md/dm-crypt.c
drivers/md/dm-crypt.c
+4
-8
drivers/net/wireless/airo.c
drivers/net/wireless/airo.c
+3
-4
drivers/scsi/arm/scsi.h
drivers/scsi/arm/scsi.h
+3
-3
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+2
-8
drivers/scsi/sg.c
drivers/scsi/sg.c
+2
-3
drivers/usb/misc/usbtest.c
drivers/usb/misc/usbtest.c
+2
-5
include/linux/scatterlist.h
include/linux/scatterlist.h
+13
-4
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+3
-7
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/gss_krb5_crypto.c
+6
-17
未找到文件。
crypto/api.c
浏览文件 @
9f75e1ef
...
...
@@ -215,7 +215,10 @@ int crypto_register_alg(struct crypto_alg *alg)
if
(
alg
->
cra_alignmask
&
(
alg
->
cra_alignmask
+
1
))
return
-
EINVAL
;
if
(
alg
->
cra_alignmask
>
PAGE_SIZE
)
if
(
alg
->
cra_alignmask
&
alg
->
cra_blocksize
)
return
-
EINVAL
;
if
(
alg
->
cra_blocksize
>
PAGE_SIZE
)
return
-
EINVAL
;
down_write
(
&
crypto_alg_sem
);
...
...
crypto/hmac.c
浏览文件 @
9f75e1ef
...
...
@@ -18,18 +18,15 @@
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/slab.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#include "internal.h"
static
void
hash_key
(
struct
crypto_tfm
*
tfm
,
u8
*
key
,
unsigned
int
keylen
)
{
struct
scatterlist
tmp
;
tmp
.
page
=
virt_to_page
(
key
);
tmp
.
offset
=
offset_in_page
(
key
);
tmp
.
length
=
keylen
;
sg_set_buf
(
&
tmp
,
key
,
keylen
);
crypto_digest_digest
(
tfm
,
&
tmp
,
1
,
key
);
}
int
crypto_alloc_hmac_block
(
struct
crypto_tfm
*
tfm
)
...
...
@@ -69,9 +66,7 @@ void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen)
for
(
i
=
0
;
i
<
crypto_tfm_alg_blocksize
(
tfm
);
i
++
)
ipad
[
i
]
^=
0x36
;
tmp
.
page
=
virt_to_page
(
ipad
);
tmp
.
offset
=
offset_in_page
(
ipad
);
tmp
.
length
=
crypto_tfm_alg_blocksize
(
tfm
);
sg_set_buf
(
&
tmp
,
ipad
,
crypto_tfm_alg_blocksize
(
tfm
));
crypto_digest_init
(
tfm
);
crypto_digest_update
(
tfm
,
&
tmp
,
1
);
...
...
@@ -103,16 +98,12 @@ void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
for
(
i
=
0
;
i
<
crypto_tfm_alg_blocksize
(
tfm
);
i
++
)
opad
[
i
]
^=
0x5c
;
tmp
.
page
=
virt_to_page
(
opad
);
tmp
.
offset
=
offset_in_page
(
opad
);
tmp
.
length
=
crypto_tfm_alg_blocksize
(
tfm
);
sg_set_buf
(
&
tmp
,
opad
,
crypto_tfm_alg_blocksize
(
tfm
));
crypto_digest_init
(
tfm
);
crypto_digest_update
(
tfm
,
&
tmp
,
1
);
tmp
.
page
=
virt_to_page
(
out
);
tmp
.
offset
=
offset_in_page
(
out
);
tmp
.
length
=
crypto_tfm_alg_digestsize
(
tfm
);
sg_set_buf
(
&
tmp
,
out
,
crypto_tfm_alg_digestsize
(
tfm
));
crypto_digest_update
(
tfm
,
&
tmp
,
1
);
crypto_digest_final
(
tfm
,
out
);
...
...
crypto/tcrypt.c
浏览文件 @
9f75e1ef
...
...
@@ -21,7 +21,7 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#include <linux/string.h>
#include <linux/crypto.h>
#include <linux/highmem.h>
...
...
@@ -86,7 +86,6 @@ static void hexdump(unsigned char *buf, unsigned int len)
static
void
test_hash
(
char
*
algo
,
struct
hash_testvec
*
template
,
unsigned
int
tcount
)
{
char
*
p
;
unsigned
int
i
,
j
,
k
,
temp
;
struct
scatterlist
sg
[
8
];
char
result
[
64
];
...
...
@@ -116,10 +115,7 @@ static void test_hash(char *algo, struct hash_testvec *template,
printk
(
"test %u:
\n
"
,
i
+
1
);
memset
(
result
,
0
,
64
);
p
=
hash_tv
[
i
].
plaintext
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
offset_in_page
(
p
);
sg
[
0
].
length
=
hash_tv
[
i
].
psize
;
sg_set_buf
(
&
sg
[
0
],
hash_tv
[
i
].
plaintext
,
hash_tv
[
i
].
psize
);
crypto_digest_init
(
tfm
);
if
(
tfm
->
crt_u
.
digest
.
dit_setkey
)
{
...
...
@@ -154,10 +150,8 @@ static void test_hash(char *algo, struct hash_testvec *template,
hash_tv
[
i
].
plaintext
+
temp
,
hash_tv
[
i
].
tap
[
k
]);
temp
+=
hash_tv
[
i
].
tap
[
k
];
p
=
&
xbuf
[
IDX
[
k
]];
sg
[
k
].
page
=
virt_to_page
(
p
);
sg
[
k
].
offset
=
offset_in_page
(
p
);
sg
[
k
].
length
=
hash_tv
[
i
].
tap
[
k
];
sg_set_buf
(
&
sg
[
k
],
&
xbuf
[
IDX
[
k
]],
hash_tv
[
i
].
tap
[
k
]);
}
crypto_digest_digest
(
tfm
,
sg
,
hash_tv
[
i
].
np
,
result
);
...
...
@@ -179,7 +173,6 @@ static void test_hash(char *algo, struct hash_testvec *template,
static
void
test_hmac
(
char
*
algo
,
struct
hmac_testvec
*
template
,
unsigned
int
tcount
)
{
char
*
p
;
unsigned
int
i
,
j
,
k
,
temp
;
struct
scatterlist
sg
[
8
];
char
result
[
64
];
...
...
@@ -210,11 +203,8 @@ static void test_hmac(char *algo, struct hmac_testvec *template,
printk
(
"test %u:
\n
"
,
i
+
1
);
memset
(
result
,
0
,
sizeof
(
result
));
p
=
hmac_tv
[
i
].
plaintext
;
klen
=
hmac_tv
[
i
].
ksize
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
offset_in_page
(
p
);
sg
[
0
].
length
=
hmac_tv
[
i
].
psize
;
sg_set_buf
(
&
sg
[
0
],
hmac_tv
[
i
].
plaintext
,
hmac_tv
[
i
].
psize
);
crypto_hmac
(
tfm
,
hmac_tv
[
i
].
key
,
&
klen
,
sg
,
1
,
result
);
...
...
@@ -243,10 +233,8 @@ static void test_hmac(char *algo, struct hmac_testvec *template,
hmac_tv
[
i
].
plaintext
+
temp
,
hmac_tv
[
i
].
tap
[
k
]);
temp
+=
hmac_tv
[
i
].
tap
[
k
];
p
=
&
xbuf
[
IDX
[
k
]];
sg
[
k
].
page
=
virt_to_page
(
p
);
sg
[
k
].
offset
=
offset_in_page
(
p
);
sg
[
k
].
length
=
hmac_tv
[
i
].
tap
[
k
];
sg_set_buf
(
&
sg
[
k
],
&
xbuf
[
IDX
[
k
]],
hmac_tv
[
i
].
tap
[
k
]);
}
crypto_hmac
(
tfm
,
hmac_tv
[
i
].
key
,
&
klen
,
sg
,
...
...
@@ -270,7 +258,7 @@ static void test_cipher(char *algo, int mode, int enc,
{
unsigned
int
ret
,
i
,
j
,
k
,
temp
;
unsigned
int
tsize
;
char
*
p
,
*
q
;
char
*
q
;
struct
crypto_tfm
*
tfm
;
char
*
key
;
struct
cipher_testvec
*
cipher_tv
;
...
...
@@ -330,10 +318,8 @@ static void test_cipher(char *algo, int mode, int enc,
goto
out
;
}
p
=
cipher_tv
[
i
].
input
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
offset_in_page
(
p
);
sg
[
0
].
length
=
cipher_tv
[
i
].
ilen
;
sg_set_buf
(
&
sg
[
0
],
cipher_tv
[
i
].
input
,
cipher_tv
[
i
].
ilen
);
if
(
!
mode
)
{
crypto_cipher_set_iv
(
tfm
,
cipher_tv
[
i
].
iv
,
...
...
@@ -389,10 +375,8 @@ static void test_cipher(char *algo, int mode, int enc,
cipher_tv
[
i
].
input
+
temp
,
cipher_tv
[
i
].
tap
[
k
]);
temp
+=
cipher_tv
[
i
].
tap
[
k
];
p
=
&
xbuf
[
IDX
[
k
]];
sg
[
k
].
page
=
virt_to_page
(
p
);
sg
[
k
].
offset
=
offset_in_page
(
p
);
sg
[
k
].
length
=
cipher_tv
[
i
].
tap
[
k
];
sg_set_buf
(
&
sg
[
k
],
&
xbuf
[
IDX
[
k
]],
cipher_tv
[
i
].
tap
[
k
]);
}
if
(
!
mode
)
{
...
...
@@ -431,14 +415,12 @@ static void test_cipher(char *algo, int mode, int enc,
static
int
test_cipher_jiffies
(
struct
crypto_tfm
*
tfm
,
int
enc
,
char
*
p
,
int
blen
,
int
sec
)
{
struct
scatterlist
sg
[
8
];
struct
scatterlist
sg
[
1
];
unsigned
long
start
,
end
;
int
bcount
;
int
ret
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
offset_in_page
(
p
);
sg
[
0
].
length
=
blen
;
sg_set_buf
(
sg
,
p
,
blen
);
for
(
start
=
jiffies
,
end
=
start
+
sec
*
HZ
,
bcount
=
0
;
time_before
(
jiffies
,
end
);
bcount
++
)
{
...
...
@@ -459,14 +441,12 @@ static int test_cipher_jiffies(struct crypto_tfm *tfm, int enc, char *p,
static
int
test_cipher_cycles
(
struct
crypto_tfm
*
tfm
,
int
enc
,
char
*
p
,
int
blen
)
{
struct
scatterlist
sg
[
8
];
struct
scatterlist
sg
[
1
];
unsigned
long
cycles
=
0
;
int
ret
=
0
;
int
i
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
offset_in_page
(
p
);
sg
[
0
].
length
=
blen
;
sg_set_buf
(
sg
,
p
,
blen
);
local_bh_disable
();
local_irq_disable
();
...
...
@@ -709,9 +689,7 @@ static void test_crc32c(void)
for
(
i
=
0
;
i
<
NUMVEC
;
i
++
)
{
for
(
j
=
0
;
j
<
VECSIZE
;
j
++
)
test_vec
[
i
][
j
]
=
++
b
;
sg
[
i
].
page
=
virt_to_page
(
test_vec
[
i
]);
sg
[
i
].
offset
=
offset_in_page
(
test_vec
[
i
]);
sg
[
i
].
length
=
VECSIZE
;
sg_set_buf
(
&
sg
[
i
],
test_vec
[
i
],
VECSIZE
);
}
seed
=
SEEDTESTVAL
;
...
...
drivers/md/dm-crypt.c
浏览文件 @
9f75e1ef
...
...
@@ -15,7 +15,7 @@
#include <linux/crypto.h>
#include <linux/workqueue.h>
#include <asm/atomic.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#include <asm/page.h>
#include "dm.h"
...
...
@@ -164,9 +164,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
return
-
ENOMEM
;
}
sg
.
page
=
virt_to_page
(
cc
->
key
);
sg
.
offset
=
offset_in_page
(
cc
->
key
);
sg
.
length
=
cc
->
key_size
;
sg_set_buf
(
&
sg
,
cc
->
key
,
cc
->
key_size
);
crypto_digest_digest
(
hash_tfm
,
&
sg
,
1
,
salt
);
crypto_free_tfm
(
hash_tfm
);
...
...
@@ -207,14 +205,12 @@ static void crypt_iv_essiv_dtr(struct crypt_config *cc)
static
int
crypt_iv_essiv_gen
(
struct
crypt_config
*
cc
,
u8
*
iv
,
sector_t
sector
)
{
struct
scatterlist
sg
=
{
NULL
,
}
;
struct
scatterlist
sg
;
memset
(
iv
,
0
,
cc
->
iv_size
);
*
(
u64
*
)
iv
=
cpu_to_le64
(
sector
);
sg
.
page
=
virt_to_page
(
iv
);
sg
.
offset
=
offset_in_page
(
iv
);
sg
.
length
=
cc
->
iv_size
;
sg_set_buf
(
&
sg
,
iv
,
cc
->
iv_size
);
crypto_cipher_encrypt
((
struct
crypto_tfm
*
)
cc
->
iv_gen_private
,
&
sg
,
&
sg
,
cc
->
iv_size
);
...
...
drivers/net/wireless/airo.c
浏览文件 @
9f75e1ef
...
...
@@ -35,6 +35,7 @@
#include <linux/interrupt.h>
#include <linux/in.h>
#include <linux/bitops.h>
#include <linux/scatterlist.h>
#include <asm/io.h>
#include <asm/system.h>
...
...
@@ -1590,11 +1591,9 @@ static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct
aes_counter
[
12
]
=
(
u8
)(
counter
>>
24
);
counter
++
;
memcpy
(
plain
,
aes_counter
,
16
);
sg
[
0
].
page
=
virt_to_page
(
plain
);
sg
[
0
].
offset
=
((
long
)
plain
&
~
PAGE_MASK
);
sg
[
0
].
length
=
16
;
sg_set_buf
(
sg
,
plain
,
16
);
crypto_cipher_encrypt
(
tfm
,
sg
,
sg
,
16
);
cipher
=
kmap
(
sg
[
0
].
page
)
+
sg
[
0
].
offset
;
cipher
=
kmap
(
sg
->
page
)
+
sg
->
offset
;
for
(
j
=
0
;
(
j
<
16
)
&&
(
i
<
(
sizeof
(
context
->
coeff
)
/
sizeof
(
context
->
coeff
[
0
])));
)
{
context
->
coeff
[
i
++
]
=
ntohl
(
*
(
u32
*
)
&
cipher
[
j
]);
j
+=
4
;
...
...
drivers/scsi/arm/scsi.h
浏览文件 @
9f75e1ef
...
...
@@ -10,6 +10,8 @@
* Commonly used scsi driver functions.
*/
#include <linux/scatterlist.h>
#define BELT_AND_BRACES
/*
...
...
@@ -22,9 +24,7 @@ static inline int copy_SCp_to_sg(struct scatterlist *sg, Scsi_Pointer *SCp, int
BUG_ON
(
bufs
+
1
>
max
);
sg
->
page
=
virt_to_page
(
SCp
->
ptr
);
sg
->
offset
=
offset_in_page
(
SCp
->
ptr
);
sg
->
length
=
SCp
->
this_residual
;
sg_set_buf
(
sg
,
SCp
->
ptr
,
SCp
->
this_residual
);
if
(
bufs
)
memcpy
(
sg
+
1
,
SCp
->
buffer
+
1
,
...
...
drivers/scsi/libata-core.c
浏览文件 @
9f75e1ef
...
...
@@ -49,6 +49,7 @@
#include <linux/suspend.h>
#include <linux/workqueue.h>
#include <linux/jiffies.h>
#include <linux/scatterlist.h>
#include <scsi/scsi.h>
#include "scsi.h"
#include "scsi_priv.h"
...
...
@@ -2576,19 +2577,12 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
void
ata_sg_init_one
(
struct
ata_queued_cmd
*
qc
,
void
*
buf
,
unsigned
int
buflen
)
{
struct
scatterlist
*
sg
;
qc
->
flags
|=
ATA_QCFLAG_SINGLE
;
memset
(
&
qc
->
sgent
,
0
,
sizeof
(
qc
->
sgent
));
qc
->
sg
=
&
qc
->
sgent
;
qc
->
n_elem
=
1
;
qc
->
buf_virt
=
buf
;
sg
=
qc
->
sg
;
sg
->
page
=
virt_to_page
(
buf
);
sg
->
offset
=
(
unsigned
long
)
buf
&
~
PAGE_MASK
;
sg
->
length
=
buflen
;
sg_init_one
(
qc
->
sg
,
buf
,
buflen
);
}
/**
...
...
drivers/scsi/sg.c
浏览文件 @
9f75e1ef
...
...
@@ -49,6 +49,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
#include <linux/seq_file.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/scatterlist.h>
#include "scsi.h"
#include <scsi/scsi_dbg.h>
...
...
@@ -1996,9 +1997,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
if
(
!
p
)
break
;
}
sclp
->
page
=
virt_to_page
(
p
);
sclp
->
offset
=
offset_in_page
(
p
);
sclp
->
length
=
ret_sz
;
sg_set_buf
(
sclp
,
p
,
ret_sz
);
SCSI_LOG_TIMEOUT
(
5
,
printk
(
"sg_build_build: k=%d, a=0x%p, len=%d
\n
"
,
k
,
sg_scatg2virt
(
sclp
),
ret_sz
));
...
...
drivers/usb/misc/usbtest.c
浏览文件 @
9f75e1ef
...
...
@@ -9,7 +9,7 @@
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#include <linux/usb.h>
...
...
@@ -381,7 +381,6 @@ alloc_sglist (int nents, int max, int vary)
sg
=
kmalloc
(
nents
*
sizeof
*
sg
,
SLAB_KERNEL
);
if
(
!
sg
)
return
NULL
;
memset
(
sg
,
0
,
nents
*
sizeof
*
sg
);
for
(
i
=
0
;
i
<
nents
;
i
++
)
{
char
*
buf
;
...
...
@@ -394,9 +393,7 @@ alloc_sglist (int nents, int max, int vary)
memset
(
buf
,
0
,
size
);
/* kmalloc pages are always physically contiguous! */
sg
[
i
].
page
=
virt_to_page
(
buf
);
sg
[
i
].
offset
=
offset_in_page
(
buf
);
sg
[
i
].
length
=
size
;
sg_init_one
(
&
sg
[
i
],
buf
,
size
);
if
(
vary
)
{
size
+=
vary
;
...
...
include/linux/scatterlist.h
浏览文件 @
9f75e1ef
#ifndef _LINUX_SCATTERLIST_H
#define _LINUX_SCATTERLIST_H
static
inline
void
sg_init_one
(
struct
scatterlist
*
sg
,
u8
*
buf
,
unsigned
int
buflen
)
{
memset
(
sg
,
0
,
sizeof
(
*
sg
));
#include <asm/scatterlist.h>
#include <linux/mm.h>
#include <linux/string.h>
static
inline
void
sg_set_buf
(
struct
scatterlist
*
sg
,
void
*
buf
,
unsigned
int
buflen
)
{
sg
->
page
=
virt_to_page
(
buf
);
sg
->
offset
=
offset_in_page
(
buf
);
sg
->
length
=
buflen
;
}
static
inline
void
sg_init_one
(
struct
scatterlist
*
sg
,
void
*
buf
,
unsigned
int
buflen
)
{
memset
(
sg
,
0
,
sizeof
(
*
sg
));
sg_set_buf
(
sg
,
buf
,
buflen
);
}
#endif
/* _LINUX_SCATTERLIST_H */
net/ipv6/addrconf.c
浏览文件 @
9f75e1ef
...
...
@@ -75,7 +75,7 @@
#ifdef CONFIG_IPV6_PRIVACY
#include <linux/random.h>
#include <linux/crypto.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#endif
#include <asm/uaccess.h>
...
...
@@ -1217,12 +1217,8 @@ static int __ipv6_regen_rndid(struct inet6_dev *idev)
struct
net_device
*
dev
;
struct
scatterlist
sg
[
2
];
sg
[
0
].
page
=
virt_to_page
(
idev
->
entropy
);
sg
[
0
].
offset
=
offset_in_page
(
idev
->
entropy
);
sg
[
0
].
length
=
8
;
sg
[
1
].
page
=
virt_to_page
(
idev
->
work_eui64
);
sg
[
1
].
offset
=
offset_in_page
(
idev
->
work_eui64
);
sg
[
1
].
length
=
8
;
sg_set_buf
(
&
sg
[
0
],
idev
->
entropy
,
8
);
sg_set_buf
(
&
sg
[
1
],
idev
->
work_eui64
,
8
);
dev
=
idev
->
dev
;
...
...
net/sunrpc/auth_gss/gss_krb5_crypto.c
浏览文件 @
9f75e1ef
...
...
@@ -37,7 +37,7 @@
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <
asm
/scatterlist.h>
#include <
linux
/scatterlist.h>
#include <linux/crypto.h>
#include <linux/highmem.h>
#include <linux/pagemap.h>
...
...
@@ -75,9 +75,7 @@ krb5_encrypt(
memcpy
(
local_iv
,
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
memcpy
(
out
,
in
,
length
);
sg
[
0
].
page
=
virt_to_page
(
out
);
sg
[
0
].
offset
=
offset_in_page
(
out
);
sg
[
0
].
length
=
length
;
sg_set_buf
(
sg
,
out
,
length
);
ret
=
crypto_cipher_encrypt_iv
(
tfm
,
sg
,
sg
,
length
,
local_iv
);
...
...
@@ -117,9 +115,7 @@ krb5_decrypt(
memcpy
(
local_iv
,
iv
,
crypto_tfm_alg_ivsize
(
tfm
));
memcpy
(
out
,
in
,
length
);
sg
[
0
].
page
=
virt_to_page
(
out
);
sg
[
0
].
offset
=
offset_in_page
(
out
);
sg
[
0
].
length
=
length
;
sg_set_buf
(
sg
,
out
,
length
);
ret
=
crypto_cipher_decrypt_iv
(
tfm
,
sg
,
sg
,
length
,
local_iv
);
...
...
@@ -132,13 +128,6 @@ krb5_decrypt(
EXPORT_SYMBOL
(
krb5_decrypt
);
static
void
buf_to_sg
(
struct
scatterlist
*
sg
,
char
*
ptr
,
int
len
)
{
sg
->
page
=
virt_to_page
(
ptr
);
sg
->
offset
=
offset_in_page
(
ptr
);
sg
->
length
=
len
;
}
static
int
process_xdr_buf
(
struct
xdr_buf
*
buf
,
int
offset
,
int
len
,
int
(
*
actor
)(
struct
scatterlist
*
,
void
*
),
void
*
data
)
...
...
@@ -152,7 +141,7 @@ process_xdr_buf(struct xdr_buf *buf, int offset, int len,
thislen
=
buf
->
head
[
0
].
iov_len
-
offset
;
if
(
thislen
>
len
)
thislen
=
len
;
buf_to_sg
(
sg
,
buf
->
head
[
0
].
iov_base
+
offset
,
thislen
);
sg_set_buf
(
sg
,
buf
->
head
[
0
].
iov_base
+
offset
,
thislen
);
ret
=
actor
(
sg
,
data
);
if
(
ret
)
goto
out
;
...
...
@@ -195,7 +184,7 @@ process_xdr_buf(struct xdr_buf *buf, int offset, int len,
thislen
=
buf
->
tail
[
0
].
iov_len
-
offset
;
if
(
thislen
>
len
)
thislen
=
len
;
buf_to_sg
(
sg
,
buf
->
tail
[
0
].
iov_base
+
offset
,
thislen
);
sg_set_buf
(
sg
,
buf
->
tail
[
0
].
iov_base
+
offset
,
thislen
);
ret
=
actor
(
sg
,
data
);
len
-=
thislen
;
}
...
...
@@ -241,7 +230,7 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
goto
out
;
crypto_digest_init
(
tfm
);
buf_to_sg
(
sg
,
header
,
hdrlen
);
sg_set_buf
(
sg
,
header
,
hdrlen
);
crypto_digest_update
(
tfm
,
sg
,
1
);
process_xdr_buf
(
body
,
body_offset
,
body
->
len
-
body_offset
,
checksummer
,
tfm
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录