Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
alg.h
Go to the documentation of this file.
1 /*===-- internal/alg.h -------------------------------*- INTERNAL -*- H -*-===*/
12 /*===----------------------------------------------------------------------===*/
13 
14 #ifndef ORDO_ALG_H
15 #define ORDO_ALG_H
16 
18 #include "ordo/common/interface.h"
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /*===----------------------------------------------------------------------===*/
26 
27 #if !(defined(ORDO_INTERNAL_ACCESS) && defined(ORDO_STATIC_LIB))
28  #if !(defined(BUILDING_ORDO) || defined(BUILDING_ordo))
29  #error "This header is internal to the Ordo library."
30  #endif
31 #endif
32 
33 ORDO_HIDDEN void pswap8 (uint8_t *a, uint8_t *b);
34 ORDO_HIDDEN void pswap16(uint16_t *a, uint16_t *b);
35 ORDO_HIDDEN void pswap32(uint32_t *a, uint32_t *b);
36 ORDO_HIDDEN void pswap64(uint64_t *a, uint64_t *b);
37 
38 ORDO_HIDDEN size_t smin(size_t a, size_t b);
39 ORDO_HIDDEN size_t smax(size_t a, size_t b);
40 
41 ORDO_HIDDEN uint16_t rol16(uint16_t x, int n);
42 ORDO_HIDDEN uint16_t ror16(uint16_t x, int n);
43 
44 ORDO_HIDDEN uint32_t rol32(uint32_t x, int n);
45 ORDO_HIDDEN uint32_t ror32(uint32_t x, int n);
46 
47 ORDO_HIDDEN uint64_t rol64(uint64_t x, int n);
48 ORDO_HIDDEN uint64_t ror64(uint64_t x, int n);
49 
54 #define bits(n) (n / 8)
55 
60 #define bytes(n) (n * 8)
61 
72 #define offset(ptr, len) ((unsigned char *)ptr + len)
73 
91 ORDO_HIDDEN
92 size_t pad_check(const void *buffer, size_t len);
93 
104 ORDO_HIDDEN
105 void xor_buffer(void * RESTRICT dst, const void * RESTRICT src, size_t len);
106 
115 ORDO_HIDDEN
116 void inc_buffer(unsigned char *buffer, size_t len);
117 
118 /*===----------------------------------------------------------------------===*/
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif
ORDO_HIDDEN void xor_buffer(void *RESTRICT dst, const void *RESTRICT src, size_t len)
Definition: alg.c:95
ORDO_HIDDEN void inc_buffer(unsigned char *buffer, size_t len)
Definition: alg.c:102
ORDO_HIDDEN size_t pad_check(const void *buffer, size_t len)
Definition: alg.c:70