gsasl  1.10.0
About: GNU SASL is an implementation of the Simple Authentication and Security Layer (SASL). Development version.
  Fossies Dox: gsasl-1.10.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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

Go to the source code of this file.

Macros

#define GC_MD2_DIGEST_SIZE   16
 
#define GC_MD4_DIGEST_SIZE   16
 
#define GC_MD5_DIGEST_SIZE   16
 
#define GC_RMD160_DIGEST_SIZE   20
 
#define GC_SHA1_DIGEST_SIZE   20
 
#define GC_SHA256_DIGEST_SIZE   32
 
#define GC_SHA384_DIGEST_SIZE   48
 
#define GC_SHA512_DIGEST_SIZE   64
 
#define GC_SHA224_DIGEST_SIZE   24
 
#define GC_SM3_DIGEST_SIZE   32
 
#define GC_MAX_DIGEST_SIZE   64
 

Typedefs

typedef enum Gc_rc Gc_rc
 
typedef enum Gc_hash Gc_hash
 
typedef enum Gc_hash_mode Gc_hash_mode
 
typedef void * gc_hash_handle
 
typedef enum Gc_cipher Gc_cipher
 
typedef enum Gc_cipher_mode Gc_cipher_mode
 
typedef void * gc_cipher_handle
 
typedef void *(* gc_malloc_t) (size_t n)
 
typedef int(* gc_secure_check_t) (const void *)
 
typedef void *(* gc_realloc_t) (void *p, size_t n)
 
typedef void(* gc_free_t) (void *)
 

Enumerations

enum  Gc_rc {
  GC_OK = 0 , GC_MALLOC_ERROR , GC_INIT_ERROR , GC_RANDOM_ERROR ,
  GC_INVALID_CIPHER , GC_INVALID_HASH , GC_PKCS5_INVALID_ITERATION_COUNT , GC_PKCS5_INVALID_DERIVED_KEY_LENGTH ,
  GC_PKCS5_DERIVED_KEY_TOO_LONG
}
 
enum  Gc_hash {
  GC_MD4 , GC_MD5 , GC_SHA1 , GC_MD2 ,
  GC_RMD160 , GC_SHA256 , GC_SHA384 , GC_SHA512 ,
  GC_SHA224 , GC_SM3
}
 
enum  Gc_hash_mode { GC_NULL , GC_HMAC }
 
enum  Gc_cipher {
  GC_AES128 , GC_AES192 , GC_AES256 , GC_3DES ,
  GC_DES , GC_ARCFOUR128 , GC_ARCFOUR40 , GC_ARCTWO40 ,
  GC_CAMELLIA128 , GC_CAMELLIA256
}
 
enum  Gc_cipher_mode { GC_ECB , GC_CBC , GC_STREAM }
 

Functions

Gc_rc gc_init (void)
 
void gc_done (void)
 
void gc_set_allocators (gc_malloc_t func_malloc, gc_malloc_t secure_malloc, gc_secure_check_t secure_check, gc_realloc_t func_realloc, gc_free_t func_free)
 
Gc_rc gc_nonce (char *data, size_t datalen)
 
Gc_rc gc_pseudo_random (char *data, size_t datalen)
 
Gc_rc gc_random (char *data, size_t datalen)
 
Gc_rc gc_cipher_open (Gc_cipher cipher, Gc_cipher_mode mode, gc_cipher_handle *outhandle)
 
Gc_rc gc_cipher_setkey (gc_cipher_handle handle, size_t keylen, const char *key)
 
Gc_rc gc_cipher_setiv (gc_cipher_handle handle, size_t ivlen, const char *iv)
 
Gc_rc gc_cipher_encrypt_inline (gc_cipher_handle handle, size_t len, char *data)
 
Gc_rc gc_cipher_decrypt_inline (gc_cipher_handle handle, size_t len, char *data)
 
Gc_rc gc_cipher_close (gc_cipher_handle handle)
 
Gc_rc gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle *outhandle)
 
Gc_rc gc_hash_clone (gc_hash_handle handle, gc_hash_handle *outhandle)
 
size_t gc_hash_digest_length (Gc_hash hash) _GL_ATTRIBUTE_CONST
 
void gc_hash_hmac_setkey (gc_hash_handle handle, size_t len, const char *key)
 
void gc_hash_write (gc_hash_handle handle, size_t len, const char *data)
 
const char * gc_hash_read (gc_hash_handle handle)
 
void gc_hash_close (gc_hash_handle handle)
 
Gc_rc gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out)
 
Gc_rc gc_md2 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_md4 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_md5 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_sha1 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_sha256 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_sha512 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_sm3 (const void *in, size_t inlen, void *resbuf)
 
Gc_rc gc_hmac_md5 (const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
 
Gc_rc gc_hmac_sha1 (const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
 
Gc_rc gc_hmac_sha256 (const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
 
Gc_rc gc_hmac_sha512 (const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
 
Gc_rc gc_pbkdf2_hmac (Gc_hash hash, const char *P, size_t Plen, const char *S, size_t Slen, unsigned int c, char *restrict DK, size_t dkLen)
 
Gc_rc gc_pbkdf2_sha1 (const char *P, size_t Plen, const char *S, size_t Slen, unsigned int c, char *restrict DK, size_t dkLen)
 

Macro Definition Documentation

◆ GC_MAX_DIGEST_SIZE

#define GC_MAX_DIGEST_SIZE   64

Definition at line 75 of file gc.h.

◆ GC_MD2_DIGEST_SIZE

#define GC_MD2_DIGEST_SIZE   16

Definition at line 64 of file gc.h.

◆ GC_MD4_DIGEST_SIZE

#define GC_MD4_DIGEST_SIZE   16

Definition at line 65 of file gc.h.

◆ GC_MD5_DIGEST_SIZE

#define GC_MD5_DIGEST_SIZE   16

Definition at line 66 of file gc.h.

◆ GC_RMD160_DIGEST_SIZE

#define GC_RMD160_DIGEST_SIZE   20

Definition at line 67 of file gc.h.

◆ GC_SHA1_DIGEST_SIZE

#define GC_SHA1_DIGEST_SIZE   20

Definition at line 68 of file gc.h.

◆ GC_SHA224_DIGEST_SIZE

#define GC_SHA224_DIGEST_SIZE   24

Definition at line 72 of file gc.h.

◆ GC_SHA256_DIGEST_SIZE

#define GC_SHA256_DIGEST_SIZE   32

Definition at line 69 of file gc.h.

◆ GC_SHA384_DIGEST_SIZE

#define GC_SHA384_DIGEST_SIZE   48

Definition at line 70 of file gc.h.

◆ GC_SHA512_DIGEST_SIZE

#define GC_SHA512_DIGEST_SIZE   64

Definition at line 71 of file gc.h.

◆ GC_SM3_DIGEST_SIZE

#define GC_SM3_DIGEST_SIZE   32

Definition at line 73 of file gc.h.

Typedef Documentation

◆ Gc_cipher

typedef enum Gc_cipher Gc_cipher

Definition at line 62 of file gc.h.

◆ gc_cipher_handle

typedef void* gc_cipher_handle

Definition at line 101 of file gc.h.

◆ Gc_cipher_mode

Definition at line 62 of file gc.h.

◆ gc_free_t

typedef void(* gc_free_t) (void *)

Definition at line 111 of file gc.h.

◆ Gc_hash

typedef enum Gc_hash Gc_hash

Definition at line 1 of file gc.h.

◆ gc_hash_handle

typedef void* gc_hash_handle

Definition at line 62 of file gc.h.

◆ Gc_hash_mode

typedef enum Gc_hash_mode Gc_hash_mode

Definition at line 1 of file gc.h.

◆ gc_malloc_t

typedef void*(* gc_malloc_t) (size_t n)

Definition at line 108 of file gc.h.

◆ Gc_rc

typedef enum Gc_rc Gc_rc

Definition at line 1 of file gc.h.

◆ gc_realloc_t

typedef void*(* gc_realloc_t) (void *p, size_t n)

Definition at line 110 of file gc.h.

◆ gc_secure_check_t

typedef int(* gc_secure_check_t) (const void *)

Definition at line 109 of file gc.h.

Enumeration Type Documentation

◆ Gc_cipher

enum Gc_cipher
Enumerator
GC_AES128 
GC_AES192 
GC_AES256 
GC_3DES 
GC_DES 
GC_ARCFOUR128 
GC_ARCFOUR40 
GC_ARCTWO40 
GC_CAMELLIA128 
GC_CAMELLIA256 

Definition at line 78 of file gc.h.

◆ Gc_cipher_mode

Enumerator
GC_ECB 
GC_CBC 
GC_STREAM 

Definition at line 93 of file gc.h.

◆ Gc_hash

enum Gc_hash
Enumerator
GC_MD4 
GC_MD5 
GC_SHA1 
GC_MD2 
GC_RMD160 
GC_SHA256 
GC_SHA384 
GC_SHA512 
GC_SHA224 
GC_SM3 

Definition at line 40 of file gc.h.

◆ Gc_hash_mode

Enumerator
GC_NULL 
GC_HMAC 

Definition at line 55 of file gc.h.

◆ Gc_rc

enum Gc_rc
Enumerator
GC_OK 
GC_MALLOC_ERROR 
GC_INIT_ERROR 
GC_RANDOM_ERROR 
GC_INVALID_CIPHER 
GC_INVALID_HASH 
GC_PKCS5_INVALID_ITERATION_COUNT 
GC_PKCS5_INVALID_DERIVED_KEY_LENGTH 
GC_PKCS5_DERIVED_KEY_TOO_LONG 

Definition at line 25 of file gc.h.

Function Documentation

◆ gc_cipher_close()

Gc_rc gc_cipher_close ( gc_cipher_handle  handle)

Definition at line 606 of file gc-gnulib.c.

References GC_OK.

◆ gc_cipher_decrypt_inline()

Gc_rc gc_cipher_decrypt_inline ( gc_cipher_handle  handle,
size_t  len,
char *  data 
)

◆ gc_cipher_encrypt_inline()

Gc_rc gc_cipher_encrypt_inline ( gc_cipher_handle  handle,
size_t  len,
char *  data 
)

◆ gc_cipher_open()

◆ gc_cipher_setiv()

Gc_rc gc_cipher_setiv ( gc_cipher_handle  handle,
size_t  ivlen,
const char *  iv 
)

◆ gc_cipher_setkey()

Gc_rc gc_cipher_setkey ( gc_cipher_handle  handle,
size_t  keylen,
const char *  key 
)

◆ gc_done()

void gc_done ( void  )

Definition at line 126 of file gc-gnulib.c.

◆ gc_hash_buffer()

Gc_rc gc_hash_buffer ( Gc_hash  hash,
const void *  in,
size_t  inlen,
char *  out 
)

◆ gc_hash_clone()

Gc_rc gc_hash_clone ( gc_hash_handle  handle,
gc_hash_handle outhandle 
)

Definition at line 722 of file gc-gnulib.c.

References GC_INVALID_HASH, GC_MALLOC_ERROR, GC_OK, and _gc_hash_ctx::gch.

◆ gc_hash_close()

void gc_hash_close ( gc_hash_handle  handle)

Definition at line 901 of file gc-gnulib.c.

References _gc_hash_ctx::alg, GC_MD2, GC_SM3, and _gc_hash_ctx::gch.

◆ gc_hash_digest_length()

◆ gc_hash_hmac_setkey()

void gc_hash_hmac_setkey ( gc_hash_handle  handle,
size_t  len,
const char *  key 
)

Definition at line 446 of file gc-libgcrypt.c.

References _gc_hash_ctx::alg, GC_MD2, GC_SM3, and _gc_hash_ctx::gch.

◆ gc_hash_open()

◆ gc_hash_read()

◆ gc_hash_write()

◆ gc_hmac_md5()

Gc_rc gc_hmac_md5 ( const void *  key,
size_t  keylen,
const void *  in,
size_t  inlen,
char *  resbuf 
)

◆ gc_hmac_sha1()

Gc_rc gc_hmac_sha1 ( const void *  key,
size_t  keylen,
const void *  in,
size_t  inlen,
char *  resbuf 
)

Definition at line 1037 of file gc-gnulib.c.

References GC_INVALID_HASH, GC_OK, GC_SHA1_DIGEST_SIZE, hmac_sha1(), and NULL.

Referenced by _gsasl_hmac(), gc_pbkdf2_hmac(), and gsasl_hmac_sha1().

◆ gc_hmac_sha256()

Gc_rc gc_hmac_sha256 ( const void *  key,
size_t  keylen,
const void *  in,
size_t  inlen,
char *  resbuf 
)

Referenced by _gsasl_hmac(), and gc_pbkdf2_hmac().

◆ gc_hmac_sha512()

Gc_rc gc_hmac_sha512 ( const void *  key,
size_t  keylen,
const void *  in,
size_t  inlen,
char *  resbuf 
)

Referenced by gc_pbkdf2_hmac().

◆ gc_init()

Gc_rc gc_init ( void  )

Definition at line 99 of file gc-gnulib.c.

References GC_INIT_ERROR, GC_OK, GC_RANDOM_ERROR, MIN_GCRYPT_VERSION, and NULL.

Referenced by gsasl_init().

◆ gc_md2()

Gc_rc gc_md2 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

◆ gc_md4()

Gc_rc gc_md4 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

◆ gc_md5()

Gc_rc gc_md5 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

◆ gc_nonce()

Gc_rc gc_nonce ( char *  data,
size_t  datalen 
)

Definition at line 207 of file gc-gnulib.c.

References GC_OK, and randomize().

Referenced by cram_md5_challenge(), and gsasl_nonce().

◆ gc_pbkdf2_hmac()

Gc_rc gc_pbkdf2_hmac ( Gc_hash  hash,
const char *  P,
size_t  Plen,
const char *  S,
size_t  Slen,
unsigned int  c,
char *restrict  DK,
size_t  dkLen 
)

◆ gc_pbkdf2_sha1()

Gc_rc gc_pbkdf2_sha1 ( const char *  P,
size_t  Plen,
const char *  S,
size_t  Slen,
unsigned int  c,
char *restrict  DK,
size_t  dkLen 
)

◆ gc_pseudo_random()

Gc_rc gc_pseudo_random ( char *  data,
size_t  datalen 
)

Definition at line 213 of file gc-gnulib.c.

References GC_OK, and randomize().

◆ gc_random()

Gc_rc gc_random ( char *  data,
size_t  datalen 
)

Definition at line 219 of file gc-gnulib.c.

References GC_OK, and randomize().

Referenced by gsasl_random().

◆ gc_set_allocators()

void gc_set_allocators ( gc_malloc_t  func_malloc,
gc_malloc_t  secure_malloc,
gc_secure_check_t  secure_check,
gc_realloc_t  func_realloc,
gc_free_t  func_free 
)

Definition at line 229 of file gc-gnulib.c.

◆ gc_sha1()

Gc_rc gc_sha1 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

Definition at line 991 of file gc-gnulib.c.

References GC_INVALID_HASH, GC_OK, GC_SHA1_DIGEST_SIZE, NULL, p, and sha1_buffer().

Referenced by _gsasl_hash(), and gsasl_sha1().

◆ gc_sha256()

Gc_rc gc_sha256 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

Referenced by _gsasl_hash().

◆ gc_sha512()

Gc_rc gc_sha512 ( const void *  in,
size_t  inlen,
void *  resbuf 
)

◆ gc_sm3()

Gc_rc gc_sm3 ( const void *  in,
size_t  inlen,
void *  resbuf 
)