@@ -135,6 +135,7 @@ static void opt_backup_mode(ConfigOption *opt, const char *arg);
135135static void opt_show_format (ConfigOption * opt ,const char * arg );
136136
137137static void compress_init (void );
138+ static void encryption_init (void );
138139
139140/*
140141 * Short name should be non-printable ASCII character.
@@ -600,9 +601,8 @@ main(int argc, char *argv[])
600601if (num_threads < 1 )
601602num_threads = 1 ;
602603
604+ encryption_init ();
603605compress_init ();
604- if (instance_config .encryption )
605- fio_crypto_init ();
606606
607607/* do actual operation */
608608switch (backup_subcmd )
@@ -714,6 +714,23 @@ opt_show_format(ConfigOption *opt, const char *arg)
714714elog (ERROR ,"Invalid show format \"%s\"" ,arg );
715715}
716716
717+ /*
718+ * Initialize encryption support.
719+ */
720+ static void encryption_init (void )
721+ {
722+ if (encryption_shortcut )
723+ instance_config .encryption = encryption_shortcut ;
724+
725+ if (instance_config .encryption )
726+ {
727+ if (!instance_config .remote .host )
728+ elog (ERROR ,"Encryp;tion is upported only for remote backups" );
729+
730+ fio_crypto_init ();
731+ }
732+ }
733+
717734/*
718735 * Initialize compress and sanity checks for compress.
719736 */
@@ -724,9 +741,6 @@ compress_init(void)
724741if (compress_shortcut )
725742instance_config .compress_alg = ZLIB_COMPRESS ;
726743
727- if (encryption_shortcut )
728- instance_config .encryption = encryption_shortcut ;
729-
730744if (backup_subcmd != SET_CONFIG_CMD )
731745{
732746if (instance_config .compress_level != COMPRESS_LEVEL_DEFAULT