HOWTO use the Linux device-mapper for encryption

Prerequisites

You need to compile the device-mapper in your kernel as well as support for the cryptographic functions you intend to use.
CONFIG_MD=y CONFIG_BLK_DEV_DM=y CONFIG_DM_CRYPT=y CONFIG_CRYPTO=y

Those settings are found (when using make menuconfig) there:
Device Drivers -> Multi-device support (RAID and LVM) -> Device mapper support

Encrypting swap

Assuming that your swap partition is /dev/hda2, you can enable it with:
cryptsetup -c blowfish -h sha256 -d /dev/urandom create swap /dev/sda2 mkswap /dev/mapper/swap swapon /dev/mapper/swap

Encrypting partitions

Although you could encrypt partitions in a similar manner (use a key-file instead of /dev/urandom), you'd better use LUKS instead.
See my LUKS HOWTO.