"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.2/libcanlock/include/sha-private.h" (26 Apr 2017, 1088 Bytes) of package /linux/misc/tin-2.4.2.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sha-private.h" see the Fossies "Dox" file reference documentation.

    1 /************************ sha-private.h ************************/
    2 /***************** See RFC 6234 for details. *******************/
    3 /* Copyright (c) 2011 IETF Trust and the persons identified as */
    4 /* authors of the code.  All rights reserved.                  */
    5 /* See sha.h for terms of use and redistribution.              */
    6 
    7 #ifndef _SHA_PRIVATE__H
    8 #define _SHA_PRIVATE__H
    9 /*
   10  * These definitions are defined in FIPS 180-3, section 4.1.
   11  * Ch() and Maj() are defined identically in sections 4.1.1,
   12  * 4.1.2, and 4.1.3.
   13  *
   14  * The definitions used in FIPS 180-3 are as follows:
   15  */
   16 
   17 #ifndef USE_MODIFIED_MACROS
   18 #define SHA_Ch(x,y,z)        (((x) & (y)) ^ ((~(x)) & (z)))
   19 #define SHA_Maj(x,y,z)       (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
   20 #else /* USE_MODIFIED_MACROS */
   21 /*
   22  * The following definitions are equivalent and potentially faster.
   23  */
   24 
   25 #define SHA_Ch(x, y, z)      (((x) & ((y) ^ (z))) ^ (z))
   26 #define SHA_Maj(x, y, z)     (((x) & ((y) | (z))) | ((y) & (z)))
   27 
   28 #endif /* USE_MODIFIED_MACROS */
   29 
   30 #define SHA_Parity(x, y, z)  ((x) ^ (y) ^ (z))
   31 
   32 #endif /* _SHA_PRIVATE__H */