"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.6.2/libcanlock/include/sha-private.h" (23 Aug 2021, 1156 Bytes) of package /linux/misc/tin-2.6.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 and the last Fossies "Diffs" side-by-side code changes report: 2.4.5_vs_2.6.0.

    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 #pragma GCC visibility push(internal)
   11 
   12 /*
   13  * These definitions are defined in FIPS 180-3, section 4.1.
   14  * Ch() and Maj() are defined identically in sections 4.1.1,
   15  * 4.1.2, and 4.1.3.
   16  *
   17  * The definitions used in FIPS 180-3 are as follows:
   18  */
   19 
   20 #ifndef USE_MODIFIED_MACROS
   21 #define SHA_Ch(x,y,z)        (((x) & (y)) ^ ((~(x)) & (z)))
   22 #define SHA_Maj(x,y,z)       (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
   23 #else /* USE_MODIFIED_MACROS */
   24 /*
   25  * The following definitions are equivalent and potentially faster.
   26  */
   27 
   28 #define SHA_Ch(x, y, z)      (((x) & ((y) ^ (z))) ^ (z))
   29 #define SHA_Maj(x, y, z)     (((x) & ((y) | (z))) | ((y) & (z)))
   30 
   31 #endif /* USE_MODIFIED_MACROS */
   32 
   33 #define SHA_Parity(x, y, z)  ((x) ^ (y) ^ (z))
   34 
   35 #pragma GCC visibility pop
   36 
   37 #endif /* _SHA_PRIVATE__H */