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
8e5db3dc
Commit
8e5db3dc
authored
Aug 15, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/davem/sparc-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
a6ac2f91
a2b36723
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1090 additions
and
320 deletions
+1090
-320
Documentation/crypto/api-intro.txt
Documentation/crypto/api-intro.txt
+1
-1
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+1
-1
arch/ppc/syslib/of_device.c
arch/ppc/syslib/of_device.c
+0
-2
crypto/Kconfig
crypto/Kconfig
+7
-0
crypto/Makefile
crypto/Makefile
+1
-0
crypto/cast6.c
crypto/cast6.c
+563
-0
crypto/tcrypt.c
crypto/tcrypt.c
+107
-2
crypto/tcrypt.h
crypto/tcrypt.h
+87
-0
drivers/ieee1394/nodemgr.c
drivers/ieee1394/nodemgr.c
+0
-34
drivers/ieee1394/pcilynx.c
drivers/ieee1394/pcilynx.c
+1
-3
drivers/macintosh/macio_asic.c
drivers/macintosh/macio_asic.c
+0
-3
drivers/net/irda/irtty.c
drivers/net/irda/irtty.c
+18
-57
drivers/net/tokenring/ibmtr.c
drivers/net/tokenring/ibmtr.c
+11
-9
drivers/scsi/ide-scsi.c
drivers/scsi/ide-scsi.c
+0
-1
include/linux/netdevice.h
include/linux/netdevice.h
+0
-3
include/linux/pci_ids.h
include/linux/pci_ids.h
+48
-34
include/linux/pfkeyv2.h
include/linux/pfkeyv2.h
+4
-1
include/net/irda/irda_device.h
include/net/irda/irda_device.h
+2
-2
include/net/irda/irlap.h
include/net/irda/irlap.h
+1
-3
include/net/irda/irtty.h
include/net/irda/irtty.h
+0
-2
net/core/dev.c
net/core/dev.c
+32
-40
net/core/net-sysfs.c
net/core/net-sysfs.c
+162
-112
net/ipv6/route.c
net/ipv6/route.c
+6
-3
net/irda/irda_device.c
net/irda/irda_device.c
+1
-4
net/irda/irlap.c
net/irda/irlap.c
+2
-2
net/sctp/Kconfig
net/sctp/Kconfig
+1
-1
net/xfrm/xfrm_algo.c
net/xfrm/xfrm_algo.c
+34
-0
No files found.
Documentation/crypto/api-intro.txt
View file @
8e5db3dc
...
...
@@ -213,7 +213,7 @@ AES algorithm contributors:
Kyle McMartin
Adam J. Richter
CAST5 algorithm contributors:
CAST5
/CAST6
algorithm contributors:
Kartikey Mahendra Bhatt (original developers unknown, FSF copyright).
Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
...
...
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
View file @
8e5db3dc
...
...
@@ -230,8 +230,8 @@ static void change_speed (unsigned int index)
freqs
.
cpu
=
0
;
cfid
=
fidvidstatus
.
bits
.
CFID
;
rdmsrl
(
MSR_K7_FID_VID_STATUS
,
fidvidstatus
.
val
);
cfid
=
fidvidstatus
.
bits
.
CFID
;
freqs
.
old
=
fsb
*
fid_codes
[
cfid
]
*
100
;
freqs
.
new
=
powernow_table
[
index
].
frequency
;
...
...
arch/ppc/syslib/of_device.c
View file @
8e5db3dc
...
...
@@ -227,8 +227,6 @@ of_platform_device_create(struct device_node *np, const char *bus_id)
dev
->
dev
.
parent
=
NULL
;
dev
->
dev
.
bus
=
&
of_platform_bus_type
;
/* XXX Make something better here ? */
snprintf
(
dev
->
dev
.
name
,
DEVICE_NAME_SIZE
,
"Platform device %s"
,
np
->
name
);
reg
=
(
u32
*
)
get_property
(
np
,
"reg"
,
NULL
);
strlcpy
(
dev
->
dev
.
bus_id
,
bus_id
,
BUS_ID_SIZE
);
...
...
crypto/Kconfig
View file @
8e5db3dc
...
...
@@ -133,6 +133,13 @@ config CRYPTO_CAST5
The CAST5 encryption algorithm (synonymous with CAST-128) is
described in RFC2144.
config CRYPTO_CAST6
tristate "CAST6 (CAST-256) cipher algorithm"
depends on CRYPTO
help
The CAST6 encryption algorithm (synonymous with CAST-256) is
described in RFC2612.
config CRYPTO_DEFLATE
tristate "Deflate compression algorithm"
depends on CRYPTO
...
...
crypto/Makefile
View file @
8e5db3dc
...
...
@@ -21,6 +21,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o
obj-$(CONFIG_CRYPTO_SERPENT)
+=
serpent.o
obj-$(CONFIG_CRYPTO_AES)
+=
aes.o
obj-$(CONFIG_CRYPTO_CAST5)
+=
cast5.o
obj-$(CONFIG_CRYPTO_CAST6)
+=
cast6.o
obj-$(CONFIG_CRYPTO_DEFLATE)
+=
deflate.o
obj-$(CONFIG_CRYPTO_TEST)
+=
tcrypt.o
crypto/cast6.c
0 → 100644
View file @
8e5db3dc
/* Kernel cryptographic api.
* cast6.c - Cast6 cipher algorithm [rfc2612].
*
* CAST-256 (*cast6*) is a DES like Substitution-Permutation Network (SPN)
* cryptosystem built upon the CAST-128 (*cast5*) [rfc2144] encryption
* algorithm.
*
* Copyright (C) 2003 Kartikey Mahendra Bhatt <kartik_me@hotmail.com>.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <linux/init.h>
#include <linux/crypto.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/string.h>
#define CAST6_BLOCK_SIZE 16
#define CAST6_MIN_KEY_SIZE 16
#define CAST6_MAX_KEY_SIZE 32
struct
cast6_ctx
{
u32
Km
[
12
][
4
];
u8
Kr
[
12
][
4
];
};
#define rol(n,x) ( ((x) << (n)) | ((x) >> (32-(n))) )
#define F1(D,r,m) ( (I = ((m) + (D))), (I=rol((r),I)), \
(((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]) )
#define F2(D,r,m) ( (I = ((m) ^ (D))), (I=rol((r),I)), \
(((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]) )
#define F3(D,r,m) ( (I = ((m) - (D))), (I=rol((r),I)), \
(((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]) )
static
const
u32
s1
[
256
]
=
{
0x30fb40d4
,
0x9fa0ff0b
,
0x6beccd2f
,
0x3f258c7a
,
0x1e213f2f
,
0x9c004dd3
,
0x6003e540
,
0xcf9fc949
,
0xbfd4af27
,
0x88bbbdb5
,
0xe2034090
,
0x98d09675
,
0x6e63a0e0
,
0x15c361d2
,
0xc2e7661d
,
0x22d4ff8e
,
0x28683b6f
,
0xc07fd059
,
0xff2379c8
,
0x775f50e2
,
0x43c340d3
,
0xdf2f8656
,
0x887ca41a
,
0xa2d2bd2d
,
0xa1c9e0d6
,
0x346c4819
,
0x61b76d87
,
0x22540f2f
,
0x2abe32e1
,
0xaa54166b
,
0x22568e3a
,
0xa2d341d0
,
0x66db40c8
,
0xa784392f
,
0x004dff2f
,
0x2db9d2de
,
0x97943fac
,
0x4a97c1d8
,
0x527644b7
,
0xb5f437a7
,
0xb82cbaef
,
0xd751d159
,
0x6ff7f0ed
,
0x5a097a1f
,
0x827b68d0
,
0x90ecf52e
,
0x22b0c054
,
0xbc8e5935
,
0x4b6d2f7f
,
0x50bb64a2
,
0xd2664910
,
0xbee5812d
,
0xb7332290
,
0xe93b159f
,
0xb48ee411
,
0x4bff345d
,
0xfd45c240
,
0xad31973f
,
0xc4f6d02e
,
0x55fc8165
,
0xd5b1caad
,
0xa1ac2dae
,
0xa2d4b76d
,
0xc19b0c50
,
0x882240f2
,
0x0c6e4f38
,
0xa4e4bfd7
,
0x4f5ba272
,
0x564c1d2f
,
0xc59c5319
,
0xb949e354
,
0xb04669fe
,
0xb1b6ab8a
,
0xc71358dd
,
0x6385c545
,
0x110f935d
,
0x57538ad5
,
0x6a390493
,
0xe63d37e0
,
0x2a54f6b3
,
0x3a787d5f
,
0x6276a0b5
,
0x19a6fcdf
,
0x7a42206a
,
0x29f9d4d5
,
0xf61b1891
,
0xbb72275e
,
0xaa508167
,
0x38901091
,
0xc6b505eb
,
0x84c7cb8c
,
0x2ad75a0f
,
0x874a1427
,
0xa2d1936b
,
0x2ad286af
,
0xaa56d291
,
0xd7894360
,
0x425c750d
,
0x93b39e26
,
0x187184c9
,
0x6c00b32d
,
0x73e2bb14
,
0xa0bebc3c
,
0x54623779
,
0x64459eab
,
0x3f328b82
,
0x7718cf82
,
0x59a2cea6
,
0x04ee002e
,
0x89fe78e6
,
0x3fab0950
,
0x325ff6c2
,
0x81383f05
,
0x6963c5c8
,
0x76cb5ad6
,
0xd49974c9
,
0xca180dcf
,
0x380782d5
,
0xc7fa5cf6
,
0x8ac31511
,
0x35e79e13
,
0x47da91d0
,
0xf40f9086
,
0xa7e2419e
,
0x31366241
,
0x051ef495
,
0xaa573b04
,
0x4a805d8d
,
0x548300d0
,
0x00322a3c
,
0xbf64cddf
,
0xba57a68e
,
0x75c6372b
,
0x50afd341
,
0xa7c13275
,
0x915a0bf5
,
0x6b54bfab
,
0x2b0b1426
,
0xab4cc9d7
,
0x449ccd82
,
0xf7fbf265
,
0xab85c5f3
,
0x1b55db94
,
0xaad4e324
,
0xcfa4bd3f
,
0x2deaa3e2
,
0x9e204d02
,
0xc8bd25ac
,
0xeadf55b3
,
0xd5bd9e98
,
0xe31231b2
,
0x2ad5ad6c
,
0x954329de
,
0xadbe4528
,
0xd8710f69
,
0xaa51c90f
,
0xaa786bf6
,
0x22513f1e
,
0xaa51a79b
,
0x2ad344cc
,
0x7b5a41f0
,
0xd37cfbad
,
0x1b069505
,
0x41ece491
,
0xb4c332e6
,
0x032268d4
,
0xc9600acc
,
0xce387e6d
,
0xbf6bb16c
,
0x6a70fb78
,
0x0d03d9c9
,
0xd4df39de
,
0xe01063da
,
0x4736f464
,
0x5ad328d8
,
0xb347cc96
,
0x75bb0fc3
,
0x98511bfb
,
0x4ffbcc35
,
0xb58bcf6a
,
0xe11f0abc
,
0xbfc5fe4a
,
0xa70aec10
,
0xac39570a
,
0x3f04442f
,
0x6188b153
,
0xe0397a2e
,
0x5727cb79
,
0x9ceb418f
,
0x1cacd68d
,
0x2ad37c96
,
0x0175cb9d
,
0xc69dff09
,
0xc75b65f0
,
0xd9db40d8
,
0xec0e7779
,
0x4744ead4
,
0xb11c3274
,
0xdd24cb9e
,
0x7e1c54bd
,
0xf01144f9
,
0xd2240eb1
,
0x9675b3fd
,
0xa3ac3755
,
0xd47c27af
,
0x51c85f4d
,
0x56907596
,
0xa5bb15e6
,
0x580304f0
,
0xca042cf1
,
0x011a37ea
,
0x8dbfaadb
,
0x35ba3e4a
,
0x3526ffa0
,
0xc37b4d09
,
0xbc306ed9
,
0x98a52666
,
0x5648f725
,
0xff5e569d
,
0x0ced63d0
,
0x7c63b2cf
,
0x700b45e1
,
0xd5ea50f1
,
0x85a92872
,
0xaf1fbda7
,
0xd4234870
,
0xa7870bf3
,
0x2d3b4d79
,
0x42e04198
,
0x0cd0ede7
,
0x26470db8
,
0xf881814c
,
0x474d6ad7
,
0x7c0c5e5c
,
0xd1231959
,
0x381b7298
,
0xf5d2f4db
,
0xab838653
,
0x6e2f1e23
,
0x83719c9e
,
0xbd91e046
,
0x9a56456e
,
0xdc39200c
,
0x20c8c571
,
0x962bda1c
,
0xe1e696ff
,
0xb141ab08
,
0x7cca89b9
,
0x1a69e783
,
0x02cc4843
,
0xa2f7c579
,
0x429ef47d
,
0x427b169c
,
0x5ac9f049
,
0xdd8f0f00
,
0x5c8165bf
};
static
const
u32
s2
[
256
]
=
{
0x1f201094
,
0xef0ba75b
,
0x69e3cf7e
,
0x393f4380
,
0xfe61cf7a
,
0xeec5207a
,
0x55889c94
,
0x72fc0651
,
0xada7ef79
,
0x4e1d7235
,
0xd55a63ce
,
0xde0436ba
,
0x99c430ef
,
0x5f0c0794
,
0x18dcdb7d
,
0xa1d6eff3
,
0xa0b52f7b
,
0x59e83605
,
0xee15b094
,
0xe9ffd909
,
0xdc440086
,
0xef944459
,
0xba83ccb3
,
0xe0c3cdfb
,
0xd1da4181
,
0x3b092ab1
,
0xf997f1c1
,
0xa5e6cf7b
,
0x01420ddb
,
0xe4e7ef5b
,
0x25a1ff41
,
0xe180f806
,
0x1fc41080
,
0x179bee7a
,
0xd37ac6a9
,
0xfe5830a4
,
0x98de8b7f
,
0x77e83f4e
,
0x79929269
,
0x24fa9f7b
,
0xe113c85b
,
0xacc40083
,
0xd7503525
,
0xf7ea615f
,
0x62143154
,
0x0d554b63
,
0x5d681121
,
0xc866c359
,
0x3d63cf73
,
0xcee234c0
,
0xd4d87e87
,
0x5c672b21
,
0x071f6181
,
0x39f7627f
,
0x361e3084
,
0xe4eb573b
,
0x602f64a4
,
0xd63acd9c
,
0x1bbc4635
,
0x9e81032d
,
0x2701f50c
,
0x99847ab4
,
0xa0e3df79
,
0xba6cf38c
,
0x10843094
,
0x2537a95e
,
0xf46f6ffe
,
0xa1ff3b1f
,
0x208cfb6a
,
0x8f458c74
,
0xd9e0a227
,
0x4ec73a34
,
0xfc884f69
,
0x3e4de8df
,
0xef0e0088
,
0x3559648d
,
0x8a45388c
,
0x1d804366
,
0x721d9bfd
,
0xa58684bb
,
0xe8256333
,
0x844e8212
,
0x128d8098
,
0xfed33fb4
,
0xce280ae1
,
0x27e19ba5
,
0xd5a6c252
,
0xe49754bd
,
0xc5d655dd
,
0xeb667064
,
0x77840b4d
,
0xa1b6a801
,
0x84db26a9
,
0xe0b56714
,
0x21f043b7
,
0xe5d05860
,
0x54f03084
,
0x066ff472
,
0xa31aa153
,
0xdadc4755
,
0xb5625dbf
,
0x68561be6
,
0x83ca6b94
,
0x2d6ed23b
,
0xeccf01db
,
0xa6d3d0ba
,
0xb6803d5c
,
0xaf77a709
,
0x33b4a34c
,
0x397bc8d6
,
0x5ee22b95
,
0x5f0e5304
,
0x81ed6f61
,
0x20e74364
,
0xb45e1378
,
0xde18639b
,
0x881ca122
,
0xb96726d1
,
0x8049a7e8
,
0x22b7da7b
,
0x5e552d25
,
0x5272d237
,
0x79d2951c
,
0xc60d894c
,
0x488cb402
,
0x1ba4fe5b
,
0xa4b09f6b
,
0x1ca815cf
,
0xa20c3005
,
0x8871df63
,
0xb9de2fcb
,
0x0cc6c9e9
,
0x0beeff53
,
0xe3214517
,
0xb4542835
,
0x9f63293c
,
0xee41e729
,
0x6e1d2d7c
,
0x50045286
,
0x1e6685f3
,
0xf33401c6
,
0x30a22c95
,
0x31a70850
,
0x60930f13
,
0x73f98417
,
0xa1269859
,
0xec645c44
,
0x52c877a9
,
0xcdff33a6
,
0xa02b1741
,
0x7cbad9a2
,
0x2180036f
,
0x50d99c08
,
0xcb3f4861
,
0xc26bd765
,
0x64a3f6ab
,
0x80342676
,
0x25a75e7b
,
0xe4e6d1fc
,
0x20c710e6
,
0xcdf0b680
,
0x17844d3b
,
0x31eef84d
,
0x7e0824e4
,
0x2ccb49eb
,
0x846a3bae
,
0x8ff77888
,
0xee5d60f6
,
0x7af75673
,
0x2fdd5cdb
,
0xa11631c1
,
0x30f66f43
,
0xb3faec54
,
0x157fd7fa
,
0xef8579cc
,
0xd152de58
,
0xdb2ffd5e
,
0x8f32ce19
,
0x306af97a
,
0x02f03ef8
,
0x99319ad5
,
0xc242fa0f
,
0xa7e3ebb0
,
0xc68e4906
,
0xb8da230c
,
0x80823028
,
0xdcdef3c8
,
0xd35fb171
,
0x088a1bc8
,
0xbec0c560
,
0x61a3c9e8
,
0xbca8f54d
,
0xc72feffa
,
0x22822e99
,
0x82c570b4
,
0xd8d94e89
,
0x8b1c34bc
,
0x301e16e6
,
0x273be979
,
0xb0ffeaa6
,
0x61d9b8c6
,
0x00b24869
,
0xb7ffce3f
,
0x08dc283b
,
0x43daf65a
,
0xf7e19798
,
0x7619b72f
,
0x8f1c9ba4
,
0xdc8637a0
,
0x16a7d3b1
,
0x9fc393b7
,
0xa7136eeb
,
0xc6bcc63e
,
0x1a513742
,
0xef6828bc
,
0x520365d6
,
0x2d6a77ab
,
0x3527ed4b
,
0x821fd216
,
0x095c6e2e
,
0xdb92f2fb
,
0x5eea29cb
,
0x145892f5
,
0x91584f7f
,
0x5483697b
,
0x2667a8cc
,
0x85196048
,
0x8c4bacea
,
0x833860d4
,
0x0d23e0f9
,
0x6c387e8a
,
0x0ae6d249
,
0xb284600c
,
0xd835731d
,
0xdcb1c647
,
0xac4c56ea
,
0x3ebd81b3
,
0x230eabb0
,
0x6438bc87
,
0xf0b5b1fa
,
0x8f5ea2b3
,
0xfc184642
,
0x0a036b7a
,
0x4fb089bd
,
0x649da589
,
0xa345415e
,
0x5c038323
,
0x3e5d3bb9
,
0x43d79572
,
0x7e6dd07c
,
0x06dfdf1e
,
0x6c6cc4ef
,
0x7160a539
,
0x73bfbe70
,
0x83877605
,
0x4523ecf1
};
static
const
u32
s3
[
256
]
=
{
0x8defc240
,
0x25fa5d9f
,
0xeb903dbf
,
0xe810c907
,
0x47607fff
,
0x369fe44b
,
0x8c1fc644
,
0xaececa90
,
0xbeb1f9bf
,
0xeefbcaea
,
0xe8cf1950
,
0x51df07ae
,
0x920e8806
,
0xf0ad0548
,
0xe13c8d83
,
0x927010d5
,
0x11107d9f
,
0x07647db9
,
0xb2e3e4d4
,
0x3d4f285e
,
0xb9afa820
,
0xfade82e0
,
0xa067268b
,
0x8272792e
,
0x553fb2c0
,
0x489ae22b
,
0xd4ef9794
,
0x125e3fbc
,
0x21fffcee
,
0x825b1bfd
,
0x9255c5ed
,
0x1257a240
,
0x4e1a8302
,
0xbae07fff
,
0x528246e7
,
0x8e57140e
,
0x3373f7bf
,
0x8c9f8188
,
0xa6fc4ee8
,
0xc982b5a5
,
0xa8c01db7
,
0x579fc264
,
0x67094f31
,
0xf2bd3f5f
,
0x40fff7c1
,
0x1fb78dfc
,
0x8e6bd2c1
,
0x437be59b
,
0x99b03dbf
,
0xb5dbc64b
,
0x638dc0e6
,
0x55819d99
,
0xa197c81c
,
0x4a012d6e
,
0xc5884a28
,
0xccc36f71
,
0xb843c213
,
0x6c0743f1
,
0x8309893c
,
0x0feddd5f
,
0x2f7fe850
,
0xd7c07f7e
,
0x02507fbf
,
0x5afb9a04
,
0xa747d2d0
,
0x1651192e
,
0xaf70bf3e
,
0x58c31380
,
0x5f98302e
,
0x727cc3c4
,
0x0a0fb402
,
0x0f7fef82
,
0x8c96fdad
,
0x5d2c2aae
,
0x8ee99a49
,
0x50da88b8
,
0x8427f4a0
,
0x1eac5790
,
0x796fb449
,
0x8252dc15
,
0xefbd7d9b
,
0xa672597d
,
0xada840d8
,
0x45f54504
,
0xfa5d7403
,
0xe83ec305
,
0x4f91751a
,
0x925669c2
,
0x23efe941
,
0xa903f12e
,
0x60270df2
,
0x0276e4b6
,
0x94fd6574
,
0x927985b2
,
0x8276dbcb
,
0x02778176
,
0xf8af918d
,
0x4e48f79e
,
0x8f616ddf
,
0xe29d840e
,
0x842f7d83
,
0x340ce5c8
,
0x96bbb682
,
0x93b4b148
,
0xef303cab
,
0x984faf28
,
0x779faf9b
,
0x92dc560d
,
0x224d1e20
,
0x8437aa88
,
0x7d29dc96
,
0x2756d3dc
,
0x8b907cee
,
0xb51fd240
,
0xe7c07ce3
,
0xe566b4a1
,
0xc3e9615e
,
0x3cf8209d
,
0x6094d1e3
,
0xcd9ca341
,
0x5c76460e
,
0x00ea983b
,
0xd4d67881
,
0xfd47572c
,
0xf76cedd9
,
0xbda8229c
,
0x127dadaa
,
0x438a074e
,
0x1f97c090
,
0x081bdb8a
,
0x93a07ebe
,
0xb938ca15
,
0x97b03cff
,
0x3dc2c0f8
,
0x8d1ab2ec
,
0x64380e51
,
0x68cc7bfb
,
0xd90f2788
,
0x12490181
,
0x5de5ffd4
,
0xdd7ef86a
,
0x76a2e214
,
0xb9a40368
,
0x925d958f
,
0x4b39fffa
,
0xba39aee9
,
0xa4ffd30b
,
0xfaf7933b
,
0x6d498623
,
0x193cbcfa
,
0x27627545
,
0x825cf47a
,
0x61bd8ba0
,
0xd11e42d1
,
0xcead04f4
,
0x127ea392
,
0x10428db7
,
0x8272a972
,
0x9270c4a8
,
0x127de50b
,
0x285ba1c8
,
0x3c62f44f
,
0x35c0eaa5
,
0xe805d231
,
0x428929fb
,
0xb4fcdf82
,
0x4fb66a53
,
0x0e7dc15b
,
0x1f081fab
,
0x108618ae
,
0xfcfd086d
,
0xf9ff2889
,
0x694bcc11
,
0x236a5cae
,
0x12deca4d
,
0x2c3f8cc5
,
0xd2d02dfe
,
0xf8ef5896
,
0xe4cf52da
,
0x95155b67
,
0x494a488c
,
0xb9b6a80c
,
0x5c8f82bc
,
0x89d36b45
,
0x3a609437
,
0xec00c9a9
,
0x44715253
,
0x0a874b49
,
0xd773bc40
,
0x7c34671c
,
0x02717ef6
,
0x4feb5536
,
0xa2d02fff
,
0xd2bf60c4
,
0xd43f03c0
,
0x50b4ef6d
,
0x07478cd1
,
0x006e1888
,
0xa2e53f55
,
0xb9e6d4bc
,
0xa2048016
,
0x97573833
,
0xd7207d67
,
0xde0f8f3d
,
0x72f87b33
,
0xabcc4f33
,
0x7688c55d
,
0x7b00a6b0
,
0x947b0001
,
0x570075d2
,
0xf9bb88f8
,
0x8942019e
,
0x4264a5ff
,
0x856302e0
,
0x72dbd92b
,
0xee971b69
,
0x6ea22fde
,
0x5f08ae2b
,
0xaf7a616d
,
0xe5c98767
,
0xcf1febd2
,
0x61efc8c2
,
0xf1ac2571
,
0xcc8239c2
,
0x67214cb8
,
0xb1e583d1
,
0xb7dc3e62
,
0x7f10bdce
,
0xf90a5c38
,
0x0ff0443d
,
0x606e6dc6
,
0x60543a49
,
0x5727c148
,
0x2be98a1d
,
0x8ab41738
,
0x20e1be24
,
0xaf96da0f
,
0x68458425
,
0x99833be5
,
0x600d457d
,
0x282f9350
,
0x8334b362
,
0xd91d1120
,
0x2b6d8da0
,
0x642b1e31
,
0x9c305a00
,
0x52bce688
,
0x1b03588a
,
0xf7baefd5
,
0x4142ed9c
,
0xa4315c11
,
0x83323ec5
,
0xdfef4636
,
0xa133c501
,
0xe9d3531c
,
0xee353783
};
static
const
u32
s4
[
256
]
=
{
0x9db30420
,
0x1fb6e9de
,
0xa7be7bef
,
0xd273a298
,
0x4a4f7bdb
,
0x64ad8c57
,
0x85510443
,
0xfa020ed1
,
0x7e287aff
,
0xe60fb663
,
0x095f35a1
,
0x79ebf120
,
0xfd059d43
,
0x6497b7b1
,
0xf3641f63
,
0x241e4adf
,
0x28147f5f
,
0x4fa2b8cd
,
0xc9430040
,
0x0cc32220
,
0xfdd30b30
,
0xc0a5374f
,
0x1d2d00d9
,
0x24147b15
,
0xee4d111a
,
0x0fca5167
,
0x71ff904c
,
0x2d195ffe
,
0x1a05645f
,
0x0c13fefe
,
0x081b08ca
,
0x05170121
,
0x80530100
,
0xe83e5efe
,
0xac9af4f8
,
0x7fe72701
,
0xd2b8ee5f
,
0x06df4261
,
0xbb9e9b8a
,
0x7293ea25
,
0xce84ffdf
,
0xf5718801
,
0x3dd64b04
,
0xa26f263b
,
0x7ed48400
,
0x547eebe6
,
0x446d4ca0
,
0x6cf3d6f5
,
0x2649abdf
,
0xaea0c7f5
,
0x36338cc1
,
0x503f7e93
,
0xd3772061
,
0x11b638e1
,
0x72500e03
,
0xf80eb2bb
,
0xabe0502e
,
0xec8d77de
,
0x57971e81
,
0xe14f6746
,
0xc9335400
,
0x6920318f
,
0x081dbb99
,
0xffc304a5
,
0x4d351805
,
0x7f3d5ce3
,
0xa6c866c6
,
0x5d5bcca9
,
0xdaec6fea
,
0x9f926f91
,
0x9f46222f
,
0x3991467d
,
0xa5bf6d8e
,
0x1143c44f
,
0x43958302
,
0xd0214eeb
,
0x022083b8
,
0x3fb6180c
,
0x18f8931e
,
0x281658e6
,
0x26486e3e
,
0x8bd78a70
,
0x7477e4c1
,
0xb506e07c
,
0xf32d0a25
,
0x79098b02
,
0xe4eabb81
,
0x28123b23
,
0x69dead38
,
0x1574ca16
,
0xdf871b62
,
0x211c40b7
,
0xa51a9ef9
,
0x0014377b
,
0x041e8ac8
,
0x09114003
,
0xbd59e4d2
,
0xe3d156d5
,
0x4fe876d5
,
0x2f91a340
,
0x557be8de
,
0x00eae4a7
,
0x0ce5c2ec
,
0x4db4bba6
,
0xe756bdff
,
0xdd3369ac
,
0xec17b035
,
0x06572327
,
0x99afc8b0
,
0x56c8c391
,
0x6b65811c
,
0x5e146119
,
0x6e85cb75
,
0xbe07c002
,
0xc2325577
,
0x893ff4ec
,
0x5bbfc92d
,
0xd0ec3b25
,
0xb7801ab7
,
0x8d6d3b24
,
0x20c763ef
,
0xc366a5fc
,
0x9c382880
,
0x0ace3205
,
0xaac9548a
,
0xeca1d7c7
,
0x041afa32
,
0x1d16625a
,
0x6701902c
,
0x9b757a54
,
0x31d477f7
,
0x9126b031
,
0x36cc6fdb
,
0xc70b8b46
,
0xd9e66a48
,
0x56e55a79
,
0x026a4ceb
,
0x52437eff
,
0x2f8f76b4
,
0x0df980a5
,
0x8674cde3
,
0xedda04eb
,
0x17a9be04
,
0x2c18f4df
,
0xb7747f9d
,
0xab2af7b4
,
0xefc34d20
,
0x2e096b7c
,
0x1741a254
,
0xe5b6a035
,
0x213d42f6
,
0x2c1c7c26
,
0x61c2f50f
,
0x6552daf9
,
0xd2c231f8
,
0x25130f69
,
0xd8167fa2
,
0x0418f2c8
,
0x001a96a6
,
0x0d1526ab
,
0x63315c21
,
0x5e0a72ec
,
0x49bafefd
,
0x187908d9
,
0x8d0dbd86
,
0x311170a7
,
0x3e9b640c
,
0xcc3e10d7
,
0xd5cad3b6
,
0x0caec388
,
0xf73001e1
,
0x6c728aff
,
0x71eae2a1
,
0x1f9af36e
,
0xcfcbd12f
,
0xc1de8417
,
0xac07be6b
,
0xcb44a1d8
,
0x8b9b0f56
,
0x013988c3
,
0xb1c52fca
,
0xb4be31cd
,
0xd8782806
,
0x12a3a4e2
,
0x6f7de532
,
0x58fd7eb6
,
0xd01ee900
,
0x24adffc2
,
0xf4990fc5
,
0x9711aac5
,
0x001d7b95
,
0x82e5e7d2
,
0x109873f6
,
0x00613096
,
0xc32d9521
,
0xada121ff
,
0x29908415
,
0x7fbb977f
,
0xaf9eb3db
,
0x29c9ed2a
,
0x5ce2a465
,
0xa730f32c
,
0xd0aa3fe8
,
0x8a5cc091
,
0xd49e2ce7
,
0x0ce454a9
,
0xd60acd86
,
0x015f1919
,
0x77079103
,
0xdea03af6
,
0x78a8565e
,
0xdee356df
,
0x21f05cbe
,
0x8b75e387
,
0xb3c50651
,
0xb8a5c3ef
,
0xd8eeb6d2
,
0xe523be77
,
0xc2154529
,
0x2f69efdf
,
0xafe67afb
,
0xf470c4b2
,
0xf3e0eb5b
,
0xd6cc9876
,
0x39e4460c
,
0x1fda8538
,
0x1987832f
,
0xca007367
,
0xa99144f8
,
0x296b299e
,
0x492fc295
,
0x9266beab
,
0xb5676e69
,
0x9bd3ddda
,
0xdf7e052f
,
0xdb25701c
,
0x1b5e51ee
,
0xf65324e6
,
0x6afce36c
,
0x0316cc04
,
0x8644213e
,
0xb7dc59d0
,
0x7965291f
,
0xccd6fd43
,
0x41823979
,
0x932bcdf6
,
0xb657c34d
,
0x4edfd282
,
0x7ae5290c
,
0x3cb9536b
,
0x851e20fe
,
0x9833557e
,
0x13ecf0b0
,
0xd3ffb372
,
0x3f85c5c1
,
0x0aef7ed2
};
static
const
u32
Tm
[
24
][
8
]
=
{
{
0x5a827999
,
0xc95c653a
,
0x383650db
,
0xa7103c7c
,
0x15ea281d
,
0x84c413be
,
0xf39dff5f
,
0x6277eb00
}
,
{
0xd151d6a1
,
0x402bc242
,
0xaf05ade3
,
0x1ddf9984
,
0x8cb98525
,
0xfb9370c6
,
0x6a6d5c67
,
0xd9474808
}
,
{
0x482133a9
,
0xb6fb1f4a
,
0x25d50aeb
,
0x94aef68c
,
0x0388e22d
,
0x7262cdce
,
0xe13cb96f
,
0x5016a510
}
,
{
0xbef090b1
,
0x2dca7c52
,
0x9ca467f3
,
0x0b7e5394
,
0x7a583f35
,
0xe9322ad6
,
0x580c1677
,
0xc6e60218
}
,
{
0x35bfedb9
,
0xa499d95a
,
0x1373c4fb
,
0x824db09c
,
0xf1279c3d
,
0x600187de
,
0xcedb737f
,
0x3db55f20
}
,
{
0xac8f4ac1
,
0x1b693662
,
0x8a432203
,
0xf91d0da4
,
0x67f6f945
,
0xd6d0e4e6
,
0x45aad087
,
0xb484bc28
}
,
{
0x235ea7c9
,
0x9238936a
,
0x01127f0b
,
0x6fec6aac
,
0xdec6564d
,
0x4da041ee
,
0xbc7a2d8f
,
0x2b541930
}
,
{
0x9a2e04d1
,
0x0907f072
,
0x77e1dc13
,
0xe6bbc7b4
,
0x5595b355
,
0xc46f9ef6
,
0x33498a97
,
0xa2237638
}
,
{
0x10fd61d9
,
0x7fd74d7a
,
0xeeb1391b
,
0x5d8b24bc
,
0xcc65105d
,
0x3b3efbfe
,
0xaa18e79f
,
0x18f2d340
}
,
{
0x87ccbee1
,
0xf6a6aa82
,
0x65809623
,
0xd45a81c4
,
0x43346d65
,
0xb20e5906
,
0x20e844a7
,
0x8fc23048
}
,
{
0xfe9c1be9
,
0x6d76078a
,
0xdc4ff32b
,
0x4b29decc
,
0xba03ca6d
,
0x28ddb60e
,
0x97b7a1af
,
0x06918d50
}
,
{
0x756b78f1
,
0xe4456492
,
0x531f5033
,
0xc1f93bd4
,
0x30d32775
,
0x9fad1316
,
0x0e86feb7
,
0x7d60ea58
}
,
{
0xec3ad5f9
,
0x5b14c19a
,
0xc9eead3b
,
0x38c898dc
,
0xa7a2847d
,
0x167c701e
,
0x85565bbf
,
0xf4304760
}
,
{
0x630a3301
,
0xd1e41ea2
,
0x40be0a43
,
0xaf97f5e4
,
0x1e71e185
,
0x8d4bcd26
,
0xfc25b8c7
,
0x6affa468
}
,
{
0xd9d99009
,
0x48b37baa
,
0xb78d674b
,
0x266752ec
,
0x95413e8d
,
0x041b2a2e
,
0x72f515cf
,
0xe1cf0170
}
,
{
0x50a8ed11
,
0xbf82d8b2
,
0x2e5cc453
,
0x9d36aff4
,
0x0c109b95
,
0x7aea8736
,
0xe9c472d7
,
0x589e5e78
}
,
{
0xc7784a19
,
0x365235ba
,
0xa52c215b
,
0x14060cfc
,
0x82dff89d
,
0xf1b9e43e
,
0x6093cfdf
,
0xcf6dbb80
}
,
{
0x3e47a721
,
0xad2192c2
,
0x1bfb7e63
,
0x8ad56a04
,
0xf9af55a5
,
0x68894146
,
0xd7632ce7
,
0x463d1888
}
,
{
0xb5170429
,
0x23f0efca
,
0x92cadb6b
,
0x01a4c70c
,
0x707eb2ad
,
0xdf589e4e
,
0x4e3289ef
,
0xbd0c7590
}
,
{
0x2be66131
,
0x9ac04cd2
,
0x099a3873
,
0x78742414
,
0xe74e0fb5
,
0x5627fb56
,
0xc501e6f7
,
0x33dbd298
}
,
{
0xa2b5be39
,
0x118fa9da
,
0x8069957b
,
0xef43811c
,
0x5e1d6cbd
,
0xccf7585e
,
0x3bd143ff
,
0xaaab2fa0
}
,
{
0x19851b41
,
0x885f06e2
,
0xf738f283
,
0x6612de24
,
0xd4ecc9c5
,
0x43c6b566
,
0xb2a0a107
,
0x217a8ca8
}
,
{
0x90547849
,
0xff2e63ea
,
0x6e084f8b
,
0xdce23b2c
,
0x4bbc26cd
,
0xba96126e
,
0x296ffe0f
,
0x9849e9b0
}
,
{
0x0723d551
,
0x75fdc0f2
,
0xe4d7ac93
,
0x53b19834
,
0xc28b83d5
,
0x31656f76
,
0xa03f5b17
,
0x0f1946b8
}
};
static
const
u8
Tr
[
4
][
8
]
=
{
{
0x13
,
0x04
,
0x15
,
0x06
,
0x17
,
0x08
,
0x19
,
0x0a
}
,
{
0x1b
,
0x0c
,
0x1d
,
0x0e
,
0x1f
,
0x10
,
0x01
,
0x12
}
,
{
0x03
,
0x14
,
0x05
,
0x16
,
0x07
,
0x18
,
0x09
,
0x1a
}
,
{
0x0b
,
0x1c
,
0x0d
,
0x1e
,
0x0f
,
0x00
,
0x11
,
0x02
}
};
/* forward octave */
static
inline
void
W
(
u32
*
key
,
unsigned
int
i
)
{
u32
I
;
key
[
6
]
^=
F1
(
key
[
7
],
Tr
[
i
%
4
][
0
],
Tm
[
i
][
0
]);
key
[
5
]
^=
F2
(
key
[
6
],
Tr
[
i
%
4
][
1
],
Tm
[
i
][
1
]);
key
[
4
]
^=
F3
(
key
[
5
],
Tr
[
i
%
4
][
2
],
Tm
[
i
][
2
]);
key
[
3
]
^=
F1
(
key
[
4
],
Tr
[
i
%
4
][
3
],
Tm
[
i
][
3
]);
key
[
2
]
^=
F2
(
key
[
3
],
Tr
[
i
%
4
][
4
],
Tm
[
i
][
4
]);
key
[
1
]
^=
F3
(
key
[
2
],
Tr
[
i
%
4
][
5
],
Tm
[
i
][
5
]);
key
[
0
]
^=
F1
(
key
[
1
],
Tr
[
i
%
4
][
6
],
Tm
[
i
][
6
]);
key
[
7
]
^=
F2
(
key
[
0
],
Tr
[
i
%
4
][
7
],
Tm
[
i
][
7
]);
}
static
int
cast6_setkey
(
void
*
ctx
,
const
u8
*
in_key
,
unsigned
key_len
,
u32
*
flags
)
{
int
i
;
u32
key
[
8
];
u8
p_key
[
32
];
/* padded key */
struct
cast6_ctx
*
c
=
(
struct
cast6_ctx
*
)
ctx
;
if
(
key_len
<
16
||
key_len
>
32
||
key_len
%
4
!=
0
)
{
*
flags
|=
CRYPTO_TFM_RES_BAD_KEY_LEN
;
return
-
EINVAL
;
}
memset
(
p_key
,
0
,
32
);
memcpy
(
p_key
,
in_key
,
key_len
);
key
[
0
]
=
p_key
[
0
]
<<
24
|
p_key
[
1
]
<<
16
|
p_key
[
2
]
<<
8
|
p_key
[
3
];
/* A */
key
[
1
]
=
p_key
[
4
]
<<
24
|
p_key
[
5
]
<<
16
|
p_key
[
6
]
<<
8
|
p_key
[
7
];
/* B */
key
[
2
]
=
p_key
[
8
]
<<
24
|
p_key
[
9
]
<<
16
|
p_key
[
10
]
<<
8
|
p_key
[
11
];
/* C */
key
[
3
]
=
p_key
[
12
]
<<
24
|
p_key
[
13
]
<<
16
|
p_key
[
14
]
<<
8
|
p_key
[
15
];
/* D */
key
[
4
]
=
p_key
[
16
]
<<
24
|
p_key
[
17
]
<<
16
|
p_key
[
18
]
<<
8
|
p_key
[
19
];
/* E */
key
[
5
]
=
p_key
[
20
]
<<
24
|
p_key
[
21
]
<<
16
|
p_key
[
22
]
<<
8
|
p_key
[
23
];
/* F */
key
[
6
]
=
p_key
[
24
]
<<
24
|
p_key
[
25
]
<<
16
|
p_key
[
26
]
<<
8
|
p_key
[
27
];
/* G */
key
[
7
]
=
p_key
[
28
]
<<
24
|
p_key
[
29
]
<<
16
|
p_key
[
30
]
<<
8
|
p_key
[
31
];
/* H */
for
(
i
=
0
;
i
<
12
;
i
++
)
{
W
(
key
,
2
*
i
);
W
(
key
,
2
*
i
+
1
);
c
->
Kr
[
i
][
0
]
=
key
[
0
]
&
0x1f
;
c
->
Kr
[
i
][
1
]
=
key
[
2
]
&
0x1f
;
c
->
Kr
[
i
][
2
]
=
key
[
4
]
&
0x1f
;
c
->
Kr
[
i
][
3
]
=
key
[
6
]
&
0x1f
;
c
->
Km
[
i
][
0
]
=
key
[
7
];
c
->
Km
[
i
][
1
]
=
key
[
5
];
c
->
Km
[
i
][
2
]
=
key
[
3
];
c
->
Km
[
i
][
3
]
=
key
[
1
];
}
return
0
;
}
/*forward quad round*/
static
inline
void
Q
(
u32
*
block
,
u8
*
Kr
,
u32
*
Km
)
{
u32
I
;
block
[
2
]
^=
F1
(
block
[
3
],
Kr
[
0
],
Km
[
0
]);
block
[
1
]
^=
F2
(
block
[
2
],
Kr
[
1
],
Km
[
1
]);
block
[
0
]
^=
F3
(
block
[
1
],
Kr
[
2
],
Km
[
2
]);
block
[
3
]
^=
F1
(
block
[
0
],
Kr
[
3
],
Km
[
3
]);
}
/*reverse quad round*/
static
inline
void
QBAR
(
u32
*
block
,
u8
*
Kr
,
u32
*
Km
)
{
u32
I
;
block
[
3
]
^=
F1
(
block
[
0
],
Kr
[
3
],
Km
[
3
]);
block
[
0
]
^=
F3
(
block
[
1
],
Kr
[
2
],
Km
[
2
]);
block
[
1
]
^=
F2
(
block
[
2
],
Kr
[
1
],
Km
[
1
]);
block
[
2
]
^=
F1
(
block
[
3
],
Kr
[
0
],
Km
[
0
]);
}
static
void
cast6_encrypt
(
void
*
ctx
,
u8
*
outbuf
,
const
u8
*
inbuf
)
{
struct
cast6_ctx
*
c
=
(
struct
cast6_ctx
*
)
ctx
;
u32
block
[
4
];
u32
*
Km
;
u8
*
Kr
;
block
[
0
]
=
inbuf
[
0
]
<<
24
|
inbuf
[
1
]
<<
16
|
inbuf
[
2
]
<<
8
|
inbuf
[
3
];
block
[
1
]
=
inbuf
[
4
]
<<
24
|
inbuf
[
5
]
<<
16
|
inbuf
[
6
]
<<
8
|
inbuf
[
7
];
block
[
2
]
=
inbuf
[
8
]
<<
24
|
inbuf
[
9
]
<<
16
|
inbuf
[
10
]
<<
8
|
inbuf
[
11
];
block
[
3
]
=
inbuf
[
12
]
<<
24
|
inbuf
[
13
]
<<
16
|
inbuf
[
14
]
<<
8
|
inbuf
[
15
];
Km
=
c
->
Km
[
0
];
Kr
=
c
->
Kr
[
0
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
1
];
Kr
=
c
->
Kr
[
1
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
2
];
Kr
=
c
->
Kr
[
2
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
3
];
Kr
=
c
->
Kr
[
3
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
4
];
Kr
=
c
->
Kr
[
4
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
5
];
Kr
=
c
->
Kr
[
5
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
6
];
Kr
=
c
->
Kr
[
6
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
7
];
Kr
=
c
->
Kr
[
7
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
8
];
Kr
=
c
->
Kr
[
8
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
9
];
Kr
=
c
->
Kr
[
9
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
10
];
Kr
=
c
->
Kr
[
10
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
11
];
Kr
=
c
->
Kr
[
11
];
QBAR
(
block
,
Kr
,
Km
);
outbuf
[
0
]
=
(
block
[
0
]
>>
24
)
&
0xff
;
outbuf
[
1
]
=
(
block
[
0
]
>>
16
)
&
0xff
;
outbuf
[
2
]
=
(
block
[
0
]
>>
8
)
&
0xff
;
outbuf
[
3
]
=
block
[
0
]
&
0xff
;
outbuf
[
4
]
=
(
block
[
1
]
>>
24
)
&
0xff
;
outbuf
[
5
]
=
(
block
[
1
]
>>
16
)
&
0xff
;
outbuf
[
6
]
=
(
block
[
1
]
>>
8
)
&
0xff
;
outbuf
[
7
]
=
block
[
1
]
&
0xff
;
outbuf
[
8
]
=
(
block
[
2
]
>>
24
)
&
0xff
;
outbuf
[
9
]
=
(
block
[
2
]
>>
16
)
&
0xff
;
outbuf
[
10
]
=
(
block
[
2
]
>>
8
)
&
0xff
;
outbuf
[
11
]
=
block
[
2
]
&
0xff
;
outbuf
[
12
]
=
(
block
[
3
]
>>
24
)
&
0xff
;
outbuf
[
13
]
=
(
block
[
3
]
>>
16
)
&
0xff
;
outbuf
[
14
]
=
(
block
[
3
]
>>
8
)
&
0xff
;
outbuf
[
15
]
=
block
[
3
]
&
0xff
;
}
static
void
cast6_decrypt
(
void
*
ctx
,
u8
*
outbuf
,
const
u8
*
inbuf
)
{
struct
cast6_ctx
*
c
=
(
struct
cast6_ctx
*
)
ctx
;
u32
block
[
4
];
u32
*
Km
;
u8
*
Kr
;
block
[
0
]
=
inbuf
[
0
]
<<
24
|
inbuf
[
1
]
<<
16
|
inbuf
[
2
]
<<
8
|
inbuf
[
3
];
block
[
1
]
=
inbuf
[
4
]
<<
24
|
inbuf
[
5
]
<<
16
|
inbuf
[
6
]
<<
8
|
inbuf
[
7
];
block
[
2
]
=
inbuf
[
8
]
<<
24
|
inbuf
[
9
]
<<
16
|
inbuf
[
10
]
<<
8
|
inbuf
[
11
];
block
[
3
]
=
inbuf
[
12
]
<<
24
|
inbuf
[
13
]
<<
16
|
inbuf
[
14
]
<<
8
|
inbuf
[
15
];
Km
=
c
->
Km
[
11
];
Kr
=
c
->
Kr
[
11
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
10
];
Kr
=
c
->
Kr
[
10
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
9
];
Kr
=
c
->
Kr
[
9
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
8
];
Kr
=
c
->
Kr
[
8
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
7
];
Kr
=
c
->
Kr
[
7
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
6
];
Kr
=
c
->
Kr
[
6
];
Q
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
5
];
Kr
=
c
->
Kr
[
5
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
4
];
Kr
=
c
->
Kr
[
4
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
3
];
Kr
=
c
->
Kr
[
3
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
2
];
Kr
=
c
->
Kr
[
2
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
1
];
Kr
=
c
->
Kr
[
1
];
QBAR
(
block
,
Kr
,
Km
);
Km
=
c
->
Km
[
0
];
Kr
=
c
->
Kr
[
0
];
QBAR
(
block
,
Kr
,
Km
);
outbuf
[
0
]
=
(
block
[
0
]
>>
24
)
&
0xff
;
outbuf
[
1
]
=
(
block
[
0
]
>>
16
)
&
0xff
;
outbuf
[
2
]
=
(
block
[
0
]
>>
8
)
&
0xff
;
outbuf
[
3
]
=
block
[
0
]
&
0xff
;
outbuf
[
4
]
=
(
block
[
1
]
>>
24
)
&
0xff
;
outbuf
[
5
]
=
(
block
[
1
]
>>
16
)
&
0xff
;
outbuf
[
6
]
=
(
block
[
1
]
>>
8
)
&
0xff
;
outbuf
[
7
]
=
block
[
1
]
&
0xff
;
outbuf
[
8
]
=
(
block
[
2
]
>>
24
)
&
0xff
;
outbuf
[
9
]
=
(
block
[
2
]
>>
16
)
&
0xff
;
outbuf
[
10
]
=
(
block
[
2
]
>>
8
)
&
0xff
;
outbuf
[
11
]
=
block
[
2
]
&
0xff
;
outbuf
[
12
]
=
(
block
[
3
]
>>
24
)
&
0xff
;
outbuf
[
13
]
=
(
block
[
3
]
>>
16
)
&
0xff
;
outbuf
[
14
]
=
(
block
[
3
]
>>
8
)
&
0xff
;
outbuf
[
15
]
=
block
[
3
]
&
0xff
;
}
static
struct
crypto_alg
alg
=
{
.
cra_name
=
"cast6"
,
.
cra_flags
=
CRYPTO_ALG_TYPE_CIPHER
,
.
cra_blocksize
=
CAST6_BLOCK_SIZE
,
.
cra_ctxsize
=
sizeof
(
struct
cast6_ctx
),
.
cra_module
=
THIS_MODULE
,
.
cra_list
=
LIST_HEAD_INIT
(
alg
.
cra_list
),
.
cra_u
=
{
.
cipher
=
{
.
cia_min_keysize
=
CAST6_MIN_KEY_SIZE
,
.
cia_max_keysize
=
CAST6_MAX_KEY_SIZE
,
.
cia_ivsize
=
CAST6_BLOCK_SIZE
,
.
cia_setkey
=
cast6_setkey
,
.
cia_encrypt
=
cast6_encrypt
,
.
cia_decrypt
=
cast6_decrypt
}
}
};
static
int
__init
init
(
void
)
{
return
crypto_register_alg
(
&
alg
);
}
static
void
__exit
fini
(
void
)
{
crypto_unregister_alg
(
&
alg
);
}
module_init
(
init
);
module_exit
(
fini
);
MODULE_LICENSE
(
"GPL"
);
MODULE_DESCRIPTION
(
"Cast6 Cipher Algorithm"
);
crypto/tcrypt.c
View file @
8e5db3dc
...
...
@@ -48,8 +48,8 @@ static char *tvmem;
static
char
*
check
[]
=
{
"des"
,
"md5"
,
"des3_ede"
,
"rot13"
,
"sha1"
,
"sha256"
,
"blowfish"
,
"twofish"
,
"serpent"
,
"sha384"
,
"sha512"
,
"md4"
,
"aes"
,
"
deflate"
,
NULL
"twofish"
,
"serpent"
,
"sha384"
,
"sha512"
,
"md4"
,
"aes"
,
"
cast6"
,
"deflate"
,
NULL
};
static
void
...
...
@@ -2087,6 +2087,105 @@ test_serpent(void)
crypto_free_tfm
(
tfm
);
}
static
void
test_cast6
(
void
)
{
unsigned
int
ret
,
i
,
tsize
;
u8
*
p
,
*
q
,
*
key
;
struct
crypto_tfm
*
tfm
;
struct
cast6_tv
*
cast_tv
;
struct
scatterlist
sg
[
1
];
printk
(
"
\n
testing cast6 encryption
\n
"
);
tfm
=
crypto_alloc_tfm
(
"cast6"
,
0
);
if
(
tfm
==
NULL
)
{
printk
(
"failed to load transform for cast6 (default ecb)
\n
"
);
return
;
}
tsize
=
sizeof
(
cast6_enc_tv_template
);
if
(
tsize
>
TVMEMSIZE
)
{
printk
(
"template (%u) too big for tvmem (%u)
\n
"
,
tsize
,
TVMEMSIZE
);
return
;
}
memcpy
(
tvmem
,
cast6_enc_tv_template
,
tsize
);
cast_tv
=
(
void
*
)
tvmem
;
for
(
i
=
0
;
i
<
CAST6_ENC_TEST_VECTORS
;
i
++
)
{
printk
(
"test %u (%d bit key):
\n
"
,
i
+
1
,
cast_tv
[
i
].
keylen
*
8
);
key
=
cast_tv
[
i
].
key
;
ret
=
crypto_cipher_setkey
(
tfm
,
key
,
cast_tv
[
i
].
keylen
);
if
(
ret
)
{
printk
(
"setkey() failed flags=%x
\n
"
,
tfm
->
crt_flags
);
if
(
!
cast_tv
[
i
].
fail
)
goto
out
;
}
p
=
cast_tv
[
i
].
plaintext
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
0
].
length
=
sizeof
(
cast_tv
[
i
].
plaintext
);
ret
=
crypto_cipher_encrypt
(
tfm
,
sg
,
sg
,
sg
[
0
].
length
);
if
(
ret
)
{
printk
(
"encrypt() failed flags=%x
\n
"
,
tfm
->
crt_flags
);
goto
out
;
}
q
=
kmap
(
sg
[
0
].
page
)
+
sg
[
0
].
offset
;
hexdump
(
q
,
sizeof
(
cast_tv
[
i
].
result
));
printk
(
"%s
\n
"
,
memcmp
(
q
,
cast_tv
[
i
].
result
,
sizeof
(
cast_tv
[
i
].
result
))
?
"fail"
:
"pass"
);
}
printk
(
"
\n
testing cast6 decryption
\n
"
);
tsize
=
sizeof
(
cast6_dec_tv_template
);
if
(
tsize
>
TVMEMSIZE
)
{
printk
(
"template (%u) too big for tvmem (%u)
\n
"
,
tsize
,
TVMEMSIZE
);
return
;
}
memcpy
(
tvmem
,
cast6_dec_tv_template
,
tsize
);
cast_tv
=
(
void
*
)
tvmem
;
for
(
i
=
0
;
i
<
CAST6_DEC_TEST_VECTORS
;
i
++
)
{
printk
(
"test %u (%d bit key):
\n
"
,
i
+
1
,
cast_tv
[
i
].
keylen
*
8
);
key
=
cast_tv
[
i
].
key
;
ret
=
crypto_cipher_setkey
(
tfm
,
key
,
cast_tv
[
i
].
keylen
);
if
(
ret
)
{
printk
(
"setkey() failed flags=%x
\n
"
,
tfm
->
crt_flags
);
if
(
!
cast_tv
[
i
].
fail
)
goto
out
;
}
p
=
cast_tv
[
i
].
plaintext
;
sg
[
0
].
page
=
virt_to_page
(
p
);
sg
[
0
].
offset
=
((
long
)
p
&
~
PAGE_MASK
);
sg
[
0
].
length
=
sizeof
(
cast_tv
[
i
].
plaintext
);
ret
=
crypto_cipher_decrypt
(
tfm
,
sg
,
sg
,
sg
[
0
].
length
);
if
(
ret
)
{
printk
(
"decrypt() failed flags=%x
\n
"
,
tfm
->
crt_flags
);
goto
out
;
}
q
=
kmap
(
sg
[
0
].
page
)
+
sg
[
0
].
offset
;
hexdump
(
q
,
sizeof
(
cast_tv
[
i
].
result
));
printk
(
"%s
\n
"
,
memcmp
(
q
,
cast_tv
[
i
].
result
,
sizeof
(
cast_tv
[
i
].
result
))
?
"fail"
:
"pass"
);
}
out:
crypto_free_tfm
(
tfm
);
}
void
test_aes
(
void
)
{
...
...
@@ -2396,11 +2495,13 @@ do_test(void)
test_blowfish
();
test_twofish
();
test_serpent
();
test_cast6
();
test_aes
();
test_sha384
();
test_sha512
();
test_deflate
();
test_cast5
();
test_cast6
();
#ifdef CONFIG_CRYPTO_HMAC
test_hmac_md5
();
test_hmac_sha1
();
...
...
@@ -2464,6 +2565,10 @@ do_test(void)
test_cast5
();
break
;
case
15
:
test_cast6
();
break
;
#ifdef CONFIG_CRYPTO_HMAC
case
100
:
test_hmac_md5
();
...
...
crypto/tcrypt.h
View file @
8e5db3dc
...
...
@@ -1589,6 +1589,93 @@ struct serpent_tv serpent_dec_tv_template[] =
}
};
/* Cast6 test vectors from RFC 2612 */
#define CAST6_ENC_TEST_VECTORS 3
#define CAST6_DEC_TEST_VECTORS 3
struct
cast6_tv
{
unsigned
keylen
;
unsigned
fail
;
u8
key
[
32
];
u8
plaintext
[
16
];
u8
result
[
16
];
};
struct
cast6_tv
cast6_enc_tv_template
[]
=
{
{
16
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0x0a
,
0xf7
,
0x56
,
0x47
,
0xf2
,
0x9f
,
0x61
,
0x5d
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
{
0xc8
,
0x42
,
0xa0
,
0x89
,
0x72
,
0xb4
,
0x3d
,
0x20
,
0x83
,
0x6c
,
0x91
,
0xd1
,
0xb7
,
0x53
,
0x0f
,
0x6b
},
},
{
24
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0xbe
,
0xd0
,
0xac
,
0x83
,
0x94
,
0x0a
,
0xc2
,
0x98
,
0xba
,
0xc7
,
0x7a
,
0x77
,
0x17
,
0x94
,
0x28
,
0x63
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
{
0x1b
,
0x38
,
0x6c
,
0x02
,
0x10
,
0xdc
,
0xad
,
0xcb
,
0xdd
,
0x0e
,
0x41
,
0xaa
,
0x08
,
0xa7
,
0xa7
,
0xe8
},
},
{
32
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0xbe
,
0xd0
,
0xac
,
0x83
,
0x94
,
0x0a
,
0xc2
,
0x98
,
0x8d
,
0x7c
,
0x47
,
0xce
,
0x26
,
0x49
,
0x08
,
0x46
,
0x1c
,
0xc1
,
0xb5
,
0x13
,
0x7a
,
0xe6
,
0xb6
,
0x04
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
{
0x4f
,
0x6a
,
0x20
,
0x38
,
0x28
,
0x68
,
0x97
,
0xb9
,
0xc9
,
0x87
,
0x01
,
0x36
,
0x55
,
0x33
,
0x17
,
0xfa
},
}
};
struct
cast6_tv
cast6_dec_tv_template
[]
=
{
{
16
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0x0a
,
0xf7
,
0x56
,
0x47
,
0xf2
,
0x9f
,
0x61
,
0x5d
},
{
0xc8
,
0x42
,
0xa0
,
0x89
,
0x72
,
0xb4
,
0x3d
,
0x20
,
0x83
,
0x6c
,
0x91
,
0xd1
,
0xb7
,
0x53
,
0x0f
,
0x6b
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
},
{
24
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0xbe
,
0xd0
,
0xac
,
0x83
,
0x94
,
0x0a
,
0xc2
,
0x98
,
0xba
,
0xc7
,
0x7a
,
0x77
,
0x17
,
0x94
,
0x28
,
0x63
},
{
0x1b
,
0x38
,
0x6c
,
0x02
,
0x10
,
0xdc
,
0xad
,
0xcb
,
0xdd
,
0x0e
,
0x41
,
0xaa
,
0x08
,
0xa7
,
0xa7
,
0xe8
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
},
{
32
,
0
,
{
0x23
,
0x42
,
0xbb
,
0x9e
,
0xfa
,
0x38
,
0x54
,
0x2c
,
0xbe
,
0xd0
,
0xac
,
0x83
,
0x94
,
0x0a
,
0xc2
,
0x98
,
0x8d
,
0x7c
,
0x47
,
0xce
,
0x26
,
0x49
,
0x08
,
0x46
,
0x1c
,
0xc1
,
0xb5
,
0x13
,
0x7a
,
0xe6
,
0xb6
,
0x04
},
{
0x4f
,
0x6a
,
0x20
,
0x38
,
0x28
,
0x68
,
0x97
,
0xb9
,
0xc9
,
0x87
,
0x01
,
0x36
,
0x55
,
0x33
,
0x17
,
0xfa
},
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
}
};
/*
* AES test vectors.
*/
...
...
drivers/ieee1394/nodemgr.c
View file @
8e5db3dc
...
...
@@ -460,21 +460,6 @@ static void nodemgr_remove_node_uds(struct node_entry *ne)
}
static
void
nodemgr_update_ud_names
(
struct
host_info
*
hi
,
struct
node_entry
*
ne
)
{
struct
list_head
*
lh
;
list_for_each
(
lh
,
&
ne
->
device
.
children
)
{
struct
unit_directory
*
ud
;
ud
=
container_of
(
list_to_dev
(
lh
),
struct
unit_directory
,
device
);
snprintf
(
ud
->
device
.
name
,
DEVICE_NAME_SIZE
,
"IEEE-1394 unit directory "
NODE_BUS_FMT
"-%u"
,
NODE_BUS_ARGS
(
hi
->
host
,
ne
->
nodeid
),
ud
->
id
);
}
}
static
void
nodemgr_remove_ne
(
struct
node_entry
*
ne
)
{
struct
device
*
dev
=
&
ne
->
device
;
...
...
@@ -720,9 +705,6 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, quadlet_t busoption
ne
->
device
.
parent
=
&
host
->
device
;
snprintf
(
ne
->
device
.
bus_id
,
BUS_ID_SIZE
,
"%016Lx"
,
(
unsigned
long
long
)(
ne
->
guid
));
snprintf
(
ne
->
device
.
name
,
DEVICE_NAME_SIZE
,
"IEEE-1394 device "
NODE_BUS_FMT
,
NODE_BUS_ARGS
(
host
,
ne
->
nodeid
));
device_register
(
&
ne
->
device
);
...
...
@@ -732,8 +714,6 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, quadlet_t busoption
nodemgr_process_config_rom
(
hi
,
ne
,
busoptions
);
nodemgr_update_ud_names
(
hi
,
ne
);
HPSB_DEBUG
(
"%s added: ID:BUS["
NODE_BUS_FMT
"] GUID[%016Lx]"
,
(
host
->
node_id
==
nodeid
)
?
"Host"
:
"Node"
,
NODE_BUS_ARGS
(
host
,
nodeid
),
(
unsigned
long
long
)
guid
);
...
...
@@ -1312,18 +1292,11 @@ static void nodemgr_update_node(struct node_entry *ne, quadlet_t busoptions,
struct
host_info
*
hi
,
nodeid_t
nodeid
,
unsigned
int
generation
)
{
int
update_ud_names
=
0
;
if
(
ne
->
nodeid
!=
nodeid
)
{
snprintf
(
ne
->
device
.
name
,
DEVICE_NAME_SIZE
,
"IEEE-1394 device "
NODE_BUS_FMT
,
NODE_BUS_ARGS
(
hi
->
host
,
ne
->
nodeid
));
HPSB_DEBUG
(
"Node changed: "
NODE_BUS_FMT
" -> "
NODE_BUS_FMT
,
NODE_BUS_ARGS
(
ne
->
host
,
ne
->
nodeid
),
NODE_BUS_ARGS
(
ne
->
host
,
nodeid
));
ne
->
nodeid
=
nodeid
;
update_ud_names
++
;
}
if
(
ne
->
busopt
.
generation
!=
((
busoptions
>>
4
)
&
0xf
))
{
...
...
@@ -1333,13 +1306,8 @@ static void nodemgr_update_node(struct node_entry *ne, quadlet_t busoptions,
/* This will re-register our unitdir's */
nodemgr_process_config_rom
(
hi
,
ne
,
busoptions
);
update_ud_names
++
;
}
if
(
update_ud_names
)
nodemgr_update_ud_names
(
hi
,
ne
);
/* Since that's done, we can declare this record current */
ne
->
generation
=
generation
;
...
...
@@ -1772,8 +1740,6 @@ static void nodemgr_add_host(struct hpsb_host *host)
sizeof
(
host
->
device
));
host
->
device
.
parent
=
&
host
->
pdev
->
dev
;
snprintf
(
host
->
device
.
bus_id
,
BUS_ID_SIZE
,
"fw-host%d"
,
host
->
id
);
snprintf
(
host
->
device
.
name
,
DEVICE_NAME_SIZE
,
"IEEE-1394 Host %s-%d"
,
host
->
driver
->
name
,
host
->
id
);
sprintf
(
hi
->
daemon_name
,
"knodemgrd_%d"
,
host
->
id
);
...
...
drivers/ieee1394/pcilynx.c
View file @
8e5db3dc
...
...
@@ -144,9 +144,7 @@ static struct i2c_adapter bit_ops = {
.
id
=
0xAA
,
//FIXME: probably we should get an id in i2c-id.h
.
client_register
=
bit_reg
,
.
client_unregister
=
bit_unreg
,
.
dev
=
{
.
name
=
"PCILynx I2C"
,
},
};
...
...
drivers/macintosh/macio_asic.c
View file @
8e5db3dc
...
...
@@ -141,9 +141,6 @@ macio_add_one_device(struct macio_chip *chip, struct device *parent,
dev
->
ofdev
.
dev
.
parent
=
parent
;
dev
->
ofdev
.
dev
.
bus
=
&
macio_bus_type
;
/* XXX Make something better here ? */
snprintf
(
dev
->
ofdev
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"MacIO device %s"
,
np
->
name
);
/* MacIO itself has a different reg, we use it's PCI base */
if
(
np
==
chip
->
of_node
)
{
sprintf
(
dev
->
ofdev
.
dev
.
bus_id
,
"%1d.%08lx:%.8s"
,
chip
->
lbus
.
index
,
...
...
drivers/net/irda/irtty.c
View file @
8e5db3dc
...
...
@@ -39,9 +39,6 @@
#include <net/irda/wrapper.h>
#include <net/irda/irda_device.h>
static
hashbin_t
*
irtty
=
NULL
;
static
struct
tty_ldisc
irda_ldisc
;
static
int
qos_mtt_bits
=
0x03
;
/* 5 ms or more */
/* Network device fuction prototypes */
...
...
@@ -55,7 +52,8 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev);
/* Line discipline function prototypes */
static
int
irtty_open
(
struct
tty_struct
*
tty
);
static
void
irtty_close
(
struct
tty_struct
*
tty
);
static
int
irtty_ioctl
(
struct
tty_struct
*
,
void
*
,
int
,
void
*
);
static
int
irtty_ioctl
(
struct
tty_struct
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
);
static
int
irtty_receive_room
(
struct
tty_struct
*
tty
);
static
void
irtty_write_wakeup
(
struct
tty_struct
*
tty
);
static
void
irtty_receive_buf
(
struct
tty_struct
*
,
const
unsigned
char
*
,
...
...
@@ -69,37 +67,22 @@ static int irtty_raw_read(struct net_device *dev, __u8 *buf, int len);
static
int
irtty_set_mode
(
struct
net_device
*
dev
,
int
mode
);
static
int
irtty_change_speed
(
struct
irda_task
*
task
);
char
*
driver_name
=
"irtty"
;
static
struct
tty_ldisc
irda_ldisc
=
{
.
owner
=
THIS_MODULE
,
.
magic
=
TTY_LDISC_MAGIC
,
.
name
=
"irda"
,
.
open
=
irtty_open
,
.
close
=
irtty_close
,
.
ioctl
=
irtty_ioctl
,
.
receive_buf
=
irtty_receive_buf
,
.
receive_room
=
irtty_receive_room
,
.
write_wakeup
=
irtty_write_wakeup
,
};
int
__init
irtty_init
(
void
)
{
int
status
;
/* Probably no need to lock here because all operations done in
* open()/close() which are already safe - Jean II */
irtty
=
hashbin_new
(
HB_NOLOCK
);
if
(
irtty
==
NULL
)
{
printk
(
KERN_WARNING
"IrDA: Can't allocate irtty hashbin!
\n
"
);
return
-
ENOMEM
;
}
/* Fill in our line protocol discipline, and register it */
memset
(
&
irda_ldisc
,
0
,
sizeof
(
irda_ldisc
));
irda_ldisc
.
magic
=
TTY_LDISC_MAGIC
;
irda_ldisc
.
name
=
"irda"
;
irda_ldisc
.
flags
=
0
;
irda_ldisc
.
open
=
irtty_open
;
irda_ldisc
.
close
=
irtty_close
;
irda_ldisc
.
read
=
NULL
;
irda_ldisc
.
write
=
NULL
;
irda_ldisc
.
ioctl
=
(
int
(
*
)(
struct
tty_struct
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
))
irtty_ioctl
;
irda_ldisc
.
poll
=
NULL
;
irda_ldisc
.
receive_buf
=
irtty_receive_buf
;
irda_ldisc
.
receive_room
=
irtty_receive_room
;
irda_ldisc
.
write_wakeup
=
irtty_write_wakeup
;
if
((
status
=
tty_register_ldisc
(
N_IRDA
,
&
irda_ldisc
))
!=
0
)
{
ERROR
(
"IrDA: can't register line discipline (err = %d)
\n
"
,
status
);
...
...
@@ -124,12 +107,6 @@ static void __exit irtty_cleanup(void)
__FUNCTION__
,
ret
);
}
/*
* The TTY should care of deallocating the instances by using the
* callback to irtty_close(), therefore we do give any deallocation
* function to hashbin_destroy().
*/
hashbin_delete
(
irtty
,
NULL
);
}
/*
...
...
@@ -172,8 +149,6 @@ static int irtty_open(struct tty_struct *tty)
/* Give self a name */
strcpy
(
name
,
tty
->
name
);
hashbin_insert
(
irtty
,
(
irda_queue_t
*
)
self
,
(
int
)
self
,
NULL
);
if
(
tty
->
driver
->
flush_buffer
)
tty
->
driver
->
flush_buffer
(
tty
);
...
...
@@ -251,8 +226,6 @@ static int irtty_open(struct tty_struct *tty)
MESSAGE
(
"IrDA: Registered device %s
\n
"
,
dev
->
name
);
MOD_INC_USE_COUNT
;
return
0
;
}
...
...
@@ -285,8 +258,6 @@ static void irtty_close(struct tty_struct *tty)
if
(
self
->
netdev
)
unregister_netdev
(
self
->
netdev
);
self
=
hashbin_remove
(
irtty
,
(
int
)
self
,
NULL
);
/* Protect access to self->task and self->?x_buff - Jean II */
spin_lock_irqsave
(
&
self
->
lock
,
flags
);
...
...
@@ -305,8 +276,6 @@ static void irtty_close(struct tty_struct *tty)
spin_unlock_irqrestore
(
&
self
->
lock
,
flags
);
kfree
(
self
);
MOD_DEC_USE_COUNT
;
}
/*
...
...
@@ -487,7 +456,8 @@ static int irtty_change_speed(struct irda_task *task)
* The Swiss army knife of system calls :-)
*
*/
static
int
irtty_ioctl
(
struct
tty_struct
*
tty
,
void
*
file
,
int
cmd
,
void
*
arg
)
static
int
irtty_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
dongle_t
*
dongle
;
struct
irtty_info
info
;
...
...
@@ -511,8 +481,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
case
TCGETS
:
case
TCGETA
:
/* Unsure about locking here, to check - Jean II */
return
n_tty_ioctl
(
tty
,
(
struct
file
*
)
file
,
cmd
,
(
unsigned
long
)
arg
);
return
n_tty_ioctl
(
tty
,
(
struct
file
*
)
file
,
cmd
,
arg
);
break
;
case
IRTTY_IOCTDONGLE
:
/* Initialize dongle */
...
...
@@ -543,7 +512,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
memset
(
&
info
,
0
,
sizeof
(
struct
irtty_info
));
strncpy
(
info
.
name
,
self
->
netdev
->
name
,
5
);
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
struct
irtty_info
)))
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
struct
irtty_info
)))
return
-
EFAULT
;
break
;
default:
...
...
@@ -938,7 +907,6 @@ static int irtty_net_open(struct net_device *dev)
{
struct
irtty_cb
*
self
=
(
struct
irtty_cb
*
)
dev
->
priv
;
struct
tty_struct
*
tty
=
self
->
tty
;
char
hwname
[
16
];
ASSERT
(
self
!=
NULL
,
return
-
1
;);
ASSERT
(
self
->
magic
==
IRTTY_MAGIC
,
return
-
1
;);
...
...
@@ -951,16 +919,11 @@ static int irtty_net_open(struct net_device *dev)
/* Make sure we can receive more data */
irtty_stop_receiver
(
self
,
FALSE
);
/* Give self a hardware name */
sprintf
(
hwname
,
"%s"
,
tty
->
name
);
/*
* Open new IrLAP layer instance, now that everything should be
* initialized properly
*/
self
->
irlap
=
irlap_open
(
dev
,
&
self
->
qos
,
hwname
);
MOD_INC_USE_COUNT
;
self
->
irlap
=
irlap_open
(
dev
,
&
self
->
qos
,
tty
->
name
);
return
0
;
}
...
...
@@ -983,8 +946,6 @@ static int irtty_net_close(struct net_device *dev)
irlap_close
(
self
->
irlap
);
self
->
irlap
=
NULL
;
MOD_DEC_USE_COUNT
;
return
0
;
}
...
...
drivers/net/tokenring/ibmtr.c
View file @
8e5db3dc
...
...
@@ -876,7 +876,6 @@ static int tok_open(struct net_device *dev)
if
(
i
==
0
)
break
;
if
(
ti
->
open_status
==
OPEN
&&
ti
->
sap_status
==
OPEN
)
{
netif_start_queue
(
dev
);
MOD_INC_USE_COUNT
;
DPRINTK
(
"Adapter is up and running
\n
"
);
return
0
;
}
...
...
@@ -1041,7 +1040,6 @@ static int tok_close(struct net_device *dev)
netif_stop_queue
(
dev
);
DPRINTK
(
"Adapter is closed.
\n
"
);
MOD_DEC_USE_COUNT
;
return
0
;
}
...
...
@@ -1918,7 +1916,7 @@ MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
MODULE_PARM
(
irq
,
"1-"
__MODULE_STRING
(
IBMTR_MAX_ADAPTERS
)
"i"
);
MODULE_PARM
(
mem
,
"1-"
__MODULE_STRING
(
IBMTR_MAX_ADAPTERS
)
"i"
);
int
init_module
(
void
)
static
int
__init
ibmtr_init
(
void
)
{
int
i
;
int
count
=
0
;
...
...
@@ -1948,21 +1946,24 @@ int init_module(void)
if
(
count
)
return
0
;
printk
(
"ibmtr: register_netdev() returned non-zero.
\n
"
);
return
-
EIO
;
}
/*init_module */
}
module_init
(
ibmtr_init
);
void
cleanup_module
(
void
)
static
void
__exit
ibmtr_cleanup
(
void
)
{
int
i
,
j
;
int
i
;
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
){
if
(
!
dev_ibmtr
[
i
])
continue
;
if
(
dev_ibmtr
[
i
]
->
base_addr
)
{
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESET
);
for
(
j
=
jiffies
+
TR_RST_TIME
;
time_before_eq
(
jiffies
,
j
);)
;
schedule_timeout
(
TR_RST_TIME
);
/* wait 50ms */
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESETREL
);
}
unregister_netdev
(
dev_ibmtr
[
i
]);
free_irq
(
dev_ibmtr
[
i
]
->
irq
,
dev_ibmtr
[
i
]);
release_region
(
dev_ibmtr
[
i
]
->
base_addr
,
IBMTR_IO_EXTENT
);
...
...
@@ -1978,4 +1979,5 @@ void cleanup_module(void)
dev_ibmtr
[
i
]
=
NULL
;
}
}
#endif
/* MODULE */
module_exit
(
ibmtr_cleanup
);
#endif
drivers/scsi/ide-scsi.c
View file @
8e5db3dc
...
...
@@ -948,7 +948,6 @@ static Scsi_Host_Template idescsi_template = {
};
static
struct
device
idescsi_primary
=
{
.
name
=
"Ide-scsi Parent"
,
.
bus_id
=
"ide-scsi"
,
};
static
struct
bus_type
idescsi_emu_bus
=
{
...
...
include/linux/netdevice.h
View file @
8e5db3dc
...
...
@@ -463,9 +463,6 @@ struct net_device
/* class/net/name entry */
struct
class_device
class_dev
;
/* statistics sub-directory */
struct
kobject
stats_kobj
;
};
#define SET_MODULE_OWNER(dev) do { } while (0)
...
...
include/linux/pci_ids.h
View file @
8e5db3dc
...
...
@@ -209,9 +209,29 @@
#define PCI_DEVICE_ID_ATI_215_LR 0x4c52
#define PCI_DEVICE_ID_ATI_215_LS 0x4c53
#define PCI_DEVICE_ID_ATI_264_LT 0x4c54
/* Radeon M4 */
#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45
#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46
/* Mach64 VT */
#define PCI_DEVICE_ID_ATI_264VT 0x5654
#define PCI_DEVICE_ID_ATI_264VU 0x5655
#define PCI_DEVICE_ID_ATI_264VV 0x5656
/* Rage128 GL */
#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x534b
#define PCI_DEVICE_ID_ATI_RAGE128_RH 0x534c
#define PCI_DEVICE_ID_ATI_RAGE128_RI 0x534d
/* Rage128 VR */
#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b
#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c
#define PCI_DEVICE_ID_ATI_RAGE128_RM 0x5345
#define PCI_DEVICE_ID_ATI_RAGE128_RN 0x5346
#define PCI_DEVICE_ID_ATI_RAGE128_RO 0x5347
/* Rage128 M3 */
#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45
#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46
/* Rage128 Pro Ultra */
#define PCI_DEVICE_ID_ATI_RAGE128_U1 0x5446
#define PCI_DEVICE_ID_ATI_RAGE128_U2 0x544C
#define PCI_DEVICE_ID_ATI_RAGE128_U3 0x5452
/* Rage128 Pro GL */
#define PCI_DEVICE_ID_ATI_Rage128_PA 0x5041
#define PCI_DEVICE_ID_ATI_Rage128_PB 0x5042
...
...
@@ -239,75 +259,69 @@
#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056
#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057
#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058
/* Rage128 M4 */
#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45
#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46
/* Radeon R100 */
#define PCI_DEVICE_ID_ATI_RADEON_QD 0x5144
#define PCI_DEVICE_ID_ATI_RADEON_QE 0x5145
#define PCI_DEVICE_ID_ATI_RADEON_QF 0x5146
#define PCI_DEVICE_ID_ATI_RADEON_QG 0x5147
/* Radeon RV100 (VE) */
#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
#define PCI_DEVICE_ID_ATI_RADEON_QZ 0x515a
/* Radeon R200 (8500) */
#define PCI_DEVICE_ID_ATI_RADEON_QL 0x514c
#define PCI_DEVICE_ID_ATI_RADEON_QN 0x514e
#define PCI_DEVICE_ID_ATI_RADEON_QO 0x514f
#define PCI_DEVICE_ID_ATI_RADEON_Ql 0x516c
#define PCI_DEVICE_ID_ATI_RADEON_BB 0x4242
/* Radeon R200 (9100) */
#define PCI_DEVICE_ID_ATI_RADEON_QM 0x514d
/* Radeon RV200 (7500) */
#define PCI_DEVICE_ID_ATI_RADEON_QW 0x5157
#define PCI_DEVICE_ID_ATI_RADEON_QX 0x5158
/* Radeon NV-100 */
#define PCI_DEVICE_ID_ATI_RADEON_N1 0x5159
#define PCI_DEVICE_ID_ATI_RADEON_N2 0x515a
/* Radeon RV100 (VE) */
#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
#define PCI_DEVICE_ID_ATI_RADEON_QZ 0x515a
/* Radeon RV250 (9000) */
#define PCI_DEVICE_ID_ATI_RADEON_Id 0x4964
#define PCI_DEVICE_ID_ATI_RADEON_Ie 0x4965
#define PCI_DEVICE_ID_ATI_RADEON_If 0x4966
#define PCI_DEVICE_ID_ATI_RADEON_Ig 0x4967
#define PCI_DEVICE_ID_ATI_RADEON_QM 0x514d
/* Radeon RV280 (9200) */
#define PCI_DEVICE_ID_ATI_RADEON_Y_ 0x5960
/* Radeon R300 (9500) */
#define PCI_DEVICE_ID_ATI_RADEON_AD 0x4144
/* Radeon R300 (9700) */
#define PCI_DEVICE_ID_ATI_RADEON_ND 0x4e44
#define PCI_DEVICE_ID_ATI_RADEON_NE 0x4e45
#define PCI_DEVICE_ID_ATI_RADEON_NF 0x4e46
#define PCI_DEVICE_ID_ATI_RADEON_NG 0x4e47
#define PCI_DEVICE_ID_ATI_RADEON_AE 0x4145
#define PCI_DEVICE_ID_ATI_RADEON_AF 0x4146
/* Radeon R350 (9800) */
#define PCI_DEVICE_ID_ATI_RADEON_NH 0x4e48
#define PCI_DEVICE_ID_ATI_RADEON_NI 0x4e49
/* Radeon RV350 (9600) */
#define PCI_DEVICE_ID_ATI_RADEON_AP 0x4150
#define PCI_DEVICE_ID_ATI_RADEON_AR 0x4152
/* Radeon M6 */
#define PCI_DEVICE_ID_ATI_RADEON_LY 0x4c59
#define PCI_DEVICE_ID_ATI_RADEON_LZ 0x4c5a
/* Radeon M7 */
#define PCI_DEVICE_ID_ATI_RADEON_LW 0x4c57
#define PCI_DEVICE_ID_ATI_RADEON_LX 0x4c58
#define PCI_DEVICE_ID_ATI_RADEON_Ld 0x4964
#define PCI_DEVICE_ID_ATI_RADEON_Le 0x4965
#define PCI_DEVICE_ID_ATI_RADEON_Lf 0x4966
#define PCI_DEVICE_ID_ATI_RADEON_Lg 0x4967
/* Radeon M9 */
#define PCI_DEVICE_ID_ATI_RADEON_Ld 0x4c64
#define PCI_DEVICE_ID_ATI_RADEON_Le 0x4c65
#define PCI_DEVICE_ID_ATI_RADEON_Lf 0x4c66
#define PCI_DEVICE_ID_ATI_RADEON_Lg 0x4c67
/* Radeon */
#define PCI_DEVICE_ID_ATI_RADEON_RA 0x5144
#define PCI_DEVICE_ID_ATI_RADEON_RB 0x5145
#define PCI_DEVICE_ID_ATI_RADEON_RC 0x5146
#define PCI_DEVICE_ID_ATI_RADEON_RD 0x5147
/* Rage128 GL */
#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x534b
#define PCI_DEVICE_ID_ATI_RAGE128_RH 0x534c
#define PCI_DEVICE_ID_ATI_RAGE128_RI 0x534d
/* Rage128 VR */
#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b
#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c
#define PCI_DEVICE_ID_ATI_RAGE128_RM 0x5345
#define PCI_DEVICE_ID_ATI_RAGE128_RN 0x5346
#define PCI_DEVICE_ID_ATI_RAGE128_RO 0x5347
/* Rage128 M3 */
#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45
#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46
/* Rage128 Pro Ultra */
#define PCI_DEVICE_ID_ATI_RAGE128_U1 0x5446
#define PCI_DEVICE_ID_ATI_RAGE128_U2 0x544C
#define PCI_DEVICE_ID_ATI_RAGE128_U3 0x5452
/* Mach64 VT */
#define PCI_DEVICE_ID_ATI_264VT 0x5654
#define PCI_DEVICE_ID_ATI_264VU 0x5655
#define PCI_DEVICE_ID_ATI_264VV 0x5656
/* RadeonIGP */
#define PCI_DEVICE_ID_ATI_RS100 0xcab0
#define PCI_DEVICE_ID_ATI_RS200 0xcab2
...
...
include/linux/pfkeyv2.h
View file @
8e5db3dc
...
...
@@ -284,7 +284,10 @@ struct sadb_x_nat_t_port {
#define SADB_X_EALG_BLOWFISHCBC 7
#define SADB_EALG_NULL 11
#define SADB_X_EALG_AESCBC 12
#define SADB_EALG_MAX 12
#define SADB_EALG_MAX 253
/* last EALG */
/* private allocations should use 249-255 (RFC2407) */
#define SADB_X_EALG_SERPENTCBC 252
/* draft-ietf-ipsec-ciph-aes-cbc-00 */
#define SADB_X_EALG_TWOFISHCBC 253
/* draft-ietf-ipsec-ciph-aes-cbc-00 */
/* Compression algorithms */
#define SADB_X_CALG_NONE 0
...
...
include/net/irda/irda_device.h
View file @
8e5db3dc
...
...
@@ -209,7 +209,7 @@ void irda_device_cleanup(void);
* We declare them here to avoid the driver pulling a whole bunch stack
* headers they don't really need - Jean II */
struct
irlap_cb
*
irlap_open
(
struct
net_device
*
dev
,
struct
qos_info
*
qos
,
c
har
*
hw_name
);
c
onst
char
*
hw_name
);
void
irlap_close
(
struct
irlap_cb
*
self
);
/* Interface to be uses by IrLAP */
...
...
@@ -222,7 +222,7 @@ int irda_device_txqueue_empty(struct net_device *dev);
int
irda_device_set_raw_mode
(
struct
net_device
*
self
,
int
status
);
int
irda_device_set_dtr_rts
(
struct
net_device
*
dev
,
int
dtr
,
int
rts
);
int
irda_device_change_speed
(
struct
net_device
*
dev
,
__u32
speed
);
int
irda_device_setup
(
struct
net_device
*
dev
);
void
irda_device_setup
(
struct
net_device
*
dev
);
/* Dongle interface */
void
irda_device_unregister_dongle
(
struct
dongle_reg
*
dongle
);
...
...
include/net/irda/irlap.h
View file @
8e5db3dc
...
...
@@ -208,8 +208,6 @@ struct irlap_cb {
int
next_bofs
;
/* Negotiated extra BOFs after next frame */
};
extern
hashbin_t
*
irlap
;
/*
* Function prototypes
*/
...
...
@@ -217,7 +215,7 @@ int irlap_init(void);
void
irlap_cleanup
(
void
);
struct
irlap_cb
*
irlap_open
(
struct
net_device
*
dev
,
struct
qos_info
*
qos
,
c
har
*
hw_name
);
c
onst
char
*
hw_name
);
void
irlap_close
(
struct
irlap_cb
*
self
);
void
irlap_connect_request
(
struct
irlap_cb
*
self
,
__u32
daddr
,
...
...
include/net/irda/irtty.h
View file @
8e5db3dc
...
...
@@ -31,7 +31,6 @@
#include <linux/netdevice.h>
#include <net/irda/irda.h>
#include <net/irda/irqueue.h>
#include <net/irda/irda_device.h>
/* Used by ioctl */
...
...
@@ -45,7 +44,6 @@ struct irtty_info {
#define IRTTY_IOC_MAXNR 2
struct
irtty_cb
{
irda_queue_t
q
;
/* Must be first */
magic_t
magic
;
struct
net_device
*
netdev
;
/* Yes! we are some kind of netdevice */
...
...
net/core/dev.c
View file @
8e5db3dc
...
...
@@ -187,7 +187,6 @@ int netdev_fastroute_obstacles;
extern
int
netdev_sysfs_init
(
void
);
extern
int
netdev_register_sysfs
(
struct
net_device
*
);
extern
void
netdev_unregister_sysfs
(
struct
net_device
*
);
/*******************************************************************************
...
...
@@ -2343,14 +2342,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
case
SIOCSIFNAME
:
if
(
dev
->
flags
&
IFF_UP
)
return
-
EBUSY
;
ifr
->
ifr_newname
[
IFNAMSIZ
-
1
]
=
'\0'
;
if
(
__dev_get_by_name
(
ifr
->
ifr_newname
))
return
-
EEXIST
;
memcpy
(
dev
->
name
,
ifr
->
ifr_newname
,
IFNAMSIZ
);
dev
->
name
[
IFNAMSIZ
-
1
]
=
0
;
strlcpy
(
dev
->
class_dev
.
class_id
,
dev
->
name
,
BUS_ID_SIZE
);
err
=
class_device_rename
(
&
dev
->
class_dev
,
ifr
->
ifr_newname
);
if
(
!
err
)
{
strlcpy
(
dev
->
name
,
ifr
->
ifr_newname
,
IFNAMSIZ
);
notifier_call_chain
(
&
netdev_chain
,
NETDEV_CHANGENAME
,
dev
);
return
0
;
}
return
err
;
/*
* Unknown or private ioctl
...
...
@@ -2706,38 +2709,17 @@ int register_netdevice(struct net_device *dev)
goto
out
;
}
/**
* netdev_finish_unregister - complete unregistration
* @dev: device
/*
* netdev_wait_allrefs - wait until all references are gone.
*
* Destroy and free a dead device. A value of zero is returned on
* success.
*/
static
int
netdev_finish_unregister
(
struct
net_device
*
dev
)
{
BUG_TRAP
(
!
dev
->
ip_ptr
);
BUG_TRAP
(
!
dev
->
ip6_ptr
);
BUG_TRAP
(
!
dev
->
dn_ptr
);
if
(
dev
->
reg_state
!=
NETREG_UNREGISTERED
)
{
printk
(
KERN_ERR
"Freeing alive device %p, %s
\n
"
,
dev
,
dev
->
name
);
return
0
;
}
#ifdef NET_REFCNT_DEBUG
printk
(
KERN_DEBUG
"netdev_finish_unregister: %s%s.
\n
"
,
dev
->
name
,
(
dev
->
destructor
!=
NULL
)
?
""
:
", old style"
);
#endif
/* It must be the very last action, after this 'dev' may point
* to freed up memory.
* This is called when unregistering network devices.
*
* Any protocol or device that holds a reference should register
* for netdevice notification, and cleanup and put back the
* reference if they receive an UNREGISTER event.
* We can get stuck here if buggy protocols don't correctly
* call dev_put.
*/
if
(
dev
->
destructor
)
dev
->
destructor
(
dev
);
return
0
;
}
static
void
netdev_wait_allrefs
(
struct
net_device
*
dev
)
{
unsigned
long
rebroadcast_time
,
warning_time
;
...
...
@@ -2833,13 +2815,23 @@ void netdev_run_todo(void)
break
;
case
NETREG_UNREGISTERING
:
netdev_unregister_sysfs
(
dev
);
class_device_unregister
(
&
dev
->
class_
dev
);
dev
->
reg_state
=
NETREG_UNREGISTERED
;
netdev_wait_allrefs
(
dev
);
/* paranoia */
BUG_ON
(
atomic_read
(
&
dev
->
refcnt
));
BUG_TRAP
(
!
dev
->
ip_ptr
);
BUG_TRAP
(
!
dev
->
ip6_ptr
);
BUG_TRAP
(
!
dev
->
dn_ptr
);
netdev_finish_unregister
(
dev
);
/* It must be the very last action,
* after this 'dev' may point to freed up memory.
*/
if
(
dev
->
destructor
)
dev
->
destructor
(
dev
);
break
;
default:
...
...
net/core/net-sysfs.c
View file @
8e5db3dc
...
...
@@ -3,6 +3,10 @@
*
* Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org>
*
* 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 Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/config.h>
...
...
@@ -11,10 +15,15 @@
#include <linux/if_arp.h>
#include <net/sock.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
#define to_net_dev(class) container_of(class, struct net_device, class_dev)
static
const
char
*
fmt_hex
=
"%#x
\n
"
;
static
const
char
*
fmt_dec
=
"%d
\n
"
;
static
const
char
*
fmt_ulong
=
"%lu
\n
"
;
static
inline
int
dev_isalive
(
const
struct
net_device
*
dev
)
{
return
dev
->
reg_state
==
NETREG_REGISTERED
;
...
...
@@ -79,11 +88,11 @@ static ssize_t netdev_store(struct class_device *dev,
NETDEVICE_SHOW(field, format_string) \
static CLASS_DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) \
NETDEVICE_ATTR
(
addr_len
,
"%d
\n
"
);
NETDEVICE_ATTR
(
iflink
,
"%d
\n
"
);
NETDEVICE_ATTR
(
ifindex
,
"%d
\n
"
);
NETDEVICE_ATTR
(
features
,
"%#x
\n
"
);
NETDEVICE_ATTR
(
type
,
"%d
\n
"
);
NETDEVICE_ATTR
(
addr_len
,
fmt_dec
);
NETDEVICE_ATTR
(
iflink
,
fmt_dec
);
NETDEVICE_ATTR
(
ifindex
,
fmt_dec
);
NETDEVICE_ATTR
(
features
,
fmt_hex
);
NETDEVICE_ATTR
(
type
,
fmt_dec
);
/* use same locking rules as GIFHWADDR ioctl's */
static
ssize_t
format_addr
(
char
*
buf
,
const
unsigned
char
*
addr
,
int
len
)
...
...
@@ -91,20 +100,22 @@ static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
int
i
;
char
*
cp
=
buf
;
read_lock
(
&
dev_base_lock
);
for
(
i
=
0
;
i
<
len
;
i
++
)
cp
+=
sprintf
(
cp
,
"%02x%c"
,
addr
[
i
],
i
==
(
len
-
1
)
?
'\n'
:
':'
);
read_unlock
(
&
dev_base_lock
);
return
cp
-
buf
;
}
static
ssize_t
show_address
(
struct
class_device
*
dev
,
char
*
buf
)
{
struct
net_device
*
net
=
to_net_dev
(
dev
);
ssize_t
ret
=
-
EINVAL
;
read_lock
(
&
dev_base_lock
);
if
(
dev_isalive
(
net
))
return
format_addr
(
buf
,
net
->
dev_addr
,
net
->
addr_len
);
return
-
EINVAL
;
ret
=
format_addr
(
buf
,
net
->
dev_addr
,
net
->
addr_len
);
read_unlock
(
&
dev_base_lock
);
return
ret
;
}
static
ssize_t
show_broadcast
(
struct
class_device
*
dev
,
char
*
buf
)
...
...
@@ -119,7 +130,7 @@ static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static
CLASS_DEVICE_ATTR
(
broadcast
,
S_IRUGO
,
show_broadcast
,
NULL
);
/* read-write attributes */
NETDEVICE_SHOW
(
mtu
,
"%d
\n
"
);
NETDEVICE_SHOW
(
mtu
,
fmt_dec
);
static
int
change_mtu
(
struct
net_device
*
net
,
unsigned
long
new_mtu
)
{
...
...
@@ -133,7 +144,7 @@ static ssize_t store_mtu(struct class_device *dev, const char *buf, size_t len)
static
CLASS_DEVICE_ATTR
(
mtu
,
S_IRUGO
|
S_IWUSR
,
show_mtu
,
store_mtu
);
NETDEVICE_SHOW
(
flags
,
"%#x
\n
"
);
NETDEVICE_SHOW
(
flags
,
fmt_hex
);
static
int
change_flags
(
struct
net_device
*
net
,
unsigned
long
new_flags
)
{
...
...
@@ -147,7 +158,7 @@ static ssize_t store_flags(struct class_device *dev, const char *buf, size_t len
static
CLASS_DEVICE_ATTR
(
flags
,
S_IRUGO
|
S_IWUSR
,
show_flags
,
store_flags
);
NETDEVICE_SHOW
(
tx_queue_len
,
"%lu
\n
"
);
NETDEVICE_SHOW
(
tx_queue_len
,
fmt_ulong
);
static
int
change_tx_queue_len
(
struct
net_device
*
net
,
unsigned
long
new_len
)
{
...
...
@@ -178,107 +189,155 @@ static struct class_device_attribute *net_class_attributes[] = {
NULL
};
struct
netstat_fs_entry
{
struct
attribute
attr
;
ssize_t
(
*
show
)(
const
struct
net_device_stats
*
,
char
*
);
ssize_t
(
*
store
)(
struct
net_device_stats
*
,
const
char
*
,
size_t
);
};
static
ssize_t
net_device_stat_show
(
unsigned
long
var
,
char
*
buf
)
/* Show a given an attribute in the statistics group */
static
ssize_t
netstat_show
(
const
struct
class_device
*
cd
,
char
*
buf
,
unsigned
long
offset
)
{
return
sprintf
(
buf
,
"%lu
\n
"
,
var
);
struct
net_device
*
dev
=
to_net_dev
(
cd
);
struct
net_device_stats
*
stats
;
ssize_t
ret
=
-
EINVAL
;
if
(
offset
>
sizeof
(
struct
net_device_stats
)
||
offset
%
sizeof
(
unsigned
long
)
!=
0
)
WARN_ON
(
1
);
read_lock
(
&
dev_base_lock
);
if
(
dev_isalive
(
dev
)
&&
dev
->
get_stats
&&
(
stats
=
(
*
dev
->
get_stats
)(
dev
)))
ret
=
sprintf
(
buf
,
fmt_ulong
,
*
(
unsigned
long
*
)(((
u8
*
)
stats
)
+
offset
));
read_unlock
(
&
dev_base_lock
);
return
ret
;
}
/* generate a read-only statistics attribute */
#define NETDEVICE_STAT(_NAME) \
static ssize_t show_stat_##_NAME(const struct net_device_stats *stats, \
char *buf) \
#define NETSTAT_ENTRY(name) \
static ssize_t show_##name(struct class_device *cd, char *buf) \
{ \
return net_device_stat_show(stats->_NAME, buf); \
return netstat_show(cd, buf, \
offsetof(struct net_device_stats, name)); \
} \
static struct netstat_fs_entry net_stat_##_NAME = { \
.attr = {.name = __stringify(_NAME), .mode = S_IRUGO }, \
.show = show_stat_##_NAME, \
}
NETDEVICE_STAT
(
rx_packets
);
NETDEVICE_STAT
(
tx_packets
);
NETDEVICE_STAT
(
rx_bytes
);
NETDEVICE_STAT
(
tx_bytes
);
NETDEVICE_STAT
(
rx_errors
);
NETDEVICE_STAT
(
tx_errors
);
NETDEVICE_STAT
(
rx_dropped
);
NETDEVICE_STAT
(
tx_dropped
);
NETDEVICE_STAT
(
multicast
);
NETDEVICE_STAT
(
collisions
);
NETDEVICE_STAT
(
rx_length_errors
);
NETDEVICE_STAT
(
rx_over_errors
);
NETDEVICE_STAT
(
rx_crc_errors
);
NETDEVICE_STAT
(
rx_frame_errors
);
NETDEVICE_STAT
(
rx_fifo_errors
);
NETDEVICE_STAT
(
rx_missed_errors
);
NETDEVICE_STAT
(
tx_aborted_errors
);
NETDEVICE_STAT
(
tx_carrier_errors
);
NETDEVICE_STAT
(
tx_fifo_errors
);
NETDEVICE_STAT
(
tx_heartbeat_errors
);
NETDEVICE_STAT
(
tx_window_errors
);
NETDEVICE_STAT
(
rx_compressed
);
NETDEVICE_STAT
(
tx_compressed
);
static
struct
attribute
*
default_attrs
[]
=
{
&
net_stat_rx_packets
.
attr
,
&
net_stat_tx_packets
.
attr
,
&
net_stat_rx_bytes
.
attr
,
&
net_stat_tx_bytes
.
attr
,
&
net_stat_rx_errors
.
attr
,
&
net_stat_tx_errors
.
attr
,
&
net_stat_rx_dropped
.
attr
,
&
net_stat_tx_dropped
.
attr
,
&
net_stat_multicast
.
attr
,
&
net_stat_collisions
.
attr
,
&
net_stat_rx_length_errors
.
attr
,
&
net_stat_rx_over_errors
.
attr
,
&
net_stat_rx_crc_errors
.
attr
,
&
net_stat_rx_frame_errors
.
attr
,
&
net_stat_rx_fifo_errors
.
attr
,
&
net_stat_rx_missed_errors
.
attr
,
&
net_stat_tx_aborted_errors
.
attr
,
&
net_stat_tx_carrier_errors
.
attr
,
&
net_stat_tx_fifo_errors
.
attr
,
&
net_stat_tx_heartbeat_errors
.
attr
,
&
net_stat_tx_window_errors
.
attr
,
&
net_stat_rx_compressed
.
attr
,
&
net_stat_tx_compressed
.
attr
,
static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
NETSTAT_ENTRY
(
rx_packets
);
NETSTAT_ENTRY
(
tx_packets
);
NETSTAT_ENTRY
(
rx_bytes
);
NETSTAT_ENTRY
(
tx_bytes
);
NETSTAT_ENTRY
(
rx_errors
);
NETSTAT_ENTRY
(
tx_errors
);
NETSTAT_ENTRY
(
rx_dropped
);
NETSTAT_ENTRY
(
tx_dropped
);
NETSTAT_ENTRY
(
multicast
);
NETSTAT_ENTRY
(
collisions
);
NETSTAT_ENTRY
(
rx_length_errors
);
NETSTAT_ENTRY
(
rx_over_errors
);
NETSTAT_ENTRY
(
rx_crc_errors
);
NETSTAT_ENTRY
(
rx_frame_errors
);
NETSTAT_ENTRY
(
rx_fifo_errors
);
NETSTAT_ENTRY
(
rx_missed_errors
);
NETSTAT_ENTRY
(
tx_aborted_errors
);
NETSTAT_ENTRY
(
tx_carrier_errors
);
NETSTAT_ENTRY
(
tx_fifo_errors
);
NETSTAT_ENTRY
(
tx_heartbeat_errors
);
NETSTAT_ENTRY
(
tx_window_errors
);
NETSTAT_ENTRY
(
rx_compressed
);
NETSTAT_ENTRY
(
tx_compressed
);
static
struct
attribute
*
netstat_attrs
[]
=
{
&
class_device_attr_rx_packets
.
attr
,
&
class_device_attr_tx_packets
.
attr
,
&
class_device_attr_rx_bytes
.
attr
,
&
class_device_attr_tx_bytes
.
attr
,
&
class_device_attr_rx_errors
.
attr
,
&
class_device_attr_tx_errors
.
attr
,
&
class_device_attr_rx_dropped
.
attr
,
&
class_device_attr_tx_dropped
.
attr
,
&
class_device_attr_multicast
.
attr
,
&
class_device_attr_collisions
.
attr
,
&
class_device_attr_rx_length_errors
.
attr
,
&
class_device_attr_rx_over_errors
.
attr
,
&
class_device_attr_rx_crc_errors
.
attr
,
&
class_device_attr_rx_frame_errors
.
attr
,
&
class_device_attr_rx_fifo_errors
.
attr
,
&
class_device_attr_rx_missed_errors
.
attr
,
&
class_device_attr_tx_aborted_errors
.
attr
,
&
class_device_attr_tx_carrier_errors
.
attr
,
&
class_device_attr_tx_fifo_errors
.
attr
,
&
class_device_attr_tx_heartbeat_errors
.
attr
,
&
class_device_attr_tx_window_errors
.
attr
,
&
class_device_attr_rx_compressed
.
attr
,
&
class_device_attr_tx_compressed
.
attr
,
NULL
};
static
ssize_t
netstat_attr_show
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
char
*
buf
)
static
struct
attribute_group
netstat_group
=
{
.
name
=
"statistics"
,
.
attrs
=
netstat_attrs
,
};
#ifdef WIRELESS_EXT
/* helper function that does all the locking etc for wireless stats */
static
ssize_t
wireless_show
(
struct
class_device
*
cd
,
char
*
buf
,
ssize_t
(
*
format
)(
const
struct
iw_statistics
*
,
char
*
))
{
struct
netstat_fs_entry
*
entry
=
container_of
(
attr
,
struct
netstat_fs_entry
,
attr
);
struct
net_device
*
dev
=
to_net_dev
(
to_class_dev
(
kobj
->
parent
));
struct
net_device_stats
*
stats
;
struct
net_device
*
dev
=
to_net_dev
(
cd
);
const
struct
iw_statistics
*
iw
;
ssize_t
ret
=
-
EINVAL
;
read_lock
(
&
dev_base_lock
);
if
(
dev_isalive
(
dev
)
&&
entry
->
show
&&
dev
->
get_stats
&&
(
stats
=
(
*
dev
->
get_stats
)(
dev
)))
ret
=
entry
->
show
(
stats
,
buf
);
if
(
dev_isalive
(
dev
)
&&
dev
->
get_wireless_stats
&&
(
iw
=
dev
->
get_wireless_stats
(
dev
))
!=
NULL
)
ret
=
(
*
format
)(
iw
,
buf
);
read_unlock
(
&
dev_base_lock
);
return
ret
;
}
static
struct
sysfs_ops
netstat_sysfs_ops
=
{
.
show
=
netstat_attr_show
,
/* show function template for wireless fields */
#define WIRELESS_SHOW(name, field, format_string) \
static ssize_t format_iw_##name(const struct iw_statistics *iw, char *buf) \
{ \
return sprintf(buf, format_string, iw->field); \
} \
static ssize_t show_iw_##name(struct class_device *cd, char *buf) \
{ \
return wireless_show(cd, buf, format_iw_##name); \
} \
static CLASS_DEVICE_ATTR(name, S_IRUGO, show_iw_##name, NULL)
WIRELESS_SHOW
(
status
,
status
,
fmt_hex
);
WIRELESS_SHOW
(
link
,
qual
.
qual
,
fmt_dec
);
WIRELESS_SHOW
(
level
,
qual
.
level
,
fmt_dec
);
WIRELESS_SHOW
(
noise
,
qual
.
noise
,
fmt_dec
);
WIRELESS_SHOW
(
nwid
,
discard
.
nwid
,
fmt_dec
);
WIRELESS_SHOW
(
crypt
,
discard
.
code
,
fmt_dec
);
WIRELESS_SHOW
(
fragment
,
discard
.
fragment
,
fmt_dec
);
WIRELESS_SHOW
(
misc
,
discard
.
misc
,
fmt_dec
);
WIRELESS_SHOW
(
retries
,
discard
.
retries
,
fmt_dec
);
WIRELESS_SHOW
(
beacon
,
miss
.
beacon
,
fmt_dec
);
static
struct
attribute
*
wireless_attrs
[]
=
{
&
class_device_attr_status
.
attr
,
&
class_device_attr_link
.
attr
,
&
class_device_attr_level
.
attr
,
&
class_device_attr_noise
.
attr
,
&
class_device_attr_nwid
.
attr
,
&
class_device_attr_crypt
.
attr
,
&
class_device_attr_fragment
.
attr
,
&
class_device_attr_retries
.
attr
,
&
class_device_attr_misc
.
attr
,
&
class_device_attr_beacon
.
attr
,
NULL
};
static
struct
kobj_type
netstat_ktype
=
{
.
sysfs_ops
=
&
netstat_sysfs_ops
,
.
default_attrs
=
default
_attrs
,
static
struct
attribute_group
wireless_group
=
{
.
name
=
"wireless"
,
.
attrs
=
wireless
_attrs
,
};
#endif
#ifdef CONFIG_HOTPLUG
static
int
netdev_hotplug
(
struct
class_device
*
cd
,
char
**
envp
,
...
...
@@ -329,33 +388,24 @@ int netdev_register_sysfs(struct net_device *net)
goto
out_unreg
;
}
net
->
stats_kobj
.
parent
=
NULL
;
if
(
net
->
get_stats
)
{
struct
kobject
*
k
=
&
net
->
stats_kobj
;
k
->
parent
=
&
class_dev
->
kobj
;
strlcpy
(
k
->
name
,
"statistics"
,
KOBJ_NAME_LEN
);
k
->
ktype
=
&
netstat_ktype
;
if
(
net
->
get_stats
&&
(
ret
=
sysfs_create_group
(
&
class_dev
->
kobj
,
&
netstat_group
)))
goto
out_unreg
;
if
((
ret
=
kobject_register
(
k
)))
#ifdef WIRELESS_EXT
if
(
net
->
get_wireless_stats
&&
(
ret
=
sysfs_create_group
(
&
class_dev
->
kobj
,
&
wireless_group
)))
goto
out_unreg
;
}
#endif
return
0
;
out:
return
ret
;
out_unreg:
printk
(
KERN_WARNING
"%s: sysfs attribute registration failed %d
\n
"
,
net
->
name
,
ret
);
class_device_unregister
(
class_dev
);
goto
out
;
}
void
netdev_unregister_sysfs
(
struct
net_device
*
net
)
{
if
(
net
->
stats_kobj
.
parent
)
kobject_unregister
(
&
net
->
stats_kobj
);
class_device_unregister
(
&
net
->
class_dev
);
out:
return
ret
;
}
int
netdev_sysfs_init
(
void
)
...
...
net/ipv6/route.c
View file @
8e5db3dc
...
...
@@ -1983,10 +1983,11 @@ void __init ip6_route_init(void)
NULL
,
NULL
);
fib6_init
();
#ifdef CONFIG_PROC_FS
proc_net_create
(
"ipv6_route"
,
0
,
rt6_proc_info
);
p
=
create_proc_entry
(
"rt6_stats"
,
S_IRUGO
,
proc_net
);
p
=
proc_net_create
(
"ipv6_route"
,
0
,
rt6_proc_info
);
if
(
p
)
p
->
proc_fops
=
&
rt6_stats_seq_fops
;
p
->
owner
=
THIS_MODULE
;
proc_net_fops_create
(
"rt6_stats"
,
S_IRUGO
,
&
rt6_stats_seq_fops
);
#endif
#ifdef CONFIG_XFRM
xfrm6_init
();
...
...
@@ -2000,7 +2001,9 @@ void ip6_route_cleanup(void)
proc_net_remove
(
"ipv6_route"
);
proc_net_remove
(
"rt6_stats"
);
#endif
#ifdef CONFIG_XFRM
xfrm6_fini
();
#endif
rt6_ifdown
(
NULL
);
fib6_gc_cleanup
();
kmem_cache_destroy
(
ip6_dst_ops
.
kmem_cachep
);
...
...
net/irda/irda_device.c
View file @
8e5db3dc
...
...
@@ -383,10 +383,8 @@ static void irda_device_destructor(struct net_device *dev)
* This function should be used by low level device drivers in a similar way
* as ether_setup() is used by normal network device drivers
*/
int
irda_device_setup
(
struct
net_device
*
dev
)
void
irda_device_setup
(
struct
net_device
*
dev
)
{
ASSERT
(
dev
!=
NULL
,
return
-
1
;);
dev
->
hard_header_len
=
0
;
dev
->
addr_len
=
0
;
...
...
@@ -399,7 +397,6 @@ int irda_device_setup(struct net_device *dev)
dev
->
mtu
=
2048
;
dev
->
flags
=
IFF_NOARP
;
return
0
;
}
/*
...
...
net/irda/irlap.c
View file @
8e5db3dc
...
...
@@ -48,7 +48,7 @@
#include <net/irda/timer.h>
#include <net/irda/qos.h>
hashbin_t
*
irlap
=
NULL
;
static
hashbin_t
*
irlap
=
NULL
;
int
sysctl_slot_timeout
=
SLOT_TIMEOUT
*
1000
/
HZ
;
/* This is the delay of missed pf period before generating an event
...
...
@@ -110,7 +110,7 @@ void __exit irlap_cleanup(void)
*
*/
struct
irlap_cb
*
irlap_open
(
struct
net_device
*
dev
,
struct
qos_info
*
qos
,
c
har
*
hw_name
)
c
onst
char
*
hw_name
)
{
struct
irlap_cb
*
self
;
...
...
net/sctp/Kconfig
View file @
8e5db3dc
...
...
@@ -43,7 +43,7 @@ config SCTP_ADLER32
bool "SCTP: Use old checksum (Adler-32)"
depends on IP_SCTP
help
R
CF
2960 currently specifies the Adler-32 checksum algorithm for SCTP.
R
FC
2960 currently specifies the Adler-32 checksum algorithm for SCTP.
This has been deprecated and replaced by an algorithm now referred
to as crc32c.
...
...
net/xfrm/xfrm_algo.c
View file @
8e5db3dc
...
...
@@ -217,6 +217,40 @@ static struct xfrm_algo_desc ealg_list[] = {
.
sadb_alg_maxbits
=
256
}
},
{
.
name
=
"serpent"
,
.
uinfo
=
{
.
encr
=
{
.
blockbits
=
128
,
.
defkeybits
=
128
,
}
},
.
desc
=
{
.
sadb_alg_id
=
SADB_X_EALG_SERPENTCBC
,
.
sadb_alg_ivlen
=
8
,
.
sadb_alg_minbits
=
128
,
.
sadb_alg_maxbits
=
256
,
}
},
{
.
name
=
"twofish"
,
.
uinfo
=
{
.
encr
=
{
.
blockbits
=
128
,
.
defkeybits
=
128
,
}
},
.
desc
=
{
.
sadb_alg_id
=
SADB_X_EALG_TWOFISHCBC
,
.
sadb_alg_ivlen
=
8
,
.
sadb_alg_minbits
=
128
,
.
sadb_alg_maxbits
=
256
}
},
};
static
struct
xfrm_algo_desc
calg_list
[]
=
{
...
...
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