mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
crypto: picoxcell/des - switch to new verification routines
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
304daa4f0e
commit
0157fb2688
1 changed files with 8 additions and 16 deletions
|
@ -6,7 +6,7 @@
|
||||||
#include <crypto/aes.h>
|
#include <crypto/aes.h>
|
||||||
#include <crypto/algapi.h>
|
#include <crypto/algapi.h>
|
||||||
#include <crypto/authenc.h>
|
#include <crypto/authenc.h>
|
||||||
#include <crypto/des.h>
|
#include <crypto/internal/des.h>
|
||||||
#include <crypto/md5.h>
|
#include <crypto/md5.h>
|
||||||
#include <crypto/sha.h>
|
#include <crypto/sha.h>
|
||||||
#include <crypto/internal/skcipher.h>
|
#include <crypto/internal/skcipher.h>
|
||||||
|
@ -736,16 +736,12 @@ static void spacc_aead_cra_exit(struct crypto_aead *tfm)
|
||||||
static int spacc_des_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
|
static int spacc_des_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
|
struct spacc_ablk_ctx *ctx = crypto_ablkcipher_ctx(cipher);
|
||||||
struct spacc_ablk_ctx *ctx = crypto_tfm_ctx(tfm);
|
int err;
|
||||||
u32 tmp[DES_EXPKEY_WORDS];
|
|
||||||
|
|
||||||
if (unlikely(!des_ekey(tmp, key)) &&
|
err = verify_ablkcipher_des_key(cipher, key);
|
||||||
(crypto_ablkcipher_get_flags(cipher) &
|
if (err)
|
||||||
CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) {
|
return err;
|
||||||
tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(ctx->key, key, len);
|
memcpy(ctx->key, key, len);
|
||||||
ctx->key_len = len;
|
ctx->key_len = len;
|
||||||
|
@ -761,15 +757,11 @@ static int spacc_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
struct spacc_ablk_ctx *ctx = crypto_ablkcipher_ctx(cipher);
|
struct spacc_ablk_ctx *ctx = crypto_ablkcipher_ctx(cipher);
|
||||||
u32 flags;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
flags = crypto_ablkcipher_get_flags(cipher);
|
err = verify_ablkcipher_des3_key(cipher, key);
|
||||||
err = __des3_verify_key(&flags, key);
|
if (err)
|
||||||
if (unlikely(err)) {
|
|
||||||
crypto_ablkcipher_set_flags(cipher, flags);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(ctx->key, key, len);
|
memcpy(ctx->key, key, len);
|
||||||
ctx->key_len = len;
|
ctx->key_len = len;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue