mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
[CRYPTO] fcrypt: Add FCrypt from RxRPC
Add a crypto module to provide FCrypt encryption as used by RxRPC. Signed-Off-By: David Howells <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
This commit is contained in:
parent
91652be5d1
commit
90831639a6
5 changed files with 574 additions and 1 deletions
128
crypto/tcrypt.h
128
crypto/tcrypt.h
|
|
@ -3559,6 +3559,134 @@ static struct cipher_testvec xeta_dec_tv_template[] = {
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* FCrypt test vectors
|
||||
*/
|
||||
#define FCRYPT_ENC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_enc_tv_template)
|
||||
#define FCRYPT_DEC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_dec_tv_template)
|
||||
|
||||
static struct cipher_testvec fcrypt_pcbc_enc_tv_template[] = {
|
||||
{ /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */
|
||||
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.klen = 8,
|
||||
.iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.ilen = 8,
|
||||
.result = { 0x0E, 0x09, 0x00, 0xC7, 0x3E, 0xF7, 0xED, 0x41 },
|
||||
.rlen = 8,
|
||||
}, {
|
||||
.key = { 0x11, 0x44, 0x77, 0xAA, 0xDD, 0x00, 0x33, 0x66 },
|
||||
.klen = 8,
|
||||
.iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0 },
|
||||
.ilen = 8,
|
||||
.result = { 0xD8, 0xED, 0x78, 0x74, 0x77, 0xEC, 0x06, 0x80 },
|
||||
.rlen = 8,
|
||||
}, { /* From Arla */
|
||||
.key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.klen = 8,
|
||||
.iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.input = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.ilen = 48,
|
||||
.result = { 0x00, 0xf0, 0xe, 0x11, 0x75, 0xe6, 0x23, 0x82,
|
||||
0xee, 0xac, 0x98, 0x62, 0x44, 0x51, 0xe4, 0x84,
|
||||
0xc3, 0x59, 0xd8, 0xaa, 0x64, 0x60, 0xae, 0xf7,
|
||||
0xd2, 0xd9, 0x13, 0x79, 0x72, 0xa3, 0x45, 0x03,
|
||||
0x23, 0xb5, 0x62, 0xd7, 0x0c, 0xf5, 0x27, 0xd1,
|
||||
0xf8, 0x91, 0x3c, 0xac, 0x44, 0x22, 0x92, 0xef },
|
||||
.rlen = 48,
|
||||
}, {
|
||||
.key = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.klen = 8,
|
||||
.iv = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.input = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.ilen = 48,
|
||||
.result = { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
|
||||
0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
|
||||
0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
|
||||
0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
|
||||
0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
|
||||
0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
|
||||
.rlen = 48,
|
||||
}, { /* split-page version */
|
||||
.key = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.klen = 8,
|
||||
.iv = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.input = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.ilen = 48,
|
||||
.result = { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
|
||||
0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
|
||||
0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
|
||||
0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
|
||||
0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
|
||||
0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
|
||||
.rlen = 48,
|
||||
.np = 2,
|
||||
.tap = { 20, 28 },
|
||||
}
|
||||
};
|
||||
|
||||
static struct cipher_testvec fcrypt_pcbc_dec_tv_template[] = {
|
||||
{ /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */
|
||||
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.klen = 8,
|
||||
.iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.input = { 0x0E, 0x09, 0x00, 0xC7, 0x3E, 0xF7, 0xED, 0x41 },
|
||||
.ilen = 8,
|
||||
.result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.rlen = 8,
|
||||
}, {
|
||||
.key = { 0x11, 0x44, 0x77, 0xAA, 0xDD, 0x00, 0x33, 0x66 },
|
||||
.klen = 8,
|
||||
.iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
.input = { 0xD8, 0xED, 0x78, 0x74, 0x77, 0xEC, 0x06, 0x80 },
|
||||
.ilen = 8,
|
||||
.result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0 },
|
||||
.rlen = 8,
|
||||
}, { /* From Arla */
|
||||
.key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.klen = 8,
|
||||
.iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.input = { 0x00, 0xf0, 0xe, 0x11, 0x75, 0xe6, 0x23, 0x82,
|
||||
0xee, 0xac, 0x98, 0x62, 0x44, 0x51, 0xe4, 0x84,
|
||||
0xc3, 0x59, 0xd8, 0xaa, 0x64, 0x60, 0xae, 0xf7,
|
||||
0xd2, 0xd9, 0x13, 0x79, 0x72, 0xa3, 0x45, 0x03,
|
||||
0x23, 0xb5, 0x62, 0xd7, 0x0c, 0xf5, 0x27, 0xd1,
|
||||
0xf8, 0x91, 0x3c, 0xac, 0x44, 0x22, 0x92, 0xef },
|
||||
.ilen = 48,
|
||||
.result = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.rlen = 48,
|
||||
}, {
|
||||
.key = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.klen = 8,
|
||||
.iv = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.input = { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
|
||||
0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
|
||||
0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
|
||||
0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
|
||||
0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
|
||||
0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
|
||||
.ilen = 48,
|
||||
.result = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.rlen = 48,
|
||||
}, { /* split-page version */
|
||||
.key = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
|
||||
.klen = 8,
|
||||
.iv = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
|
||||
.input = { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
|
||||
0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
|
||||
0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
|
||||
0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
|
||||
0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
|
||||
0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
|
||||
.ilen = 48,
|
||||
.result = "The quick brown fox jumps over the lazy dogs.\0\0",
|
||||
.rlen = 48,
|
||||
.np = 2,
|
||||
.tap = { 20, 28 },
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Compression stuff.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue