Description: Fix hardcode use of CBC crypto block mode
 CiderWebmail declare runtime dependency on Crypt::CBC
 yet does not declare CBC block mode when calling Crypt::Util,
 causing it to use a set of fallback modes with CBC only third option.
 It works but spews lots of backtraces to logfiles.
 .
 Explicitly pass CBC mode to Crypt::Util to silence backtracing noise,
 and possibly speedup processing slightly as well.
 .
 While at it, also fix typo in related error message.
Author: Jonas Smedegaard <dr@jones.dk>
Bug: https://github.com/CiderWebmail/CiderWebmail/issues/38
Last-Update: 2020-02-24
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/CiderWebmail/Util.pm
+++ b/lib/CiderWebmail/Util.pm
@@ -233,7 +233,7 @@
 sub encrypt {
     my ($c, $o) = @_;
 
-    croak("empty string passed to CiderWebmail::Util::decrypt") unless defined($o->{string});
+    croak("empty string passed to CiderWebmail::Util::encrypt") unless defined($o->{string});
     croak("cannot encrypt without active session") unless $c->sessionid;
 
     my $util = Crypt::Util->new;
@@ -241,6 +241,7 @@
     my $key = CiderWebmail::Util::get_key($c);
     croak("invalid key passed to CiderWebmail::Util::crypt") unless (defined($key) && (length($key) == 48));
 
+    $util->default_mode('CBC');
     $util->default_key($key);
     return $util->encode_string_uri_base64( $util->encrypt_string($o->{string}) );
 }
@@ -262,6 +263,7 @@
 
     croak("invalid key passed to CiderWebmail::Util::crypt") unless (defined($key) && (length($key) == 48));
 
+    $util->default_mode('CBC');
     $util->default_key($key);
     return $util->decrypt_string( $util->decode_string_uri_base64( $o->{string} ) );
 }
