[Android Software Development] TheFixItMan:
Can someone help me with encryption support for twrp

I have compiled twrp 3.1.1-0 and everything works except it is unable to decrypt the data partition

When twrp starts up it asks you to enter the decrypt key - once entered it tries to decrypt the data partition and fails with

E: Decrypt took too long. Killing process

If anyone could give me a hand getting it to work it would be appreciated

Here is my boardconfig

LOCAL_PATH := device/motorola/cedric

TARGET_BOARD_VENDOR := motorola

# Architecture
TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_CPU_VARIANT := cortex-a53
TARGET_CPU_SMP := true

TARGET_BOARD_PLATFORM := msm8937
TARGET_BOARD_PLATFORM_GPU := qcom-adreno505

# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := msm8937
TARGET_NO_BOOTLOADER := true

# Kernel
BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78B0000 vmalloc=400M androidboot.selinux=permissive
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_TAGS_OFFSET := 0x00000100
BOARD_RAMDISK_OFFSET := 0x01000000
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --kernel_offset 0x00008000 --second_offset 0x00f00000 --dt device/motorola/cedric/dt.img
BOARD_CUSTOM_BOOTIMG_MK := device/motorola/cedric/mkbootimg.mk
TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel

# Partitions
BOARD_FLASH_BLOCK_SIZE := 131072
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
BOARD_PERSISTIMAGE_PARTITION_SIZE := 33554432
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472
BOARD_USERDATAIMAGE_PARTITION_SIZE := 26301931008

# File systems
BOARD_HAS_LARGE_FILESYSTEM := true
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true

# Recovery
TARGET_RECOVERY_FSTAB := $(LOCAL_PATH)/recovery/root/etc/twrp.fstab
BOARD_SUPPRESS_SECURE_ERASE := true
#RECOVERY_GRAPHICS_USE_LINELENGTH := true

# TWRP specific build flags
RECOVERY_SDCARD_ON_DATA := true
TARGET_RECOVERY_QCOM_RTC_FIX := true
TW_THEME := portrait_hdpi
TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness
TW_DEFAULT_EXTERNAL_STORAGE := true
TW_INPUT_BLACKLIST := "hbtp_vm"

# Encryption support
TW_INCLUDE_CRYPTO := true
TARGET_HW_DISK_ENCRYPTION := true

Here is my twrp.fstab

# mount point fstype device	device2	flags
/system ext4 /dev/block/bootdevice/by-name/system
/system_image emmc /dev/block/bootdevice/by-name/system
/data f2fs /dev/block/bootdevice/by-name/userdata flags=fsflags=rw,discard,nosuid,nodev,noatime,nodiratime,inline_xattr,inline_data;encryptable=/dev/block/bootdevice/by-name/metadata
/cache ext4 /dev/block/bootdevice/by-name/cache
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1
/persist ext4 /dev/block/bootdevice/by-name/persist flags=fsflags=noatime,nosuid,nodev,barrier=1,noauto_da_alloc;mounttodecrypt
/firmware ext4 /dev/block/bootdevice/by-name/modem flags=fsflags=ro,nosuid,nodev,barrier=0,context=u:object_r:fsg_file:s0;mounttodecrypt
/boot emmc /dev/block/bootdevice/by-name/boot
/misc emmc /dev/block/bootdevice/by-name/misc

/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="MicroSD Card";storage;wipeingui;removable
/usb_otg auto /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable

Edit

Don't worry iv fixed it - I can now decrypt my data