pike.git / src / post_modules / Nettle / nettle.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:12:   #include "pike_cpulib.h"      #include "nettle_config.h"      #ifdef HAVE_LIBNETTLE      #include "nettle.h"      #include <nettle/yarrow.h>    + #ifdef HAVE_NETTLE_VERSION_H + #include <nettle/version.h> + #endif +    DECLARATIONS      /*! @module Nettle    *! Low level crypto functions used by the @[Crypto] module. Unless    *! you are doing something very special, you would want to use the    *! Crypto module instead.    */    -  + /*! @decl string version() +  *! Returns the version of the Nettle library, e.g. "3.1". 0 is +  *! returned when runtime version is unknown. +  */ + PIKEFUN string version() + { + #ifdef HAVE_NETTLE_VERSION_H +  push_constant_text("%d.%d"); +  push_int( nettle_version_major() ); +  push_int( nettle_version_minor() ); +  f_sprintf(3); + #else +  push_int(0); + #endif + } +    /*! @class Yarrow    *!    *! Yarrow is a family of pseudo-randomness generators, designed for    *! cryptographic use, by John Kelsey, Bruce Schneier and Niels Ferguson.    *! Yarrow-160 is described in a paper at    *! @url{http://www.schneier.com/paper-yarrow.html@}, and it uses SHA1 and    *! triple-DES, and has a 160-bit internal state. Nettle implements    *! Yarrow-256, which is similar, but uses SHA256 and AES to get an    *! internal state of 256 bits.    */