mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-10-07 04:02:18 +03:00
indenting
This commit is contained in:
1 parent
484e65d76e
commit
9181dd0a07
151 files changed
+3626
-3546
No files matched your search
@@ -47,8 +47,7 @@ typedef struct
|
||||
|
||||
/* Check whether the 8 byte key is weak. Does not check the parity
|
||||
* bits of the key but simple ignore them. */
|
||||
extern bool
|
||||
gl_des_is_weak_key (const char * key);
|
||||
extern bool gl_des_is_weak_key (const char *key);
|
||||
|
||||
/*
|
||||
* DES
|
||||
@@ -58,19 +57,17 @@ gl_des_is_weak_key (const char * key);
|
||||
/* Fill a DES context CTX with subkeys calculated from 64bit KEY.
|
||||
* Does not check parity bits, but simply ignore them. Does not check
|
||||
* for weak keys. */
|
||||
extern void
|
||||
gl_des_setkey (gl_des_ctx *ctx, const char * key);
|
||||
extern void gl_des_setkey (gl_des_ctx * ctx, const char *key);
|
||||
|
||||
/* Fill a DES context CTX with subkeys calculated from 64bit KEY, with
|
||||
* weak key checking. Does not check parity bits, but simply ignore
|
||||
* them. */
|
||||
extern bool
|
||||
gl_des_makekey (gl_des_ctx *ctx, const char * key, size_t keylen);
|
||||
extern bool gl_des_makekey (gl_des_ctx * ctx, const char *key, size_t keylen);
|
||||
|
||||
/* Electronic Codebook Mode DES encryption/decryption of data
|
||||
* according to 'mode'. */
|
||||
extern void
|
||||
gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode);
|
||||
gl_des_ecb_crypt (gl_des_ctx * ctx, const char *from, char *to, int mode);
|
||||
|
||||
#define gl_des_ecb_encrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 0)
|
||||
#define gl_des_ecb_decrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 1)
|
||||
@@ -83,9 +80,7 @@ gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode);
|
||||
* 64bit keys in KEY1 and KEY2. Does not check the parity bits of the
|
||||
* keys, but simply ignore them. Does not check for weak keys. */
|
||||
extern void
|
||||
gl_3des_set2keys (gl_3des_ctx *ctx,
|
||||
const char * key1,
|
||||
const char * key2);
|
||||
gl_3des_set2keys (gl_3des_ctx * ctx, const char *key1, const char *key2);
|
||||
|
||||
/*
|
||||
* Fill a Triple-DES context CTX with subkeys calculated from three
|
||||
@@ -93,27 +88,20 @@ gl_3des_set2keys (gl_3des_ctx *ctx,
|
||||
* of the keys, but simply ignore them. Does not check for weak
|
||||
* keys. */
|
||||
extern void
|
||||
gl_3des_set3keys (gl_3des_ctx *ctx,
|
||||
const char * key1,
|
||||
const char * key2,
|
||||
const char * key3);
|
||||
gl_3des_set3keys (gl_3des_ctx * ctx,
|
||||
const char *key1, const char *key2, const char *key3);
|
||||
|
||||
/* Fill a Triple-DES context CTX with subkeys calculated from three
|
||||
* concatenated 64bit keys in KEY, with weak key checking. Does not
|
||||
* check the parity bits of the keys, but simply ignore them. */
|
||||
extern bool
|
||||
gl_3des_makekey (gl_3des_ctx *ctx,
|
||||
const char * key,
|
||||
size_t keylen);
|
||||
gl_3des_makekey (gl_3des_ctx * ctx, const char *key, size_t keylen);
|
||||
|
||||
/* Electronic Codebook Mode Triple-DES encryption/decryption of data
|
||||
* according to 'mode'. Sometimes this mode is named 'EDE' mode
|
||||
* (Encryption-Decryption-Encryption). */
|
||||
extern void
|
||||
gl_3des_ecb_crypt (gl_3des_ctx *ctx,
|
||||
const char * from,
|
||||
char * to,
|
||||
int mode);
|
||||
gl_3des_ecb_crypt (gl_3des_ctx * ctx, const char *from, char *to, int mode);
|
||||
|
||||
#define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0)
|
||||
#define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1)
|
||||
|
||||
+87
-123
@@ -25,37 +25,37 @@
|
||||
# include <stddef.h>
|
||||
|
||||
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
|
||||
};
|
||||
{
|
||||
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
|
||||
};
|
||||
typedef enum Gc_rc Gc_rc;
|
||||
|
||||
/* Hash types. */
|
||||
enum Gc_hash
|
||||
{
|
||||
GC_MD4,
|
||||
GC_MD5,
|
||||
GC_SHA1,
|
||||
GC_MD2,
|
||||
GC_RMD160,
|
||||
GC_SHA256,
|
||||
GC_SHA384,
|
||||
GC_SHA512
|
||||
};
|
||||
{
|
||||
GC_MD4,
|
||||
GC_MD5,
|
||||
GC_SHA1,
|
||||
GC_MD2,
|
||||
GC_RMD160,
|
||||
GC_SHA256,
|
||||
GC_SHA384,
|
||||
GC_SHA512
|
||||
};
|
||||
typedef enum Gc_hash Gc_hash;
|
||||
|
||||
enum Gc_hash_mode
|
||||
{
|
||||
GC_HMAC = 1
|
||||
};
|
||||
{
|
||||
GC_HMAC = 1
|
||||
};
|
||||
typedef enum Gc_hash_mode Gc_hash_mode;
|
||||
|
||||
typedef void *gc_hash_handle;
|
||||
@@ -71,88 +71,71 @@ typedef void *gc_hash_handle;
|
||||
|
||||
/* Cipher types. */
|
||||
enum Gc_cipher
|
||||
{
|
||||
GC_AES128,
|
||||
GC_AES192,
|
||||
GC_AES256,
|
||||
GC_3DES,
|
||||
GC_DES,
|
||||
GC_ARCFOUR128,
|
||||
GC_ARCFOUR40,
|
||||
GC_ARCTWO40,
|
||||
GC_CAMELLIA128,
|
||||
GC_CAMELLIA256
|
||||
};
|
||||
{
|
||||
GC_AES128,
|
||||
GC_AES192,
|
||||
GC_AES256,
|
||||
GC_3DES,
|
||||
GC_DES,
|
||||
GC_ARCFOUR128,
|
||||
GC_ARCFOUR40,
|
||||
GC_ARCTWO40,
|
||||
GC_CAMELLIA128,
|
||||
GC_CAMELLIA256
|
||||
};
|
||||
typedef enum Gc_cipher Gc_cipher;
|
||||
|
||||
enum Gc_cipher_mode
|
||||
{
|
||||
GC_ECB,
|
||||
GC_CBC,
|
||||
GC_STREAM
|
||||
};
|
||||
{
|
||||
GC_ECB,
|
||||
GC_CBC,
|
||||
GC_STREAM
|
||||
};
|
||||
typedef enum Gc_cipher_mode Gc_cipher_mode;
|
||||
|
||||
typedef void * gc_cipher_handle;
|
||||
typedef void *gc_cipher_handle;
|
||||
|
||||
/* Call before respectively after any other functions. */
|
||||
Gc_rc gc_init(void);
|
||||
void gc_done(void);
|
||||
Gc_rc gc_init (void);
|
||||
void gc_done (void);
|
||||
|
||||
/* Memory allocation (avoid). */
|
||||
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 *);
|
||||
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);
|
||||
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 *);
|
||||
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);
|
||||
|
||||
/* Randomness. */
|
||||
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_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);
|
||||
|
||||
/* Ciphers. */
|
||||
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_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);
|
||||
|
||||
/* Hashes. */
|
||||
|
||||
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);
|
||||
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_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);
|
||||
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);
|
||||
|
||||
/* Compute a hash value over buffer IN of INLEN bytes size using the
|
||||
algorithm HASH, placing the result in the pre-allocated buffer OUT.
|
||||
@@ -160,34 +143,18 @@ void gc_hash_close(gc_hash_handle handle);
|
||||
GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer
|
||||
must be 16 bytes. The return value is 0 (GC_OK) on success, or
|
||||
another Gc_rc error code. */
|
||||
Gc_rc gc_hash_buffer(Gc_hash hash,
|
||||
const void *in,
|
||||
size_t inlen,
|
||||
char *out);
|
||||
Gc_rc gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out);
|
||||
|
||||
/* One-call interface. */
|
||||
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_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_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_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);
|
||||
|
||||
/* Derive cryptographic keys from a password P of length PLEN, with
|
||||
salt S of length SLEN, placing the result in pre-allocated buffer
|
||||
@@ -196,13 +163,10 @@ Gc_rc gc_hmac_sha1(const void *key,
|
||||
counts are 1000-20000). This function "stretches" the key to be
|
||||
exactly dkLen bytes long. GC_OK is returned on success, otherwise
|
||||
an Gc_rc error code is returned. */
|
||||
Gc_rc gc_pbkdf2_sha1(const char *P,
|
||||
size_t Plen,
|
||||
const char *S,
|
||||
size_t Slen,
|
||||
unsigned int c,
|
||||
char *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 *DK, size_t dkLen);
|
||||
|
||||
/*
|
||||
TODO:
|
||||
|
||||
@@ -131,8 +131,7 @@ inline
|
||||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
const char *msg_ctxt_id, const char *msgid, int category)
|
||||
{
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
@@ -150,9 +149,8 @@ inline
|
||||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n, int category)
|
||||
{
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
@@ -190,8 +188,7 @@ inline
|
||||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
const char *msgctxt, const char *msgid, int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
@@ -202,8 +199,7 @@ dcpgettext_expr (const char *domain,
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
? buf : (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
@@ -213,10 +209,10 @@ dcpgettext_expr (const char *domain,
|
||||
translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (translation != msg_ctxt_id)
|
||||
return translation;
|
||||
return translation;
|
||||
}
|
||||
return msgid;
|
||||
}
|
||||
@@ -235,9 +231,8 @@ inline
|
||||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n, int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
@@ -248,21 +243,21 @@ dcnpgettext_expr (const char *domain,
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
? buf : (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (!(translation == msg_ctxt_id || translation == msgid_plural))
|
||||
return translation;
|
||||
return translation;
|
||||
}
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
RESBUF buffer. Return 0 on success. */
|
||||
int
|
||||
hmac_md5 (const void *key, size_t keylen,
|
||||
const void *buffer, size_t buflen, void *resbuf);
|
||||
const void *buffer, size_t buflen, void *resbuf);
|
||||
|
||||
/* Compute Hashed Message Authentication Code with SHA-1, over BUFFER
|
||||
data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the
|
||||
@@ -36,6 +36,6 @@ hmac_md5 (const void *key, size_t keylen,
|
||||
success. */
|
||||
int
|
||||
hmac_sha1 (const void *key, size_t keylen,
|
||||
const void *in, size_t inlen, void *resbuf);
|
||||
const void *in, size_t inlen, void *resbuf);
|
||||
|
||||
#endif /* HMAC_H */
|
||||
+14
-10
@@ -74,21 +74,23 @@ struct md5_ctx
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
|
||||
extern void
|
||||
__md5_init_ctx (struct md5_ctx *ctx)
|
||||
__THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void __md5_process_block (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
extern void __md5_process_block (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void __md5_process_bytes (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
extern void __md5_process_bytes (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 16 bytes following RESBUF. The result is always in little
|
||||
@@ -97,7 +99,8 @@ extern void __md5_process_bytes (const void *buffer, size_t len,
|
||||
|
||||
IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
|
||||
boundary. */
|
||||
extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
extern void *__md5_finish_ctx (struct md5_ctx *ctx,
|
||||
void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
@@ -106,19 +109,20 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
|
||||
IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
|
||||
boundary. */
|
||||
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
extern void *__md5_read_ctx (const struct md5_ctx *ctx,
|
||||
void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int __md5_stream (FILE *stream, void *resblock) __THROW;
|
||||
extern int __md5_stream (FILE * stream, void *resblock) __THROW;
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *__md5_buffer (const char *buffer, size_t len,
|
||||
void *resblock) __THROW;
|
||||
extern void *__md5_buffer (const char *buffer, size_t len,
|
||||
void *resblock) __THROW;
|
||||
|
||||
#endif /* md5.h */
|
||||
@@ -77,13 +77,11 @@ typedef enum
|
||||
TYPE_COUNT_INT_POINTER,
|
||||
TYPE_COUNT_LONGINT_POINTER
|
||||
#if HAVE_LONG_LONG_INT
|
||||
, TYPE_COUNT_LONGLONGINT_POINTER
|
||||
, TYPE_COUNT_LONGLONGINT_POINTER
|
||||
#endif
|
||||
#if ENABLE_UNISTDIO
|
||||
/* The unistdio extensions. */
|
||||
, TYPE_U8_STRING
|
||||
, TYPE_U16_STRING
|
||||
, TYPE_U32_STRING
|
||||
/* The unistdio extensions. */
|
||||
, TYPE_U8_STRING, TYPE_U16_STRING, TYPE_U32_STRING
|
||||
#endif
|
||||
} arg_type;
|
||||
|
||||
@@ -93,42 +91,42 @@ typedef struct
|
||||
arg_type type;
|
||||
union
|
||||
{
|
||||
signed char a_schar;
|
||||
unsigned char a_uchar;
|
||||
short a_short;
|
||||
unsigned short a_ushort;
|
||||
int a_int;
|
||||
unsigned int a_uint;
|
||||
long int a_longint;
|
||||
unsigned long int a_ulongint;
|
||||
signed char a_schar;
|
||||
unsigned char a_uchar;
|
||||
short a_short;
|
||||
unsigned short a_ushort;
|
||||
int a_int;
|
||||
unsigned int a_uint;
|
||||
long int a_longint;
|
||||
unsigned long int a_ulongint;
|
||||
#if HAVE_LONG_LONG_INT
|
||||
long long int a_longlongint;
|
||||
unsigned long long int a_ulonglongint;
|
||||
long long int a_longlongint;
|
||||
unsigned long long int a_ulonglongint;
|
||||
#endif
|
||||
float a_float;
|
||||
double a_double;
|
||||
long double a_longdouble;
|
||||
int a_char;
|
||||
float a_float;
|
||||
double a_double;
|
||||
long double a_longdouble;
|
||||
int a_char;
|
||||
#if HAVE_WINT_T
|
||||
wint_t a_wide_char;
|
||||
wint_t a_wide_char;
|
||||
#endif
|
||||
const char* a_string;
|
||||
const char *a_string;
|
||||
#if HAVE_WCHAR_T
|
||||
const wchar_t* a_wide_string;
|
||||
const wchar_t *a_wide_string;
|
||||
#endif
|
||||
void* a_pointer;
|
||||
signed char * a_count_schar_pointer;
|
||||
short * a_count_short_pointer;
|
||||
int * a_count_int_pointer;
|
||||
long int * a_count_longint_pointer;
|
||||
void *a_pointer;
|
||||
signed char *a_count_schar_pointer;
|
||||
short *a_count_short_pointer;
|
||||
int *a_count_int_pointer;
|
||||
long int *a_count_longint_pointer;
|
||||
#if HAVE_LONG_LONG_INT
|
||||
long long int * a_count_longlongint_pointer;
|
||||
long long int *a_count_longlongint_pointer;
|
||||
#endif
|
||||
#if ENABLE_UNISTDIO
|
||||
/* The unistdio extensions. */
|
||||
const uint8_t * a_u8_string;
|
||||
const uint16_t * a_u16_string;
|
||||
const uint32_t * a_u32_string;
|
||||
const uint8_t *a_u8_string;
|
||||
const uint16_t *a_u16_string;
|
||||
const uint32_t *a_u32_string;
|
||||
#endif
|
||||
}
|
||||
a;
|
||||
@@ -149,6 +147,6 @@ STATIC
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int PRINTF_FETCHARGS (va_list args, arguments *a);
|
||||
int PRINTF_FETCHARGS (va_list args, arguments * a);
|
||||
|
||||
#endif /* _PRINTF_ARGS_H */
|
||||
@@ -25,11 +25,11 @@
|
||||
#include "printf-args.h"
|
||||
|
||||
/* Flags */
|
||||
#define FLAG_GROUP 1 /* ' flag */
|
||||
#define FLAG_LEFT 2 /* - flag */
|
||||
#define FLAG_SHOWSIGN 4 /* + flag */
|
||||
#define FLAG_SPACE 8 /* space flag */
|
||||
#define FLAG_ALT 16 /* # flag */
|
||||
#define FLAG_GROUP 1 /* ' flag */
|
||||
#define FLAG_LEFT 2 /* - flag */
|
||||
#define FLAG_SHOWSIGN 4 /* + flag */
|
||||
#define FLAG_SPACE 8 /* space flag */
|
||||
#define FLAG_ALT 16 /* # flag */
|
||||
#define FLAG_ZERO 32
|
||||
|
||||
/* arg_index value indicating that no argument is consumed. */
|
||||
@@ -41,16 +41,16 @@
|
||||
/* A parsed directive. */
|
||||
typedef struct
|
||||
{
|
||||
const char* dir_start;
|
||||
const char* dir_end;
|
||||
const char *dir_start;
|
||||
const char *dir_end;
|
||||
int flags;
|
||||
const char* width_start;
|
||||
const char* width_end;
|
||||
const char *width_start;
|
||||
const char *width_end;
|
||||
size_t width_arg_index;
|
||||
const char* precision_start;
|
||||
const char* precision_end;
|
||||
const char *precision_start;
|
||||
const char *precision_end;
|
||||
size_t precision_arg_index;
|
||||
char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
size_t arg_index;
|
||||
}
|
||||
char_directive;
|
||||
@@ -70,16 +70,16 @@ char_directives;
|
||||
/* A parsed directive. */
|
||||
typedef struct
|
||||
{
|
||||
const uint8_t* dir_start;
|
||||
const uint8_t* dir_end;
|
||||
const uint8_t *dir_start;
|
||||
const uint8_t *dir_end;
|
||||
int flags;
|
||||
const uint8_t* width_start;
|
||||
const uint8_t* width_end;
|
||||
const uint8_t *width_start;
|
||||
const uint8_t *width_end;
|
||||
size_t width_arg_index;
|
||||
const uint8_t* precision_start;
|
||||
const uint8_t* precision_end;
|
||||
const uint8_t *precision_start;
|
||||
const uint8_t *precision_end;
|
||||
size_t precision_arg_index;
|
||||
uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
size_t arg_index;
|
||||
}
|
||||
u8_directive;
|
||||
@@ -97,16 +97,16 @@ u8_directives;
|
||||
/* A parsed directive. */
|
||||
typedef struct
|
||||
{
|
||||
const uint16_t* dir_start;
|
||||
const uint16_t* dir_end;
|
||||
const uint16_t *dir_start;
|
||||
const uint16_t *dir_end;
|
||||
int flags;
|
||||
const uint16_t* width_start;
|
||||
const uint16_t* width_end;
|
||||
const uint16_t *width_start;
|
||||
const uint16_t *width_end;
|
||||
size_t width_arg_index;
|
||||
const uint16_t* precision_start;
|
||||
const uint16_t* precision_end;
|
||||
const uint16_t *precision_start;
|
||||
const uint16_t *precision_end;
|
||||
size_t precision_arg_index;
|
||||
uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
size_t arg_index;
|
||||
}
|
||||
u16_directive;
|
||||
@@ -124,16 +124,16 @@ u16_directives;
|
||||
/* A parsed directive. */
|
||||
typedef struct
|
||||
{
|
||||
const uint32_t* dir_start;
|
||||
const uint32_t* dir_end;
|
||||
const uint32_t *dir_start;
|
||||
const uint32_t *dir_end;
|
||||
int flags;
|
||||
const uint32_t* width_start;
|
||||
const uint32_t* width_end;
|
||||
const uint32_t *width_start;
|
||||
const uint32_t *width_end;
|
||||
size_t width_arg_index;
|
||||
const uint32_t* precision_start;
|
||||
const uint32_t* precision_end;
|
||||
const uint32_t *precision_start;
|
||||
const uint32_t *precision_end;
|
||||
size_t precision_arg_index;
|
||||
uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
|
||||
size_t arg_index;
|
||||
}
|
||||
u32_directive;
|
||||
@@ -157,22 +157,20 @@ u32_directives;
|
||||
arguments and the needed count of arguments. */
|
||||
#if ENABLE_UNISTDIO
|
||||
extern int
|
||||
ulc_printf_parse (const char *format, char_directives *d, arguments *a);
|
||||
ulc_printf_parse (const char *format, char_directives * d, arguments * a);
|
||||
extern int
|
||||
u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
|
||||
u8_printf_parse (const uint8_t * format, u8_directives * d, arguments * a);
|
||||
extern int
|
||||
u16_printf_parse (const uint16_t *format, u16_directives *d,
|
||||
arguments *a);
|
||||
u16_printf_parse (const uint16_t * format, u16_directives * d, arguments * a);
|
||||
extern int
|
||||
u32_printf_parse (const uint32_t *format, u32_directives *d,
|
||||
arguments *a);
|
||||
u32_printf_parse (const uint32_t * format, u32_directives * d, arguments * a);
|
||||
#else
|
||||
# ifdef STATIC
|
||||
STATIC
|
||||
# else
|
||||
extern
|
||||
# endif
|
||||
int printf_parse (const char *format, char_directives *d, arguments *a);
|
||||
int printf_parse (const char *format, char_directives * d, arguments * a);
|
||||
#endif
|
||||
|
||||
#endif /* _PRINTF_PARSE_H */
|
||||
@@ -135,6 +135,7 @@ static const uint32_t Te0[256] = {
|
||||
0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
|
||||
0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
|
||||
};
|
||||
|
||||
static const uint32_t Te1[256] = {
|
||||
0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
|
||||
0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
|
||||
@@ -201,6 +202,7 @@ static const uint32_t Te1[256] = {
|
||||
0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f,
|
||||
0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
|
||||
};
|
||||
|
||||
static const uint32_t Te2[256] = {
|
||||
0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b,
|
||||
0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5,
|
||||
@@ -267,6 +269,7 @@ static const uint32_t Te2[256] = {
|
||||
0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f,
|
||||
0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
|
||||
};
|
||||
|
||||
static const uint32_t Te3[256] = {
|
||||
0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6,
|
||||
0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
|
||||
@@ -333,6 +336,7 @@ static const uint32_t Te3[256] = {
|
||||
0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e,
|
||||
0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c,
|
||||
};
|
||||
|
||||
static const uint32_t Te4[256] = {
|
||||
0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b,
|
||||
0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5,
|
||||
@@ -399,6 +403,7 @@ static const uint32_t Te4[256] = {
|
||||
0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f,
|
||||
0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616,
|
||||
};
|
||||
|
||||
static const uint32_t Td0[256] = {
|
||||
0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
|
||||
0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
|
||||
@@ -465,6 +470,7 @@ static const uint32_t Td0[256] = {
|
||||
0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
|
||||
0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
|
||||
};
|
||||
|
||||
static const uint32_t Td1[256] = {
|
||||
0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e,
|
||||
0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
|
||||
@@ -531,6 +537,7 @@ static const uint32_t Td1[256] = {
|
||||
0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1,
|
||||
0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
|
||||
};
|
||||
|
||||
static const uint32_t Td2[256] = {
|
||||
0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
|
||||
0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3,
|
||||
@@ -597,6 +604,7 @@ static const uint32_t Td2[256] = {
|
||||
0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456,
|
||||
0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
|
||||
};
|
||||
|
||||
static const uint32_t Td3[256] = {
|
||||
0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a,
|
||||
0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b,
|
||||
@@ -663,6 +671,7 @@ static const uint32_t Td3[256] = {
|
||||
0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064,
|
||||
0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0,
|
||||
};
|
||||
|
||||
static const uint32_t Td4[256] = {
|
||||
0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5,
|
||||
0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838,
|
||||
@@ -729,6 +738,7 @@ static const uint32_t Td4[256] = {
|
||||
0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363,
|
||||
0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d,
|
||||
};
|
||||
|
||||
static const uint32_t rcon[] = {
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||
0x10000000, 0x20000000, 0x40000000, 0x80000000,
|
||||
|
||||
@@ -56,12 +56,12 @@
|
||||
#define RIJNDAEL_MAXNR 14
|
||||
|
||||
int rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
|
||||
const char cipherKey[], size_t keyBits);
|
||||
const char cipherKey[], size_t keyBits);
|
||||
int rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
|
||||
const char cipherKey[], size_t keyBits);
|
||||
const char cipherKey[], size_t keyBits);
|
||||
void rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
|
||||
const char pt[16], char ct[16]);
|
||||
const char pt[16], char ct[16]);
|
||||
void rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
|
||||
const char ct[16], char pt[16]);
|
||||
const char ct[16], char pt[16]);
|
||||
|
||||
#endif /* __RIJNDAEL_ALG_FST_H */
|
||||
@@ -95,15 +95,15 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RIJNDAEL_DIR_ENCRYPT = 0, /* Are we encrypting? */
|
||||
RIJNDAEL_DIR_DECRYPT = 1 /* Are we decrypting? */
|
||||
RIJNDAEL_DIR_ENCRYPT = 0, /* Are we encrypting? */
|
||||
RIJNDAEL_DIR_DECRYPT = 1 /* Are we decrypting? */
|
||||
} rijndael_direction;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RIJNDAEL_MODE_ECB = 1, /* Are we ciphering in ECB mode? */
|
||||
RIJNDAEL_MODE_CBC = 2, /* Are we ciphering in CBC mode? */
|
||||
RIJNDAEL_MODE_CFB1 = 3 /* Are we ciphering in 1-bit CFB mode? */
|
||||
RIJNDAEL_MODE_ECB = 1, /* Are we ciphering in ECB mode? */
|
||||
RIJNDAEL_MODE_CBC = 2, /* Are we ciphering in CBC mode? */
|
||||
RIJNDAEL_MODE_CFB1 = 3 /* Are we ciphering in 1-bit CFB mode? */
|
||||
} rijndael_mode;
|
||||
|
||||
/* The structure for key information */
|
||||
@@ -125,8 +125,8 @@ typedef struct
|
||||
|
||||
/* The structure for cipher information */
|
||||
typedef struct
|
||||
{ /* changed order of the components */
|
||||
rijndael_mode mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
|
||||
{ /* changed order of the components */
|
||||
rijndael_mode mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
|
||||
/* A possible Initialization Vector for ciphering */
|
||||
char IV[RIJNDAEL_MAX_IV_SIZE];
|
||||
} rijndaelCipherInstance;
|
||||
@@ -137,16 +137,16 @@ typedef struct
|
||||
from KEYMATERIAL, a hex string, of KEYLEN size. KEYLEN should be
|
||||
128, 192 or 256. Returns 0 on success, or an error code. */
|
||||
extern rijndael_rc
|
||||
rijndaelMakeKey (rijndaelKeyInstance *key, rijndael_direction direction,
|
||||
size_t keyLen, const char *keyMaterial);
|
||||
rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
|
||||
size_t keyLen, const char *keyMaterial);
|
||||
|
||||
/* Initialize cipher state CIPHER for encryption MODE (e.g.,
|
||||
RIJNDAEL_MODE_CBC) with initialization vector IV, a hex string of
|
||||
2*RIJNDAEL_MAX_IV_SIZE length. IV may be NULL for modes that do
|
||||
not need an IV (i.e., RIJNDAEL_MODE_ECB). */
|
||||
extern rijndael_rc
|
||||
rijndaelCipherInit (rijndaelCipherInstance *cipher,
|
||||
rijndael_mode mode, const char *IV);
|
||||
rijndaelCipherInit (rijndaelCipherInstance * cipher,
|
||||
rijndael_mode mode, const char *IV);
|
||||
|
||||
/* Encrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
|
||||
output in the pre-allocated OUTBUFFER which must hold at least
|
||||
@@ -156,10 +156,9 @@ rijndaelCipherInit (rijndaelCipherInstance *cipher,
|
||||
calling this function. Return the number of bits written, or a
|
||||
negative rijndael_rc error code. */
|
||||
extern int
|
||||
rijndaelBlockEncrypt (rijndaelCipherInstance *cipher,
|
||||
const rijndaelKeyInstance *key,
|
||||
const char *input, size_t inputLen,
|
||||
char *outBuffer);
|
||||
rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
|
||||
const rijndaelKeyInstance * key,
|
||||
const char *input, size_t inputLen, char *outBuffer);
|
||||
|
||||
/* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the
|
||||
output in the pre-allocated OUTBUFFER which must hold at least
|
||||
@@ -171,10 +170,9 @@ rijndaelBlockEncrypt (rijndaelCipherInstance *cipher,
|
||||
calling this function. Return the number of bits written, or a
|
||||
negative rijndael_rc error code. */
|
||||
extern int
|
||||
rijndaelPadEncrypt (rijndaelCipherInstance *cipher,
|
||||
const rijndaelKeyInstance *key,
|
||||
const char *input, size_t inputOctets,
|
||||
char *outBuffer);
|
||||
rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
|
||||
const rijndaelKeyInstance * key,
|
||||
const char *input, size_t inputOctets, char *outBuffer);
|
||||
|
||||
/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
|
||||
output in the pre-allocated OUTBUFFER which must hold at least
|
||||
@@ -184,10 +182,9 @@ rijndaelPadEncrypt (rijndaelCipherInstance *cipher,
|
||||
calling this function. Return the number of bits written, or a
|
||||
negative rijndael_rc error code. */
|
||||
extern int
|
||||
rijndaelBlockDecrypt (rijndaelCipherInstance *cipher,
|
||||
const rijndaelKeyInstance *key,
|
||||
const char *input, size_t inputLen,
|
||||
char *outBuffer);
|
||||
rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
|
||||
const rijndaelKeyInstance * key,
|
||||
const char *input, size_t inputLen, char *outBuffer);
|
||||
|
||||
/* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the
|
||||
output in the pre-allocated OUTBUFFER which must hold at least
|
||||
@@ -199,9 +196,8 @@ rijndaelBlockDecrypt (rijndaelCipherInstance *cipher,
|
||||
calling this function. Return the number of bits written, or a
|
||||
negative rijndael_rc error code. */
|
||||
extern int
|
||||
rijndaelPadDecrypt (rijndaelCipherInstance *cipher,
|
||||
const rijndaelKeyInstance *key,
|
||||
const char *input, size_t inputOctets,
|
||||
char *outBuffer);
|
||||
rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
|
||||
const rijndaelKeyInstance * key,
|
||||
const char *input, size_t inputOctets, char *outBuffer);
|
||||
|
||||
#endif /* __RIJNDAEL_API_FST_H */
|
||||
@@ -45,14 +45,14 @@ extern void sha1_init_ctx (struct sha1_ctx *ctx);
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void sha1_process_block (const void *buffer, size_t len,
|
||||
struct sha1_ctx *ctx);
|
||||
struct sha1_ctx *ctx);
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void sha1_process_bytes (const void *buffer, size_t len,
|
||||
struct sha1_ctx *ctx);
|
||||
struct sha1_ctx *ctx);
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 20 bytes following RESBUF. The result is always in little
|
||||
@@ -76,7 +76,7 @@ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
|
||||
/* Compute SHA1 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 20 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int sha1_stream (FILE *stream, void *resblock);
|
||||
extern int sha1_stream (FILE * stream, void *resblock);
|
||||
|
||||
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
@@ -38,7 +38,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Write formatted output to a string dynamically allocated with malloc().
|
||||
@@ -69,13 +70,15 @@ extern "C" {
|
||||
# define asnprintf rpl_asnprintf
|
||||
# define vasnprintf rpl_vasnprintf
|
||||
#endif
|
||||
extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 3, 0)));
|
||||
extern char *asnprintf (char *resultbuf, size_t * lengthp,
|
||||
const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
extern char *vasnprintf (char *resultbuf, size_t * lengthp,
|
||||
const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 3, 0)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VASNPRINTF_H */
|
||||
#endif /* _VASNPRINTF_H */
|
||||
@@ -51,9 +51,9 @@
|
||||
/* Sum of two sizes, with overflow check. */
|
||||
static inline size_t
|
||||
#if __GNUC__ >= 3
|
||||
__attribute__ ((__pure__))
|
||||
__attribute__ ((__pure__))
|
||||
#endif
|
||||
xsum (size_t size1, size_t size2)
|
||||
xsum (size_t size1, size_t size2)
|
||||
{
|
||||
size_t sum = size1 + size2;
|
||||
return (sum >= size1 ? sum : SIZE_MAX);
|
||||
@@ -62,9 +62,9 @@ xsum (size_t size1, size_t size2)
|
||||
/* Sum of three sizes, with overflow check. */
|
||||
static inline size_t
|
||||
#if __GNUC__ >= 3
|
||||
__attribute__ ((__pure__))
|
||||
__attribute__ ((__pure__))
|
||||
#endif
|
||||
xsum3 (size_t size1, size_t size2, size_t size3)
|
||||
xsum3 (size_t size1, size_t size2, size_t size3)
|
||||
{
|
||||
return xsum (xsum (size1, size2), size3);
|
||||
}
|
||||
@@ -72,9 +72,9 @@ xsum3 (size_t size1, size_t size2, size_t size3)
|
||||
/* Sum of four sizes, with overflow check. */
|
||||
static inline size_t
|
||||
#if __GNUC__ >= 3
|
||||
__attribute__ ((__pure__))
|
||||
__attribute__ ((__pure__))
|
||||
#endif
|
||||
xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
|
||||
xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
|
||||
{
|
||||
return xsum (xsum (xsum (size1, size2), size3), size4);
|
||||
}
|
||||
@@ -82,9 +82,9 @@ xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
|
||||
/* Maximum of two sizes, with overflow check. */
|
||||
static inline size_t
|
||||
#if __GNUC__ >= 3
|
||||
__attribute__ ((__pure__))
|
||||
__attribute__ ((__pure__))
|
||||
#endif
|
||||
xmax (size_t size1, size_t size2)
|
||||
xmax (size_t size1, size_t size2)
|
||||
{
|
||||
/* No explicit check is needed here, because for any n:
|
||||
max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
|
||||
@@ -106,4 +106,3 @@ xmax (size_t size1, size_t size2)
|
||||
((SIZE) != SIZE_MAX)
|
||||
|
||||
#endif /* _XSIZE_H */
|
||||
|
||||
Reference in new issue
Block a user