int validate (const char *dst, const void *src, int srclen) { int n; char buf[9]; if (encode_block (buf, &n, src, srclen) < 0) return (-1); if (n != strlen (dst)) return (-1); if (strncmp (dst, buf, n)) return (-1); if (decode_block (buf, &n, dst, strlen (dst)) < 0) return (-1); if (n != srclen) return (-1); if (strncmp (src, buf, n)) return (-1); if (encode_context (buf, &n, src, srclen) < 0) return (-1); if (n != strlen (dst)) return (-1); if (strncmp (dst, buf, n)) return (-1); if (decode_context (buf, &n, dst, strlen (dst)) < 0) return (-1); if (n != srclen) return (-1); if (strncmp (src, buf, n)) return (-1); return (0); }
int validate (const unsigned char *src, const unsigned char *dst) { int n; unsigned char buf[9]; if (encode_block (buf, &n, src, strlen (src)) < 0) return (-1); if (n != strlen (dst)) return (-1); if (strncmp (dst, buf, n)) return (-1); if (decode_block (buf, &n, dst, strlen (dst)) < 0) return (-1); if (n != strlen (src)) return (-1); if (strncmp (src, buf, n)) return (-1); if (encode_context (buf, &n, src, strlen (src)) < 0) return (-1); if (n != strlen (dst)) return (-1); if (strncmp (dst, buf, n)) return (-1); if (decode_context (buf, &n, dst, strlen (dst)) < 0) return (-1); if (n != strlen (src)) return (-1); if (strncmp (src, buf, n)) return (-1); return (0); }