hifn_795x.c (f7d0561ea1dadec5462846520b1f4fb304294fd5) | hifn_795x.c (c3041f9c93e31159f4e321abea7c1549d271e6a7) |
---|---|
1/* 2 * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 15 unchanged lines hidden (view full) --- 24#include <linux/pci.h> 25#include <linux/slab.h> 26#include <linux/delay.h> 27#include <linux/mm.h> 28#include <linux/highmem.h> 29#include <linux/crypto.h> 30 31#include <crypto/algapi.h> | 1/* 2 * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 15 unchanged lines hidden (view full) --- 24#include <linux/pci.h> 25#include <linux/slab.h> 26#include <linux/delay.h> 27#include <linux/mm.h> 28#include <linux/highmem.h> 29#include <linux/crypto.h> 30 31#include <crypto/algapi.h> |
32#include <crypto/des.h> |
|
32 33#include <asm/kmap_types.h> 34 35#undef dprintk 36 37#define HIFN_TEST 38//#define HIFN_DEBUG 39 --- 1879 unchanged lines hidden (view full) --- 1919 struct hifn_context *ctx = crypto_tfm_ctx(tfm); 1920 struct hifn_device *dev = ctx->dev; 1921 1922 if (len > HIFN_MAX_CRYPT_KEY_LENGTH) { 1923 crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); 1924 return -1; 1925 } 1926 | 33 34#include <asm/kmap_types.h> 35 36#undef dprintk 37 38#define HIFN_TEST 39//#define HIFN_DEBUG 40 --- 1879 unchanged lines hidden (view full) --- 1920 struct hifn_context *ctx = crypto_tfm_ctx(tfm); 1921 struct hifn_device *dev = ctx->dev; 1922 1923 if (len > HIFN_MAX_CRYPT_KEY_LENGTH) { 1924 crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); 1925 return -1; 1926 } 1927 |
1928 if (len == HIFN_DES_KEY_LENGTH) { 1929 u32 tmp[DES_EXPKEY_WORDS]; 1930 int ret = des_ekey(tmp, key); 1931 1932 if (unlikely(ret == 0) && (tfm->crt_flags & CRYPTO_TFM_REQ_WEAK_KEY)) { 1933 tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY; 1934 return -EINVAL; 1935 } 1936 } 1937 |
|
1927 dev->flags &= ~HIFN_FLAG_OLD_KEY; 1928 1929 memcpy(ctx->key, key, len); 1930 ctx->keysize = len; 1931 1932 return 0; 1933} 1934 --- 685 unchanged lines hidden --- | 1938 dev->flags &= ~HIFN_FLAG_OLD_KEY; 1939 1940 memcpy(ctx->key, key, len); 1941 ctx->keysize = len; 1942 1943 return 0; 1944} 1945 --- 685 unchanged lines hidden --- |