src/vsl_util.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2006, Internet2
00003  * Legal conditions are in file LICENSE
00004  * (MD5 = c434f2e53b8089d8b4d0172c7ce07360).
00005  */
00006 
00007 /**
00008  * @file   vsl_util.h
00009  * @author Nikolaus Rath
00010  * @brief  Utility functions for the security layer (header)
00011  *
00012  **/
00013 
00014 #ifndef VSL_UTIL_H
00015 #define VSL_UTIL_H
00016 
00017 #include "vsl_api.h"
00018 #include <stdarg.h>
00019 #include <stdbool.h>
00020 
00021 //! Random device
00022 #define RANDDEV  "/dev/urandom"
00023 
00024 
00025 /* Prototypes */
00026 int gen_key        (unsigned char* key);
00027 void init_keys_c   (vsl_sock* sock, const unsigned char* key);
00028 void init_keys_s   (vsl_sock* sock, const unsigned char* key);
00029 void sha256        (const unsigned char* s1, int l1,
00030                     const unsigned char* s2, int l2, unsigned char *hash);
00031 void md5           (const unsigned char* s1, int l1,
00032                     const unsigned char* s2, int l2, unsigned char *hash);
00033 bool is_blocking   (vsl_sock* socket);
00034 void set_blocking  (vsl_sock* socket, bool mode);
00035 unsigned char* write_objs   (size_t* total, ...);
00036 unsigned char* read_objs    (unsigned char* src, size_t max, ...);
00037 inline uint64_t ntohll    (uint64_t val);
00038 inline uint64_t htonll    (uint64_t val);
00039 void aes_ctr (unsigned char* ctr,
00040               const unsigned char* key,
00041               unsigned char* buf,
00042               const size_t len);
00043 
00044 inline void ctr_inc (unsigned char* ctr);
00045 inline void xor16 (unsigned char* b1, unsigned char* b2);
00046 
00047 typedef ssize_t (*transmit_fn)(vfer_fd, void*, size_t);
00048 int transfer ( vsl_sock *sock, transmit_fn fn,
00049                unsigned char* buf, size_t min, size_t len);
00050 
00051 
00052 
00053 
00054 
00055 #endif
00056 
00057 /*
00058  * Local Variables:
00059  * compile-command: "cd ..; make tests file_xfer"
00060  * compilation-search-path: ("..")
00061  * End:
00062  */

Generated on Tue Aug 8 16:07:20 2006 for VFER by  doxygen 1.4.7