summaryrefslogtreecommitdiffstats
path: root/kbx/keybox-defs.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-12-14 21:48:07 +0100
committerWerner Koch <wk@gnupg.org>2001-12-14 21:48:07 +0100
commit134d401a4ea111b423660b81c062c49d1d6bd449 (patch)
treebea2388bc7226317ff7443cfc90a63d99485ba4c /kbx/keybox-defs.h
parent* verify.c (gpgsm_verify): Add hash debug helpers (diff)
downloadgnupg2-134d401a4ea111b423660b81c062c49d1d6bd449.tar.xz
gnupg2-134d401a4ea111b423660b81c062c49d1d6bd449.zip
* keybox-blob.c (x509_email_kludge): New.
(_keybox_create_x509_blob): Insert an extra email address if the subject's DN has an email part. * keybox-defs.h: Added the xtoi_2 and digitp macros.
Diffstat (limited to 'kbx/keybox-defs.h')
-rw-r--r--kbx/keybox-defs.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/kbx/keybox-defs.h b/kbx/keybox-defs.h
index 308c1fff3..8b5b91b54 100644
--- a/kbx/keybox-defs.h
+++ b/kbx/keybox-defs.h
@@ -156,6 +156,20 @@ void _keybox_free (void *p);
} while (0)
+/* some macros to replace ctype ones and avoid locale problems */
+#define digitp(p) (*(p) >= '0' && *(p) <= '9')
+#define hexdigitp(a) (digitp (a) \
+ || (*(a) >= 'A' && *(a) <= 'F') \
+ || (*(a) >= 'a' && *(a) <= 'f'))
+/* the atoi macros assume that the buffer has only valid digits */
+#define atoi_1(p) (*(p) - '0' )
+#define atoi_2(p) ((atoi_1(p) * 10) + atoi_1((p)+1))
+#define atoi_4(p) ((atoi_2(p) * 100) + atoi_2((p)+2))
+#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
+ *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
+#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
+
+
#endif /*KEYBOX_DEFS_H*/