Add version number - based on git

This commit is contained in:
Pedro de Oliveira 2015-04-03 23:56:03 +01:00
parent b05763c2d5
commit 2e32ee2c81
6 changed files with 59 additions and 224 deletions

4
.gitignore vendored
View File

@ -47,3 +47,7 @@ CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
CPack*
_CPack_Packages
src/FiSH_version.h

View File

@ -1,45 +1,70 @@
cmake_minimum_required(VERSION 2.6)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
project (FiSH-irssi C)
PROJECT(FiSH-irssi C)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 3)
SET(VERSION_MAJOR 1)
SET(VERSION_MINOR 3)
find_package(PkgConfig REQUIRED)
SET(FISH_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
pkg_check_modules(GLIB_PKG REQUIRED glib-2.0)
pkg_check_modules(OPENSSL REQUIRED openssl)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GLIB_PKG REQUIRED glib-2.0)
PKG_CHECK_MODULES(OPENSSL REQUIRED openssl)
if(GLIB_PKG_FOUND)
include_directories(${GLIB_PKG_INCLUDE_DIRS})
message(STATUS "Using glib-2.0 ${GLIB_PKG_VERSION}")
endif()
INCLUDE_DIRECTORIES(${GLIB_PKG_INCLUDE_DIRS})
MESSAGE(STATUS "Using glib-2.0 ${GLIB_PKG_VERSION}")
ENDIF()
if(OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIRS})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
endif()
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIRS})
MESSAGE(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
ENDIF()
set(IRSSI_PATH "/usr/include/irssi" PATH "path to irssi include files")
find_path(irssi_INCLUDE_DIR
SET(IRSSI_PATH "/usr/include/irssi" PATH "path to irssi include files")
FIND_PATH(irssi_INCLUDE_DIR
NAMES irssi-config.h src/common.h
PATHS ${IRSSI_PATH} /usr/local/include/irssi
)
if(NOT irssi_INCLUDE_DIR)
message(SEND_ERROR "Could not auto find the irssi include files, please run:\n# cmake -DIRSSI_PATH:PATH=/path/to/irssi/includes .")
return()
endif()
IF(NOT irssi_INCLUDE_DIR)
MESSAGE(SEND_ERROR "Could not auto find the irssi include files, please run:\n# cmake -DIRSSI_PATH:PATH=/path/to/irssi/includes .")
RETURN()
ENDIF()
include_directories(${irssi_INCLUDE_DIR} ${irssi_INCLUDE_DIR}/src ${irssi_INCLUDE_DIR}/src/fe-common/core ${irssi_INCLUDE_DIR}/src/core)
INCLUDE_DIRECTORIES(${irssi_INCLUDE_DIR} ${irssi_INCLUDE_DIR}/src ${irssi_INCLUDE_DIR}/src/fe-common/core ${irssi_INCLUDE_DIR}/src/core)
message(STATUS "The module will be installed to ${CMAKE_INSTALL_PREFIX}/lib/irssi/modules\nChange it with 'cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .'")
MESSAGE(STATUS "The module will be installed to ${CMAKE_INSTALL_PREFIX}/lib/irssi/modules\nChange it with 'cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .'")
add_subdirectory (src)
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
FIND_PACKAGE(Git)
IF(GIT_FOUND)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE "FISH_GIT_REVISION"
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
#MESSAGE(STATUS "Git revision: ${GIT_REVISION}")
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE "FISH_GIT_HASH"
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
#MESSAGE(STATUS "Git hash: ${GIT_HASH}")
SET(FISH_VERSION r${FISH_GIT_REVISION}-${FISH_GIT_HASH})
ENDIF(GIT_FOUND)
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
install(FILES README.md doc/FiSH-irssi.txt DESTINATION share/doc/FiSH-irssi)
CONFIGURE_FILE(src/FiSH_version.h.in src/FiSH_version.h)
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
ADD_SUBDIRECTORY(src)
INSTALL(FILES README.md doc/FiSH-irssi.txt DESTINATION share/doc/FiSH-irssi)
SET(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
INCLUDE(InstallRequiredSystemLibraries)
@ -61,7 +86,6 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.1.3), libssl1.0.0 (>= 1.0.0), libglib2.0-0 (>= 2.24.0), irssi (>= 0.8.13)")
#SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)

View File

@ -1,198 +0,0 @@
FISH v0.98 for irssi
********************
This is an encryption addon for irssi, it is based on blowfish and is
fully compatible to original 'blowcrypt' script. It supports private
chat and channel encryption. A secure key-exchange system is included
aswell. Please read the whole document, especially the 'Installation'
section, before installing it!
FiSH v0.98 has been tested with irssi v0.8.9!
==============
FiSH commands:
==============
- /notice+ <nick/#channel> <notice message>
/notfish <nick/#channel> <notice message>
Send a notice message encrypted to someone. You have
to specify the target.
- /topic+ <your topic>
Set encrypted topic for current channel. Keep in mind:
topic size SHRINKS drastically to about 60%!
- /key [<nick/#channel>]
Show key for target. If no target specified, the key
for current window will be shown.
- /setkey [<nick/#channel>] <sekure_key>
Set key for target to sekure_key. If no target
specified, the key for current window will be set
to sekure_key.
- /delkey <nick/#channel>
Delete key for target. You have to specify the target.
- /keyx [<nick>]
Perform DH1080 KeyXchange with target. If no target
specified, the KeyXchange takes place with the current
query window.
- /setinipw <sekure_blow.ini_password>
Set a custom password to encrypt your key-container
(blow.ini) - you will be forced to enter it each time
you load the module.
If you do not set a custom blow.ini password, a default
password will be used. *insecure*
*NOTE* Take care of all your keys when using this
feature, they should get re-encrypted when changing
the blow.ini password, but nothing is guaranteed :)
- /unsetinipw
Change back to default blow.ini password
=============
Installation:
=============
- copy libfish.so to irssi's module directory and use
"/load fish" or "/load /path/to/libfish.so"
This is a plug-in, not a script - do NOT use /script to load it
- locate your blow.ini in ~/.irssi/ (or wherever your irssi
config file is stored)
- Blow.ini options explained:
---------------------------
[FiSH]
process_incoming=1 --> decrypt incoming messages?
process_outgoing=1 --> encrypt outgoing messages?
mark_encrypted=" ·" --> see below
mark_position=0 --> 0=append mark at the end, 1=prefix
plain_prefix="+p " --> messages starting with +p will be
sent plain-text
-------------------
- If you want to mark INCOMING encrypted messages, add mark_encrypted
to blow.ini, in [FiSH] section.
Suffix Examples:
mark_position=0
mark_encrypted=" *" --> ...end of message *
mark_encrypted=" ·" --> ...end of message ·
mark_encrypted=" 12·" --> ...end of message ·[blue+bold]
mark_encrypted= --> disabled
Prefix Examples:
mark_position=1
mark_encrypted="12> " --> [blue+bold]> start of message...
mark_encrypted="12· " --> [blue+bold]· start of message...
mark_encrypted="· " --> · start of message...
- Set mark_broken_block=0 (in blow.ini) if you want to disable the
"mark broken block" feature, which indicates whether a broken block
was cut, meaning the message arrived incomplete (enabled by default)
- Set mark_encrypted=0 for #yourchan (in blow.ini) if you don't want
the crypt-mark to be shown there
- Set auto_keyxchange=0 (in blow.ini) if you want to disable the
auto-KeyXchange for new queries
- 'NickTracker' allows seamless conversations in the case your chat
partner suddenly changes his nick. This feature will simply copy the
old key to use with his new nick. It affects nick changes for running
queries only! (enabled by default, to disable set nicktracker=0 in
blow.ini)
==============
Security Info:
==============
What happened to DH1024 key-exchange you may ask. To make it short: An
implementation flaw in the code has been found and a new key-exchange
using Diffie-Hellman 1080 bit has been introduced. The implementation
flaw is NOT about a remote vulnerability, it is rather about maths :)
The analysis of a friend has come to the conclusion: The old DH1024
key-exchange was probably still as secure as 991 bit. We cannot say
for sure. The characteristic of the implementation flaw makes it hard
to analyze, as not many material about this subject is available.
I was very angry when this problem was discovered, but I can't change
what happened now. Such a stupid mistake, unnoticed almost a year.
Well, everyone learns from mistakes ...
Make sure you NEVER exchange keys plain-text over IRC/ftp/email! If
you ever do that, or someone else who owns that key, you can also just
keep talking plain-text.
Use the new Diffie-Hellman (1080 bit) keyXchange function!
You might think this is crazy, but keep in mind: You are using IRC
encryption because you think someone might be able to read your
conversations. Such a person may not only have enough skills for
that, but also for defeating your weak encryption mechanism, including
passwords sent in plain-text and maybe even using DH-128.
While rewriting the Diffie-Hellman key-exchange, it was discovered
that the used 128bit numbers in DH.dll (written by sinner?) are far
not enough for secure key-exchange!
It would take just approx. 3 hours to calculate someones private key
by having only the transmitted public key, on a 1.7 GHz machine with
256 MB RAM!
Now half of the time is used for pre-computation, which needs to be
done only once. And from that point you can calculate any private key
generated with the DH.dll in only 1.5 hours!
This applies to *all* DH key-exchange plug-ins using 128bit keys! It
is suggested to use at least 512bit for Diffie-Hellman.
Therefore keyXchange with Diffie-Hellman in this addon was upgraded
to 1080bit. It is not compatible to the old DH keyXchange with 128bit!
The DH routines have been completly rewritten using MIRACL. (Thanx to
mac for discovering the weakness of DH128 and helping me!)
================
Technical notes:
================
For Diffie-Hellman key-exchange a 1080bit germain prime is used, the
generator g=2 renders a field Fp from 1 to p-1. Therefore breaking it
means to solve a discrete logarithm problem with no less than 1080bit.
Base64 format is used to send the public keys over IRC.
The calculated secret key is hashed with SHA-256, the result is converted
to base64 for final use with blowfish.
Comments and suggestions are welcome!
Enjoy
16. December 2004
FiSH URL: http://fish.sekure.us/

View File

@ -1186,7 +1186,8 @@ void fish_init(void)
settings_add_int_module("fish", "fish", "mark_position", 1);
printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
"FiSH v1.00 - encryption module for irssi loaded! URL: https://github.com/falsovsky/FiSH-irssi\n"
"FiSH " FISH_VERSION " - encryption module for irssi loaded!\n"
"URL: https://github.com/falsovsky/FiSH-irssi\n"
"Try /helpfish or /fishhelp for a short command overview");
module_register("fish", "core");

View File

@ -1,6 +1,7 @@
#include <time.h>
#include <unistd.h>
#include "FiSH_version.h"
#include "inifile.h"
#include "blowfish.h"
#include "DH1080.h"

3
src/FiSH_version.h.in Normal file
View File

@ -0,0 +1,3 @@
#define FISH_GIT_REVISION "${FISH_GIT_REVISION}"
#define FISH_GIT_HASH "${FISH_GIT_HASH}"
#define FISH_VERSION "${FISH_VERSION}"