[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / target / linux / generic / files / crypto / ocf / talitos / talitos.c
index 9404634..c4bc8c0 100644 (file)
  * o add statistics
  */
 
  * o add statistics
  */
 
-#ifndef AUTOCONF_INCLUDED
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) && !defined(AUTOCONF_INCLUDED)
 #include <linux/config.h>
 #endif
 #include <linux/module.h>
 #include <linux/config.h>
 #endif
 #include <linux/module.h>
 #include <linux/dma-mapping.h>  /* dma_map_single() */
 #include <linux/moduleparam.h>
 
 #include <linux/dma-mapping.h>  /* dma_map_single() */
 #include <linux/moduleparam.h>
 
-#include <linux/version.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
 #include <linux/platform_device.h>
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
 #include <linux/platform_device.h>
 #endif
@@ -418,10 +418,6 @@ talitos_newsession(device_t dev, u_int32_t *sidp, struct cryptoini *cri)
        ses->ses_used = 1;
 
        if (encini) {
        ses->ses_used = 1;
 
        if (encini) {
-               /* get an IV */
-               /* XXX may read fewer than requested */
-               read_random(ses->ses_iv, sizeof(ses->ses_iv));
-
                ses->ses_klen = (encini->cri_klen + 7) / 8;
                memcpy(ses->ses_key, encini->cri_key, ses->ses_klen);
                if (macini) {
                ses->ses_klen = (encini->cri_klen + 7) / 8;
                memcpy(ses->ses_key, encini->cri_key, ses->ses_klen);
                if (macini) {
@@ -511,6 +507,7 @@ talitos_process(device_t dev, struct cryptop *crp, int hint)
        int hmac_key, hmac_data, cipher_iv, cipher_key, 
                in_fifo, out_fifo, cipher_iv_out;
        static int chsel = -1;
        int hmac_key, hmac_data, cipher_iv, cipher_key, 
                in_fifo, out_fifo, cipher_iv_out;
        static int chsel = -1;
+       u_int32_t rand_iv[4];
 
        DPRINTF("%s()\n", __FUNCTION__);
 
 
        DPRINTF("%s()\n", __FUNCTION__);
 
@@ -752,7 +749,7 @@ talitos_process(device_t dev, struct cryptop *crp, int hint)
                        if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
                                iv = enccrd->crd_iv;
                        else
                        if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
                                iv = enccrd->crd_iv;
                        else
-                               iv = (caddr_t) ses->ses_iv;
+                               read_random((iv = (caddr_t) rand_iv), sizeof(rand_iv));
                        if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
                                crypto_copyback(crp->crp_flags, crp->crp_buf,
                                    enccrd->crd_inject, ivsize, iv);
                        if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
                                crypto_copyback(crp->crp_flags, crp->crp_buf,
                                    enccrd->crd_inject, ivsize, iv);
@@ -761,9 +758,8 @@ talitos_process(device_t dev, struct cryptop *crp, int hint)
                        td->hdr |= TALITOS_DIR_INBOUND; 
                        if (enccrd->crd_flags & CRD_F_IV_EXPLICIT) {
                                iv = enccrd->crd_iv;
                        td->hdr |= TALITOS_DIR_INBOUND; 
                        if (enccrd->crd_flags & CRD_F_IV_EXPLICIT) {
                                iv = enccrd->crd_iv;
-                               bcopy(enccrd->crd_iv, iv, ivsize);
                        } else {
                        } else {
-                               iv = (caddr_t) ses->ses_iv;
+                               iv = (caddr_t) rand_iv;
                                crypto_copydata(crp->crp_flags, crp->crp_buf,
                                    enccrd->crd_inject, ivsize, iv);
                        }
                                crypto_copydata(crp->crp_flags, crp->crp_buf,
                                    enccrd->crd_inject, ivsize, iv);
                        }
This page took 0.026142 seconds and 4 git commands to generate.