| 1 |
|
| #ifndef CJWS_UTIL_H |
| 2 |
|
| #define CJWS_UTIL_H |
| 3 |
|
| |
| 4 |
|
| #include <openssl/crypto.h> |
| 5 |
|
| |
| 6 |
|
| /* Constant-time equality. Length inequality returns 0 immediately - the |
| 7 |
|
| * lengths of the values compared here (digests, signatures) are public. */ |
| 8 |
13 |
| static int cjws_ct_eq(const unsigned char *a, STRLEN alen, |
| 9 |
|
| const unsigned char *b, STRLEN blen) { |
| 10 |
13 |
▶ | if (alen != blen) return 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (alen != blen) return 0; |
1 |
12 |
13 |
|
| 11 |
12 |
| return CRYPTO_memcmp(a, b, alen) == 0; |
| 12 |
|
| } |
| 13 |
|
| |
| 14 |
|
| #endif |