Linux cryptographic layer development
 help / color / mirror / Atom feed
* HIFN+IPsec crashes in current -git
@ 2008-02-13 13:17 Patrick McHardy
  2008-02-13 14:44 ` Evgeniy Polyakov
  2008-02-19  6:23 ` Herbert Xu
  0 siblings, 2 replies; 29+ messages in thread
From: Patrick McHardy @ 2008-02-13 13:17 UTC (permalink / raw)
  To: linux-crypto; +Cc: Evgeniy Polyakov

I'm getting crashes when using HIFN and IPsec (ESP with
AES + MD5) in the current -git tree. I didn't capture the
Oops, but there seem to be a number of problems:

- hifn_setup_session walks over the scatterlist, subtracting
   the scatterlist element size from nbytes until nbytes
   reaches zero. In my case nbytes is 12 byte smaller than
   the scatterlist, so nbytes underflows and it oopses when
   walking over the of the scatterlist.

- similar problem in ablkcipher_walk

- After adding a hack to only walk the correct amount of
   bytes, I got another crash because the return value
   of ablkcipher_walk is not checked for errors, which
   can cause sg_num to take a very large value.

- After adding more hacks to work around the crash,
   I got "bad page state" on resume and a refcount
   underflow in dst_release() called by xfrm_input(),
   but that may very well be caused by my hacks.

I couldn't figure out where in the crypto code the
nbytes decrement by 12 bytes compared to the length
seen when setting up the crypto operation happens
or I might have tried to properly fix it myself.
I'll happily test patches in case someone more
familiar with the code does a proper fix.

^ permalink raw reply	[flat|nested] 29+ messages in thread
* RE: Test AES-CCM mode via IPSec (NETKEY)
@ 2008-04-07 21:13 Joy Latten
  0 siblings, 0 replies; 29+ messages in thread
From: Joy Latten @ 2008-04-07 21:13 UTC (permalink / raw)
  To: lho; +Cc: herbert, linux-crypto

>Hi,
>
>Try these scripts with proper IP address. In addition, you must patch
>iproute2 manually using the patch from Herbert's email:
>
>[lho@svdclab161 sec]$ cat ip-start-transport-ccm
>#!/bin/sh
>
>NODE=$1
>
>echo "Starting IPSec transport mode using CCM..."
>
>./ip xfrm policy flush
>./ip xfrm state flush
>#
># SA
>./ip xfrm state add src 10.66.21.164 dst 10.66.21.166 proto esp spi
>0x201 mode transport aead "rfc4309(ccm(aes))"
>0x0102037aeaca3f87d060a12f4a4487d5a5c335 96
>./ip xfrm state add src 10.66.21.166 dst 10.66.21.164 proto esp spi
>0x301 mode transport aead "rfc4309(ccm(aes))"
>0x010203f6ddb555acfd9d77b03ea3843f265325 96
>#
># Policy
>if [ "${NODE}" = "A" ]; then
>        ./ip xfrm policy add dir out src 10.66.21.164 dst 10.66.21.166
>tmpl proto esp mode transport
>        ./ip xfrm policy add dir in src 10.66.21.166 dst 10.66.21.164
>tmpl proto esp mode transport
>fi
>if [ "${NODE}" = "B" ]; then
>        ./ip xfrm policy add dir in src 10.66.21.164 dst 10.66.21.166
>tmpl proto esp mode transport
>        ./ip xfrm policy add dir out src 10.66.21.166 dst 10.66.21.164
>tmpl proto esp mode transport
>fi
> 
>[lho@svdclab161 sec]$ cat ip-start-transport-gcm
>#!/bin/sh
>
>NODE=$1
>
>echo "Starting IPSec transport mode using GCM..."
>
>./ip xfrm policy flush
>./ip xfrm state flush
>#
># SA
>./ip xfrm state add src 10.66.21.164 dst 10.66.21.166 proto esp spi
>0x201 mode transport aead "rfc4106(gcm(aes))"
>0x010203047aeaca3f87d060a12f4a4487d5a5c335 96
>./ip xfrm state add src 10.66.21.166 dst 10.66.21.164 proto esp spi
>0x301 mode transport aead "rfc4106(gcm(aes))"
>0x01020304f6ddb555acfd9d77b03ea3843f265325 96
>#
># Policy
>if [ "${NODE}" = "A" ]; then
>        ./ip xfrm policy add dir out src 10.66.21.164 dst 10.66.21.166
>tmpl proto esp mode transport
>        ./ip xfrm policy add dir in src 10.66.21.166 dst 10.66.21.164
>tmpl proto esp mode transport
>fi
>if [ "${NODE}" = "B" ]; then
>        ./ip xfrm policy add dir in src 10.66.21.164 dst 10.66.21.166
>tmpl proto esp mode transport
>        ./ip xfrm policy add dir out src 10.66.21.166 dst 10.66.21.164
>tmpl proto esp mode transport
>fi
>

Thank you!! Your instructions were perfect and I had it working
in no time.

regards,
Joy

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2008-04-07 21:26 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 13:17 HIFN+IPsec crashes in current -git Patrick McHardy
2008-02-13 14:44 ` Evgeniy Polyakov
2008-02-14  9:30   ` Evgeniy Polyakov
2008-02-19 16:10     ` Patrick McHardy
2008-02-19 16:14       ` Patrick McHardy
2008-02-19  6:23 ` Herbert Xu
2008-02-19 16:27   ` Patrick McHardy
2008-02-20  0:53     ` Herbert Xu
2008-02-20 12:33       ` Patrick McHardy
2008-02-20 13:19         ` Evgeniy Polyakov
2008-02-20 17:29           ` Herbert Xu
2008-02-20 17:26         ` Herbert Xu
2008-02-21  9:10           ` Evgeniy Polyakov
2008-02-21 14:10             ` Herbert Xu
2008-02-21 14:18               ` Evgeniy Polyakov
2008-02-21 14:20                 ` Patrick McHardy
2008-02-21 14:37                   ` Evgeniy Polyakov
2008-02-21 14:41                     ` Patrick McHardy
2008-02-21 15:29                       ` Patrick McHardy
2008-02-21 15:31                         ` Patrick McHardy
2008-02-22 12:42                         ` Evgeniy Polyakov
2008-02-22 13:53                           ` Patrick McHardy
2008-02-22  2:27               ` Test AES-CCM mode via IPSec (NETKEY) Loc Ho
2008-02-22  5:45                 ` Herbert Xu
2008-03-13 17:34                   ` Loc Ho
2008-03-14  1:12                     ` Herbert Xu
2008-04-04 22:37                     ` Joy Latten
2008-04-04 23:08                       ` Loc Ho
  -- strict thread matches above, loose matches on Subject: below --
2008-04-07 21:13 Joy Latten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox