diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-02-03 12:28:13 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-27 22:24:00 +0100 |
commit | b51296c06433d4923e4dcfd2bc104ae3ab67fb43 (patch) | |
tree | b97cbca6a01d898bce4c93a0cee31687c04fef7a /src/3rdparty/rfc6234/sha-private.h | |
parent | bc6ad75d18a029da363afc4f6007aefc7962a8ad (diff) |
This adds Sha224, Sha256, Sha384, and Sha512 enum values to
QCryptographicHash::Algorithm. The implementation comes from RFC 6234,
http://tools.ietf.org/html/rfc6234, which is added to
src/3rdparty/rfc6234. Only the headers and SHA-2 code is included in
src/3rdparty/rfc6234 (the SHA1, HMAC, and HKDF code is not included).
Change-Id: I85139fd118291f15efc22899a5ddd1cc83810cfb
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/3rdparty/rfc6234/sha-private.h')
-rw-r--r-- | src/3rdparty/rfc6234/sha-private.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/3rdparty/rfc6234/sha-private.h b/src/3rdparty/rfc6234/sha-private.h new file mode 100644 index 0000000000..6e9c4520fb --- /dev/null +++ b/src/3rdparty/rfc6234/sha-private.h @@ -0,0 +1,28 @@ +/************************ sha-private.h ************************/ +/***************** See RFC 6234 for details. *******************/ +#ifndef _SHA_PRIVATE__H +#define _SHA_PRIVATE__H +/* + * These definitions are defined in FIPS 180-3, section 4.1. + * Ch() and Maj() are defined identically in sections 4.1.1, + * 4.1.2, and 4.1.3. + * + * The definitions used in FIPS 180-3 are as follows: + */ + +#ifndef USE_MODIFIED_MACROS +#define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#else /* USE_MODIFIED_MACROS */ +/* + * The following definitions are equivalent and potentially faster. + */ + +#define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z)) +#define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) + +#endif /* USE_MODIFIED_MACROS */ + +#define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z)) + +#endif /* _SHA_PRIVATE__H */ |