minor tweak for DTN2 integration
authorstephen
Thu, 27 Mar 2014 20:37:19 +0000
changeset 37bcd39026d38a
parent 36 dfe36e1be915
child 38 9109dc3da507
minor tweak for DTN2 integration
include/ltp_crypt.h
src/ltp.cc
     1.1 --- a/include/ltp_crypt.h	Thu Mar 27 19:32:01 2014 +0000
     1.2 +++ b/include/ltp_crypt.h	Thu Mar 27 20:37:19 2014 +0000
     1.3 @@ -57,7 +57,7 @@
     1.4  #include "ltp_codec.h" // for ltpc_octets definition
     1.5  
     1.6  /// the default crypto configuration file name
     1.7 -#define LTP_CRYPT_FNAME_DEF "ltpd.crypt"
     1.8 +#define LTP_CRYPT_FNAME_DEF "ltp.crypt"
     1.9  
    1.10  /*!
    1.11   * @brief make is easy to specify a ciphersuite
     2.1 --- a/src/ltp.cc	Thu Mar 27 19:32:01 2014 +0000
     2.2 +++ b/src/ltp.cc	Thu Mar 27 20:37:19 2014 +0000
     2.3 @@ -229,7 +229,6 @@
     2.4  static int using_def_crypto=0;
     2.5  static int def_ciphersuite=LTP_CS_SIG;
     2.6  static char *def_keyid="foo";
     2.7 -static char *def_crypto_cfg="ltp.crypt";
     2.8  
     2.9  /*!
    2.10   * @fn ltp_instance ltp_next_instance(void)
    2.11 @@ -4465,13 +4464,22 @@
    2.12  	// if there's a crypto cfg in the working directory then
    2.13  	// use that and set up a ciphersuite
    2.14  	// TODO: Parse it out to check
    2.15 -	FILE *fp=fopen(def_crypto_cfg,"r");
    2.16 +	FILE *fp=fopen(LTP_CRYPT_FNAME_DEF,"r");
    2.17  	if (fp) { 
    2.18  		// just openable is enough for now
    2.19  		fclose(fp);
    2.20 -		rv=ltp_crypt_setup(def_crypto_cfg);
    2.21 +		rv=ltp_crypt_setup(LTP_CRYPT_FNAME_DEF);
    2.22  		if (rv) LTPERR(rv);
    2.23  		using_def_crypto=1;
    2.24 +#ifdef LTP_VERBOSE
    2.25 +		snprintf(ltpstr,LTPSTR_LEN,"Will use default crypto (sig,keyid=foo,file=%s)\n",LTP_CRYPT_FNAME_DEF);
    2.26 +		ltp_log(LTP_LOG_MAX,ltpstr);
    2.27 +#endif
    2.28 +	} else {
    2.29 +#ifdef LTP_VERBOSE
    2.30 +		snprintf(ltpstr,LTPSTR_LEN,"Not using default crypto (no sign of file=%s)\n",LTP_CRYPT_FNAME_DEF);
    2.31 +		ltp_log(LTP_LOG_MAX,ltpstr);
    2.32 +#endif
    2.33  	}
    2.34  
    2.35  	return(LTP_OK);