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
Kirill Smelkov
linux
Commits
479d014d
Commit
479d014d
authored
Nov 30, 2016
by
Herbert Xu
Browse files
Options
Browse Files
Download
Plain Diff
Merge
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge the crypto tree to pull in chelsio chcr fix.
parents
585b5fa6
57891633
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
17 deletions
+48
-17
crypto/Makefile
crypto/Makefile
+1
-0
crypto/algif_hash.c
crypto/algif_hash.c
+10
-7
crypto/drbg.c
crypto/drbg.c
+24
-5
crypto/scatterwalk.c
crypto/scatterwalk.c
+0
-4
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamalg.c
+9
-0
drivers/crypto/chelsio/chcr_algo.h
drivers/crypto/chelsio/chcr_algo.h
+2
-1
include/crypto/drbg.h
include/crypto/drbg.h
+2
-0
No files found.
crypto/Makefile
View file @
479d014d
...
@@ -40,6 +40,7 @@ obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o
...
@@ -40,6 +40,7 @@ obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o
$(obj)/rsapubkey-asn1.o
:
$(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h
$(obj)/rsapubkey-asn1.o
:
$(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h
$(obj)/rsaprivkey-asn1.o
:
$(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h
$(obj)/rsaprivkey-asn1.o
:
$(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h
$(obj)/rsa_helper.o
:
$(obj)/rsapubkey-asn1.h $(obj)/rsaprivkey-asn1.h
clean-files
+=
rsapubkey-asn1.c rsapubkey-asn1.h
clean-files
+=
rsapubkey-asn1.c rsapubkey-asn1.h
clean-files
+=
rsaprivkey-asn1.c rsaprivkey-asn1.h
clean-files
+=
rsaprivkey-asn1.c rsaprivkey-asn1.h
...
...
crypto/algif_hash.c
View file @
479d014d
...
@@ -214,23 +214,26 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
...
@@ -214,23 +214,26 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
ahash_request_set_crypt
(
&
ctx
->
req
,
NULL
,
ctx
->
result
,
0
);
ahash_request_set_crypt
(
&
ctx
->
req
,
NULL
,
ctx
->
result
,
0
);
if
(
ctx
->
more
)
{
if
(
!
result
&&
!
ctx
->
more
)
{
err
=
af_alg_wait_for_completion
(
crypto_ahash_init
(
&
ctx
->
req
),
&
ctx
->
completion
);
if
(
err
)
goto
unlock
;
}
if
(
!
result
||
ctx
->
more
)
{
ctx
->
more
=
0
;
ctx
->
more
=
0
;
err
=
af_alg_wait_for_completion
(
crypto_ahash_final
(
&
ctx
->
req
),
err
=
af_alg_wait_for_completion
(
crypto_ahash_final
(
&
ctx
->
req
),
&
ctx
->
completion
);
&
ctx
->
completion
);
if
(
err
)
if
(
err
)
goto
unlock
;
goto
unlock
;
}
else
if
(
!
result
)
{
err
=
af_alg_wait_for_completion
(
crypto_ahash_digest
(
&
ctx
->
req
),
&
ctx
->
completion
);
}
}
err
=
memcpy_to_msg
(
msg
,
ctx
->
result
,
len
);
err
=
memcpy_to_msg
(
msg
,
ctx
->
result
,
len
);
hash_free_result
(
sk
,
ctx
);
unlock:
unlock:
hash_free_result
(
sk
,
ctx
);
release_sock
(
sk
);
release_sock
(
sk
);
return
err
?:
len
;
return
err
?:
len
;
...
...
crypto/drbg.c
View file @
479d014d
...
@@ -262,6 +262,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
...
@@ -262,6 +262,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
u8
*
inbuf
,
u32
inbuflen
,
u8
*
inbuf
,
u32
inbuflen
,
u8
*
outbuf
,
u32
outlen
);
u8
*
outbuf
,
u32
outlen
);
#define DRBG_CTR_NULL_LEN 128
#define DRBG_CTR_NULL_LEN 128
#define DRBG_OUTSCRATCHLEN DRBG_CTR_NULL_LEN
/* BCC function for CTR DRBG as defined in 10.4.3 */
/* BCC function for CTR DRBG as defined in 10.4.3 */
static
int
drbg_ctr_bcc
(
struct
drbg_state
*
drbg
,
static
int
drbg_ctr_bcc
(
struct
drbg_state
*
drbg
,
...
@@ -1644,6 +1645,9 @@ static int drbg_fini_sym_kernel(struct drbg_state *drbg)
...
@@ -1644,6 +1645,9 @@ static int drbg_fini_sym_kernel(struct drbg_state *drbg)
kfree
(
drbg
->
ctr_null_value_buf
);
kfree
(
drbg
->
ctr_null_value_buf
);
drbg
->
ctr_null_value
=
NULL
;
drbg
->
ctr_null_value
=
NULL
;
kfree
(
drbg
->
outscratchpadbuf
);
drbg
->
outscratchpadbuf
=
NULL
;
return
0
;
return
0
;
}
}
...
@@ -1708,6 +1712,15 @@ static int drbg_init_sym_kernel(struct drbg_state *drbg)
...
@@ -1708,6 +1712,15 @@ static int drbg_init_sym_kernel(struct drbg_state *drbg)
drbg
->
ctr_null_value
=
(
u8
*
)
PTR_ALIGN
(
drbg
->
ctr_null_value_buf
,
drbg
->
ctr_null_value
=
(
u8
*
)
PTR_ALIGN
(
drbg
->
ctr_null_value_buf
,
alignmask
+
1
);
alignmask
+
1
);
drbg
->
outscratchpadbuf
=
kmalloc
(
DRBG_OUTSCRATCHLEN
+
alignmask
,
GFP_KERNEL
);
if
(
!
drbg
->
outscratchpadbuf
)
{
drbg_fini_sym_kernel
(
drbg
);
return
-
ENOMEM
;
}
drbg
->
outscratchpad
=
(
u8
*
)
PTR_ALIGN
(
drbg
->
outscratchpadbuf
,
alignmask
+
1
);
return
alignmask
;
return
alignmask
;
}
}
...
@@ -1737,15 +1750,16 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
...
@@ -1737,15 +1750,16 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
u8
*
outbuf
,
u32
outlen
)
u8
*
outbuf
,
u32
outlen
)
{
{
struct
scatterlist
sg_in
;
struct
scatterlist
sg_in
;
int
ret
;
sg_init_one
(
&
sg_in
,
inbuf
,
inlen
);
sg_init_one
(
&
sg_in
,
inbuf
,
inlen
);
while
(
outlen
)
{
while
(
outlen
)
{
u32
cryptlen
=
min
_t
(
u32
,
inlen
,
outlen
);
u32
cryptlen
=
min
3
(
inlen
,
outlen
,
(
u32
)
DRBG_OUTSCRATCHLEN
);
struct
scatterlist
sg_out
;
struct
scatterlist
sg_out
;
int
ret
;
sg_init_one
(
&
sg_out
,
outbuf
,
cryptlen
);
/* Output buffer may not be valid for SGL, use scratchpad */
sg_init_one
(
&
sg_out
,
drbg
->
outscratchpad
,
cryptlen
);
skcipher_request_set_crypt
(
drbg
->
ctr_req
,
&
sg_in
,
&
sg_out
,
skcipher_request_set_crypt
(
drbg
->
ctr_req
,
&
sg_in
,
&
sg_out
,
cryptlen
,
drbg
->
V
);
cryptlen
,
drbg
->
V
);
ret
=
crypto_skcipher_encrypt
(
drbg
->
ctr_req
);
ret
=
crypto_skcipher_encrypt
(
drbg
->
ctr_req
);
...
@@ -1761,15 +1775,20 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
...
@@ -1761,15 +1775,20 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
break
;
break
;
}
}
default:
default:
return
re
t
;
goto
ou
t
;
}
}
init_completion
(
&
drbg
->
ctr_completion
);
init_completion
(
&
drbg
->
ctr_completion
);
memcpy
(
outbuf
,
drbg
->
outscratchpad
,
cryptlen
);
outlen
-=
cryptlen
;
outlen
-=
cryptlen
;
outbuf
+=
cryptlen
;
outbuf
+=
cryptlen
;
}
}
ret
=
0
;
return
0
;
out:
memzero_explicit
(
drbg
->
outscratchpad
,
DRBG_OUTSCRATCHLEN
);
return
ret
;
}
}
#endif
/* CONFIG_CRYPTO_DRBG_CTR */
#endif
/* CONFIG_CRYPTO_DRBG_CTR */
...
...
crypto/scatterwalk.c
View file @
479d014d
...
@@ -68,10 +68,6 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
...
@@ -68,10 +68,6 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
sg
=
scatterwalk_ffwd
(
tmp
,
sg
,
start
);
sg
=
scatterwalk_ffwd
(
tmp
,
sg
,
start
);
if
(
sg_page
(
sg
)
==
virt_to_page
(
buf
)
&&
sg
->
offset
==
offset_in_page
(
buf
))
return
;
scatterwalk_start
(
&
walk
,
sg
);
scatterwalk_start
(
&
walk
,
sg
);
scatterwalk_copychunks
(
buf
,
&
walk
,
nbytes
,
out
);
scatterwalk_copychunks
(
buf
,
&
walk
,
nbytes
,
out
);
scatterwalk_done
(
&
walk
,
out
,
0
);
scatterwalk_done
(
&
walk
,
out
,
0
);
...
...
drivers/crypto/caam/caamalg.c
View file @
479d014d
...
@@ -3568,6 +3568,15 @@ static int __init caam_algapi_init(void)
...
@@ -3568,6 +3568,15 @@ static int __init caam_algapi_init(void)
if
(
!
aes_inst
&&
(
alg_sel
==
OP_ALG_ALGSEL_AES
))
if
(
!
aes_inst
&&
(
alg_sel
==
OP_ALG_ALGSEL_AES
))
continue
;
continue
;
/*
* Check support for AES modes not available
* on LP devices.
*/
if
((
cha_vid
&
CHA_ID_LS_AES_MASK
)
==
CHA_ID_LS_AES_LP
)
if
((
alg
->
class1_alg_type
&
OP_ALG_AAI_MASK
)
==
OP_ALG_AAI_XTS
)
continue
;
t_alg
=
caam_alg_alloc
(
alg
);
t_alg
=
caam_alg_alloc
(
alg
);
if
(
IS_ERR
(
t_alg
))
{
if
(
IS_ERR
(
t_alg
))
{
err
=
PTR_ERR
(
t_alg
);
err
=
PTR_ERR
(
t_alg
);
...
...
drivers/crypto/chelsio/chcr_algo.h
View file @
479d014d
...
@@ -422,7 +422,7 @@ static inline void get_aes_decrypt_key(unsigned char *dec_key,
...
@@ -422,7 +422,7 @@ static inline void get_aes_decrypt_key(unsigned char *dec_key,
{
{
u32
temp
;
u32
temp
;
u32
w_ring
[
MAX_NK
];
u32
w_ring
[
MAX_NK
];
int
i
,
j
,
k
=
0
;
int
i
,
j
,
k
;
u8
nr
,
nk
;
u8
nr
,
nk
;
switch
(
keylength
)
{
switch
(
keylength
)
{
...
@@ -460,6 +460,7 @@ static inline void get_aes_decrypt_key(unsigned char *dec_key,
...
@@ -460,6 +460,7 @@ static inline void get_aes_decrypt_key(unsigned char *dec_key,
temp
=
w_ring
[
i
%
nk
];
temp
=
w_ring
[
i
%
nk
];
i
++
;
i
++
;
}
}
i
--
;
for
(
k
=
0
,
j
=
i
%
nk
;
k
<
nk
;
k
++
)
{
for
(
k
=
0
,
j
=
i
%
nk
;
k
<
nk
;
k
++
)
{
*
((
u32
*
)
dec_key
+
k
)
=
htonl
(
w_ring
[
j
]);
*
((
u32
*
)
dec_key
+
k
)
=
htonl
(
w_ring
[
j
]);
j
--
;
j
--
;
...
...
include/crypto/drbg.h
View file @
479d014d
...
@@ -124,6 +124,8 @@ struct drbg_state {
...
@@ -124,6 +124,8 @@ struct drbg_state {
struct
skcipher_request
*
ctr_req
;
/* CTR mode request handle */
struct
skcipher_request
*
ctr_req
;
/* CTR mode request handle */
__u8
*
ctr_null_value_buf
;
/* CTR mode unaligned buffer */
__u8
*
ctr_null_value_buf
;
/* CTR mode unaligned buffer */
__u8
*
ctr_null_value
;
/* CTR mode aligned zero buf */
__u8
*
ctr_null_value
;
/* CTR mode aligned zero buf */
__u8
*
outscratchpadbuf
;
/* CTR mode output scratchpad */
__u8
*
outscratchpad
;
/* CTR mode aligned outbuf */
struct
completion
ctr_completion
;
/* CTR mode async handler */
struct
completion
ctr_completion
;
/* CTR mode async handler */
int
ctr_async_err
;
/* CTR mode async error */
int
ctr_async_err
;
/* CTR mode async error */
...
...
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