wolfSSL SSL/TLS library, support up to TLS1.3
Dependents: CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more
wolfssl/wolfcrypt/misc.h@15:117db924cf7c, 2018-08-18 (annotated)
- Committer:
- wolfSSL
- Date:
- Sat Aug 18 22:20:43 2018 +0000
- Revision:
- 15:117db924cf7c
- Child:
- 16:8e0d178b1d1e
wolfSSL 3.15.3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 15:117db924cf7c | 1 | /* misc.h |
wolfSSL | 15:117db924cf7c | 2 | * |
wolfSSL | 15:117db924cf7c | 3 | * Copyright (C) 2006-2017 wolfSSL Inc. |
wolfSSL | 15:117db924cf7c | 4 | * |
wolfSSL | 15:117db924cf7c | 5 | * This file is part of wolfSSL. |
wolfSSL | 15:117db924cf7c | 6 | * |
wolfSSL | 15:117db924cf7c | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
wolfSSL | 15:117db924cf7c | 8 | * it under the terms of the GNU General Public License as published by |
wolfSSL | 15:117db924cf7c | 9 | * the Free Software Foundation; either version 2 of the License, or |
wolfSSL | 15:117db924cf7c | 10 | * (at your option) any later version. |
wolfSSL | 15:117db924cf7c | 11 | * |
wolfSSL | 15:117db924cf7c | 12 | * wolfSSL is distributed in the hope that it will be useful, |
wolfSSL | 15:117db924cf7c | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wolfSSL | 15:117db924cf7c | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wolfSSL | 15:117db924cf7c | 15 | * GNU General Public License for more details. |
wolfSSL | 15:117db924cf7c | 16 | * |
wolfSSL | 15:117db924cf7c | 17 | * You should have received a copy of the GNU General Public License |
wolfSSL | 15:117db924cf7c | 18 | * along with this program; if not, write to the Free Software |
wolfSSL | 15:117db924cf7c | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
wolfSSL | 15:117db924cf7c | 20 | */ |
wolfSSL | 15:117db924cf7c | 21 | |
wolfSSL | 15:117db924cf7c | 22 | |
wolfSSL | 15:117db924cf7c | 23 | |
wolfSSL | 15:117db924cf7c | 24 | #ifndef WOLF_CRYPT_MISC_H |
wolfSSL | 15:117db924cf7c | 25 | #define WOLF_CRYPT_MISC_H |
wolfSSL | 15:117db924cf7c | 26 | |
wolfSSL | 15:117db924cf7c | 27 | |
wolfSSL | 15:117db924cf7c | 28 | #include <wolfssl/wolfcrypt/types.h> |
wolfSSL | 15:117db924cf7c | 29 | |
wolfSSL | 15:117db924cf7c | 30 | |
wolfSSL | 15:117db924cf7c | 31 | #ifdef __cplusplus |
wolfSSL | 15:117db924cf7c | 32 | extern "C" { |
wolfSSL | 15:117db924cf7c | 33 | #endif |
wolfSSL | 15:117db924cf7c | 34 | |
wolfSSL | 15:117db924cf7c | 35 | |
wolfSSL | 15:117db924cf7c | 36 | #ifdef NO_INLINE |
wolfSSL | 15:117db924cf7c | 37 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 38 | word32 rotlFixed(word32, word32); |
wolfSSL | 15:117db924cf7c | 39 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 40 | word32 rotrFixed(word32, word32); |
wolfSSL | 15:117db924cf7c | 41 | |
wolfSSL | 15:117db924cf7c | 42 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 43 | word32 ByteReverseWord32(word32); |
wolfSSL | 15:117db924cf7c | 44 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 45 | void ByteReverseWords(word32*, const word32*, word32); |
wolfSSL | 15:117db924cf7c | 46 | |
wolfSSL | 15:117db924cf7c | 47 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 48 | void XorWords(wolfssl_word*, const wolfssl_word*, word32); |
wolfSSL | 15:117db924cf7c | 49 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 50 | void xorbuf(void*, const void*, word32); |
wolfSSL | 15:117db924cf7c | 51 | |
wolfSSL | 15:117db924cf7c | 52 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 53 | void ForceZero(const void*, word32); |
wolfSSL | 15:117db924cf7c | 54 | |
wolfSSL | 15:117db924cf7c | 55 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 56 | int ConstantCompare(const byte*, const byte*, int); |
wolfSSL | 15:117db924cf7c | 57 | |
wolfSSL | 15:117db924cf7c | 58 | #ifdef WORD64_AVAILABLE |
wolfSSL | 15:117db924cf7c | 59 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 60 | word64 rotlFixed64(word64, word64); |
wolfSSL | 15:117db924cf7c | 61 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 62 | word64 rotrFixed64(word64, word64); |
wolfSSL | 15:117db924cf7c | 63 | |
wolfSSL | 15:117db924cf7c | 64 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 65 | word64 ByteReverseWord64(word64); |
wolfSSL | 15:117db924cf7c | 66 | WOLFSSL_LOCAL |
wolfSSL | 15:117db924cf7c | 67 | void ByteReverseWords64(word64*, const word64*, word32); |
wolfSSL | 15:117db924cf7c | 68 | #endif /* WORD64_AVAILABLE */ |
wolfSSL | 15:117db924cf7c | 69 | |
wolfSSL | 15:117db924cf7c | 70 | #ifndef WOLFSSL_HAVE_MIN |
wolfSSL | 15:117db924cf7c | 71 | #if defined(HAVE_FIPS) && !defined(min) /* so ifdef check passes */ |
wolfSSL | 15:117db924cf7c | 72 | #define min min |
wolfSSL | 15:117db924cf7c | 73 | #endif |
wolfSSL | 15:117db924cf7c | 74 | WOLFSSL_LOCAL word32 min(word32 a, word32 b); |
wolfSSL | 15:117db924cf7c | 75 | #endif |
wolfSSL | 15:117db924cf7c | 76 | |
wolfSSL | 15:117db924cf7c | 77 | #ifndef WOLFSSL_HAVE_MAX |
wolfSSL | 15:117db924cf7c | 78 | #if defined(HAVE_FIPS) && !defined(max) /* so ifdef check passes */ |
wolfSSL | 15:117db924cf7c | 79 | #define max max |
wolfSSL | 15:117db924cf7c | 80 | #endif |
wolfSSL | 15:117db924cf7c | 81 | WOLFSSL_LOCAL word32 max(word32 a, word32 b); |
wolfSSL | 15:117db924cf7c | 82 | #endif /* WOLFSSL_HAVE_MAX */ |
wolfSSL | 15:117db924cf7c | 83 | |
wolfSSL | 15:117db924cf7c | 84 | |
wolfSSL | 15:117db924cf7c | 85 | void c32to24(word32 in, word24 out); |
wolfSSL | 15:117db924cf7c | 86 | void c16toa(word16 u16, byte* c); |
wolfSSL | 15:117db924cf7c | 87 | void c32toa(word32 u32, byte* c); |
wolfSSL | 15:117db924cf7c | 88 | void c24to32(const word24 u24, word32* u32); |
wolfSSL | 15:117db924cf7c | 89 | void ato16(const byte* c, word16* u16); |
wolfSSL | 15:117db924cf7c | 90 | void ato24(const byte* c, word32* u24); |
wolfSSL | 15:117db924cf7c | 91 | void ato32(const byte* c, word32* u32); |
wolfSSL | 15:117db924cf7c | 92 | word32 btoi(byte b); |
wolfSSL | 15:117db924cf7c | 93 | |
wolfSSL | 15:117db924cf7c | 94 | |
wolfSSL | 15:117db924cf7c | 95 | WOLFSSL_LOCAL byte ctMaskGT(int a, int b); |
wolfSSL | 15:117db924cf7c | 96 | WOLFSSL_LOCAL byte ctMaskGTE(int a, int b); |
wolfSSL | 15:117db924cf7c | 97 | WOLFSSL_LOCAL byte ctMaskLT(int a, int b); |
wolfSSL | 15:117db924cf7c | 98 | WOLFSSL_LOCAL byte ctMaskLTE(int a, int b); |
wolfSSL | 15:117db924cf7c | 99 | WOLFSSL_LOCAL byte ctMaskEq(int a, int b); |
wolfSSL | 15:117db924cf7c | 100 | WOLFSSL_LOCAL byte ctMaskSel(byte m, byte a, byte b); |
wolfSSL | 15:117db924cf7c | 101 | WOLFSSL_LOCAL byte ctSetLTE(int a, int b); |
wolfSSL | 15:117db924cf7c | 102 | |
wolfSSL | 15:117db924cf7c | 103 | #endif /* NO_INLINE */ |
wolfSSL | 15:117db924cf7c | 104 | |
wolfSSL | 15:117db924cf7c | 105 | |
wolfSSL | 15:117db924cf7c | 106 | #ifdef __cplusplus |
wolfSSL | 15:117db924cf7c | 107 | } /* extern "C" */ |
wolfSSL | 15:117db924cf7c | 108 | #endif |
wolfSSL | 15:117db924cf7c | 109 | |
wolfSSL | 15:117db924cf7c | 110 | |
wolfSSL | 15:117db924cf7c | 111 | #endif /* WOLF_CRYPT_MISC_H */ |
wolfSSL | 15:117db924cf7c | 112 | |
wolfSSL | 15:117db924cf7c | 113 |