mirror of
https://git.freebsd.org/ports.git
synced 2025-06-14 09:10:32 -04:00
- Remove use of EVP in favor of the low-level API - Add generic check_pkcs_pad() function in jumbo.c Obtained from: https://github.com/magnumripper/JohnTheRipper/commit/f837171 https://github.com/magnumripper/JohnTheRipper/commit/04d2b35
26 lines
545 B
C
26 lines
545 B
C
--- jumbo.c.orig 2014-12-18 07:59:02 UTC
|
|
+++ jumbo.c
|
|
@@ -334,3 +334,23 @@ int setenv(const char *name, const char *val, int over
|
|
return 0;
|
|
}
|
|
#endif
|
|
+
|
|
+int check_pkcs_pad(const unsigned char* data, size_t len, int blocksize)
|
|
+{
|
|
+ int pad_len = data[len - 1];
|
|
+ int padding = pad_len;
|
|
+ int real_len = len - pad_len;
|
|
+ const unsigned char *p = data + real_len;
|
|
+
|
|
+ if (pad_len > blocksize || pad_len < 1)
|
|
+ return -1;
|
|
+
|
|
+ if (len < blocksize)
|
|
+ return -1;
|
|
+
|
|
+ while (pad_len--)
|
|
+ if (*p++ != padding)
|
|
+ return -1;
|
|
+
|
|
+ return real_len;
|
|
+}
|