| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Common Twofish algorithm parts shared between the c and assembler |
|---|
| 3 | 4 | * implementations |
|---|
| .. | .. |
|---|
| 12 | 13 | * The original author has disclaimed all copyright interest in this |
|---|
| 13 | 14 | * code and thus put it in the public domain. The subsequent authors |
|---|
| 14 | 15 | * have put this under the GNU General Public License. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 17 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 18 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 19 | | - * (at your option) any later version. |
|---|
| 20 | | - * |
|---|
| 21 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 22 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 23 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 24 | | - * GNU General Public License for more details. |
|---|
| 25 | | - * |
|---|
| 26 | | - * You should have received a copy of the GNU General Public License |
|---|
| 27 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 28 | | - * |
|---|
| 29 | 16 | * |
|---|
| 30 | 17 | * This code is a "clean room" implementation, written from the paper |
|---|
| 31 | 18 | * _Twofish: A 128-Bit Block Cipher_ by Bruce Schneier, John Kelsey, |
|---|
| .. | .. |
|---|
| 580 | 567 | |
|---|
| 581 | 568 | /* Perform the key setup. */ |
|---|
| 582 | 569 | int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, |
|---|
| 583 | | - unsigned int key_len, u32 *flags) |
|---|
| 570 | + unsigned int key_len) |
|---|
| 584 | 571 | { |
|---|
| 585 | 572 | int i, j, k; |
|---|
| 586 | 573 | |
|---|
| .. | .. |
|---|
| 597 | 584 | |
|---|
| 598 | 585 | /* Check key length. */ |
|---|
| 599 | 586 | if (key_len % 8) |
|---|
| 600 | | - { |
|---|
| 601 | | - *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; |
|---|
| 602 | 587 | return -EINVAL; /* unsupported key length */ |
|---|
| 603 | | - } |
|---|
| 604 | 588 | |
|---|
| 605 | 589 | /* Compute the first two words of the S vector. The magic numbers are |
|---|
| 606 | 590 | * the entries of the RS matrix, preprocessed through poly_to_exp. The |
|---|
| .. | .. |
|---|
| 701 | 685 | |
|---|
| 702 | 686 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) |
|---|
| 703 | 687 | { |
|---|
| 704 | | - return __twofish_setkey(crypto_tfm_ctx(tfm), key, key_len, |
|---|
| 705 | | - &tfm->crt_flags); |
|---|
| 688 | + return __twofish_setkey(crypto_tfm_ctx(tfm), key, key_len); |
|---|
| 706 | 689 | } |
|---|
| 707 | 690 | EXPORT_SYMBOL_GPL(twofish_setkey); |
|---|
| 708 | 691 | |
|---|