]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
system-keys-win: use macros for the URL
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 23 Nov 2014 07:47:41 +0000 (08:47 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 23 Nov 2014 07:47:41 +0000 (08:47 +0100)
lib/system-keys-win.c

index 5133b3a21c65ad449962aa78f0cf7a7ec74d83f6..0a136329cfe7dac067aa3694caf7fbaf509c53c1 100644 (file)
@@ -116,6 +116,9 @@ static NCryptSignHashFunc pNCryptSignHash;
 static unsigned ncrypt_init = 0;
 static HMODULE ncrypt_lib;
 
+#define WIN_URL "system:win:"
+#define WIN_URL_SIZE 11
+
 static int
 get_id(const char *url, uint8_t *bin, size_t *bin_size, unsigned cert)
 {
@@ -124,14 +127,14 @@ get_id(const char *url, uint8_t *bin, size_t *bin_size, unsigned cert)
        const char *p = url, *p2;
 
        if (cert != 0) {
-               if (url_size < sizeof("system:win:") || strncmp(url, "system:win:", 11) != 0)
+               if (url_size < sizeof(WIN_URL) || strncmp(url, WIN_URL, WIN_URL_SIZE) != 0)
                        return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
        } else {
-               if (url_size < sizeof("system:win:") || strncmp(url, "system:win:", 11) != 0)
+               if (url_size < sizeof(WIN_URL) || strncmp(url, WIN_URL, WIN_URL_SIZE) != 0)
                        return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
        }
 
-       p += sizeof("system:win:") - 1;
+       p += sizeof(WIN_URL) - 1;
 
        p = strstr(p, "id=");
        if (p == NULL)