summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorJohn Kohl <jtkohl@mit.edu>1990-04-17 16:57:17 +0000
committerJohn Kohl <jtkohl@mit.edu>1990-04-17 16:57:17 +0000
commita5fe7c12e0b83d732e25fadabebfbde3e004d5be (patch)
tree861a8803cf7ac6f3e4817815004d1247be3be84c /src/include
parent319590b1f373052281ab42c3dc1af0738ce97b2b (diff)
downloadkrb5-a5fe7c12e0b83d732e25fadabebfbde3e004d5be.tar.gz
krb5-a5fe7c12e0b83d732e25fadabebfbde3e004d5be.tar.xz
krb5-a5fe7c12e0b83d732e25fadabebfbde3e004d5be.zip
add ASN.1 application data smarts for checking packet types
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@480 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
-rw-r--r--src/include/krb5/asn.1/encode.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/krb5/asn.1/encode.h b/src/include/krb5/asn.1/encode.h
index ebd2f1ba0..0b2602e86 100644
--- a/src/include/krb5/asn.1/encode.h
+++ b/src/include/krb5/asn.1/encode.h
@@ -211,5 +211,28 @@ krb5_error_code decode_generic
(translator_func) KRB5_KRB__ERROR2krb5_error, \
(free_func) free_KRB5_KRB__ERROR)
+/* ASN.1 encoding knowledge; KEEP IN SYNC WITH ASN.1 defs! */
+/* here we use some knowledge of ASN.1 encodings */
+/*
+ AS_REQ is APPLICATION 0.
+ KDC_REP is APPLICATION 1.
+ KRB_ERROR is APPLICATION 2.
+ AP_REQ is APPLICATION 3.
+ AP_REP is APPLICATION 4.
+ TGS_REQ is APPLICATION 5.
+ KRB_SAFE is APPLICATION 6.
+ KRB_PRIV is APPLICATION 7.
+ */
+/* allow either constructed or primitive encoding, so check for bit 6
+ set or reset */
+#define krb5_is_as_req(data) ((data)[0] == 0x60 || (data)[0] == 0x20)
+#define krb5_is_kdc_rep(data) ((data)[0] == 0x61 || (data)[0] == 0x21)
+#define krb5_is_krb_error(data) ((data)[0] == 0x62 || (data)[0] == 0x22)
+#define krb5_is_ap_req(data) ((data)[0] == 0x63 || (data)[0] == 0x23)
+#define krb5_is_ap_rep(data) ((data)[0] == 0x64 || (data)[0] == 0x24)
+#define krb5_is_tgs_req(data) ((data)[0] == 0x65 || (data)[0] == 0x25)
+#define krb5_is_krb_safe(data) ((data)[0] == 0x66 || (data)[0] == 0x26)
+#define krb5_is_krb_priv(data) ((data)[0] == 0x67 || (data)[0] == 0x27)
+
#endif /* KRB5_ENCODE_DEFS__ */