tin  2.4.5
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.4.5.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

canlock.h File Reference
#include <stddef.h>
Include dependency graph for canlock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CL_API_MAJOR   3
 
#define CL_API_MINOR   0
 
#define CL_API_V2   1
 
#define CL_INVALID   0
 
#define CL_SHA1   1 /* IANA registered name: "sha1" */
 
#define CL_SHA224   2 /* IANA registered name: "sha224" */
 
#define CL_SHA256   3 /* IANA registered name: "sha256" */
 
#define CL_SHA384   4 /* IANA registered name: "sha384" */
 
#define CL_SHA512   5 /* IANA registered name: "sha512" */
 

Typedefs

typedef int cl_hash_version
 

Functions

char * cl_get_key (cl_hash_version which_hash, const unsigned char *secret, size_t seclen, const unsigned char *message, size_t msglen)
 
char * cl_get_lock (cl_hash_version which_hash, const unsigned char *secret, size_t seclen, const unsigned char *message, size_t msglen)
 
int cl_split (char *input, char **klstring)
 
int cl_verify (cl_hash_version which_hash, const char *key, const char *lock)
 
int cl_clear_secret (void *sec, size_t sec_size, size_t buf_size)
 Overwrite secret data in memory. More...
 
char * lock_strip_alpha (char *key, char *type)
 
char * lock_strip (char *key, char *type)
 
char * sha_key (const unsigned char *secret, size_t seclen, const unsigned char *message, size_t msglen)
 
char * sha_lock (const unsigned char *secret, size_t seclen, const unsigned char *message, size_t msglen)
 
int sha_verify (const char *key, const char *lock)
 

Macro Definition Documentation

◆ CL_API_MAJOR

#define CL_API_MAJOR   3

Definition at line 50 of file canlock.h.

◆ CL_API_MINOR

#define CL_API_MINOR   0

Definition at line 53 of file canlock.h.

◆ CL_API_V2

#define CL_API_V2   1

Definition at line 56 of file canlock.h.

◆ CL_INVALID

#define CL_INVALID   0

Definition at line 59 of file canlock.h.

◆ CL_SHA1

#define CL_SHA1   1 /* IANA registered name: "sha1" */

Definition at line 60 of file canlock.h.

◆ CL_SHA224

#define CL_SHA224   2 /* IANA registered name: "sha224" */

Definition at line 61 of file canlock.h.

◆ CL_SHA256

#define CL_SHA256   3 /* IANA registered name: "sha256" */

Definition at line 62 of file canlock.h.

◆ CL_SHA384

#define CL_SHA384   4 /* IANA registered name: "sha384" */

Definition at line 63 of file canlock.h.

◆ CL_SHA512

#define CL_SHA512   5 /* IANA registered name: "sha512" */

Definition at line 64 of file canlock.h.

Typedef Documentation

◆ cl_hash_version

typedef int cl_hash_version

Definition at line 70 of file canlock.h.

Function Documentation

◆ cl_clear_secret()

int cl_clear_secret ( void *  sec,
size_t  sec_size,
size_t  buf_size 
)

Overwrite secret data in memory.

Parameters
[in]secPointer to secret data
[in]sec_sizeSize of secret data
[in]buf_sizeSize of buffer
Attention
The default implementation uses memset() and is not crytographically secure. A smart compiler may optimize this function away completely. If no better function of the OS was available, this situation is indicated with a return value of 1.
Note
Even if the OS in general supports explicit overwriting of memory, on a modern machine with Cache, Swap, etc. it is not possible to securely overwrite all copies that such subsystems may have created (at least it is not possible in a portable way).
Returns
  • 0 on success
  • 1 if only memset() was available
  • -1 on error

Definition at line 70 of file secret.c.

◆ cl_get_key()

char* cl_get_key ( cl_hash_version  which_hash,
const unsigned char *  secret,
size_t  seclen,
const unsigned char *  message,
size_t  msglen 
)

◆ cl_get_lock()

char* cl_get_lock ( cl_hash_version  which_hash,
const unsigned char *  secret,
size_t  seclen,
const unsigned char *  message,
size_t  msglen 
)

◆ cl_split()

int cl_split ( char *  input,
char **  klstring 
)

Definition at line 167 of file canlock.c.

References CL_INVALID, CL_SHA1, CL_SHA224, CL_SHA256, CL_SHA384, CL_SHA512, and lock_strip_alpha().

Referenced by exec_request().

◆ cl_verify()

int cl_verify ( cl_hash_version  which_hash,
const char *  key,
const char *  lock 
)

◆ lock_strip()

char* lock_strip ( char *  key,
char *  type 
)

Definition at line 146 of file canlock.c.

References lock_strip_alpha().

◆ lock_strip_alpha()

char* lock_strip_alpha ( char *  key,
char *  type 
)

Definition at line 109 of file canlock.c.

References my_strdup(), and offset.

Referenced by cl_get_lock(), cl_split(), and lock_strip().

◆ sha_key()

char* sha_key ( const unsigned char *  secret,
size_t  seclen,
const unsigned char *  message,
size_t  msglen 
)

Definition at line 202 of file canlock.c.

References cl_get_key(), and CL_SHA1.

◆ sha_lock()

char* sha_lock ( const unsigned char *  secret,
size_t  seclen,
const unsigned char *  message,
size_t  msglen 
)

Definition at line 278 of file canlock.c.

References cl_get_lock(), and CL_SHA1.

◆ sha_verify()

int sha_verify ( const char *  key,
const char *  lock 
)

Definition at line 381 of file canlock.c.

References CL_SHA1, and cl_verify().