Skip to content
Browse files

switched to Nick Paulson recpiet verification

  • Loading branch information...
1 parent a7f1a4f commit f3ae90e3899515dd3a34e81b8d3d802997792423 @jessegrosjean jessegrosjean committed Mar 25, 2011
Showing with 8,473 additions and 11,737 deletions.
  1. +1 −0 QuickCursor-Info.plist
  2. +7 −180 QuickCursor.xcodeproj/project.pbxproj
  3. +7 −0 QuickCursor.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  4. +7,697 −0 ...kCursor.xcodeproj/project.xcworkspace/xcuserdata/jesse.xcuserdatad/UserInterfaceState.xcuserstate
  5. +10 −0 QuickCursor.xcodeproj/project.xcworkspace/xcuserdata/jesse.xcuserdatad/WorkspaceSettings.xcsettings
  6. +63 −0 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  7. +76 −0 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/QuickCursor MAS.xcscheme
  8. +76 −0 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/QuickCursor.xcscheme
  9. +27 −0 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/xcschememanagement.plist
  10. +33 −0 ReceiptVerification.h
  11. +476 −0 ReceiptVerification.m
  12. +0 −189 asn1/BIT_STRING.c
  13. +0 −33 asn1/BIT_STRING.h
  14. +0 −934 asn1/INTEGER.c
  15. +0 −69 asn1/INTEGER.h
  16. +0 −88 asn1/Makefile.am.sample
  17. +0 −207 asn1/NativeEnumerated.c
  18. +0 −32 asn1/NativeEnumerated.h
  19. +0 −332 asn1/NativeInteger.c
  20. +0 −37 asn1/NativeInteger.h
  21. +0 −1,805 asn1/OCTET_STRING.c
  22. +0 −86 asn1/OCTET_STRING.h
  23. +0 −54 asn1/Payload.c
  24. +0 −43 asn1/Payload.h
  25. +0 −81 asn1/ReceiptAttribute.c
  26. +0 −40 asn1/ReceiptAttribute.h
  27. +0 −88 asn1/asn_SET_OF.c
  28. +0 −62 asn1/asn_SET_OF.h
  29. +0 −47 asn1/asn_application.h
  30. +0 −109 asn1/asn_codecs.h
  31. +0 −295 asn1/asn_codecs_prim.c
  32. +0 −53 asn1/asn_codecs_prim.h
  33. +0 −119 asn1/asn_internal.h
  34. +0 −129 asn1/asn_system.h
  35. +0 −283 asn1/ber_decoder.c
  36. +0 −64 asn1/ber_decoder.h
  37. +0 −178 asn1/ber_tlv_length.c
  38. +0 −50 asn1/ber_tlv_length.h
  39. +0 −144 asn1/ber_tlv_tag.c
  40. +0 −60 asn1/ber_tlv_tag.h
  41. +0 −1,423 asn1/constr_SEQUENCE.c
  42. +0 −60 asn1/constr_SEQUENCE.h
  43. +0 −953 asn1/constr_SET_OF.c
  44. +0 −42 asn1/constr_SET_OF.h
  45. +0 −77 asn1/constr_TYPE.c
  46. +0 −180 asn1/constr_TYPE.h
  47. +0 −93 asn1/constraints.c
  48. +0 −63 asn1/constraints.h
  49. +0 −199 asn1/der_encoder.c
  50. +0 −68 asn1/der_encoder.h
  51. +0 −12 asn1/module.asn1
  52. +0 −93 asn1/per_decoder.c
  53. +0 −56 asn1/per_decoder.h
  54. +0 −151 asn1/per_encoder.c
  55. +0 −69 asn1/per_encoder.h
  56. +0 −373 asn1/per_opentype.c
  57. +0 −22 asn1/per_opentype.h
  58. +0 −425 asn1/per_support.c
  59. +0 −128 asn1/per_support.h
  60. +0 −363 asn1/xer_decoder.c
  61. +0 −106 asn1/xer_decoder.h
  62. +0 −67 asn1/xer_encoder.c
  63. +0 −59 asn1/xer_encoder.h
  64. +0 −233 asn1/xer_support.c
  65. +0 −55 asn1/xer_support.h
  66. +0 −86 ethernet.c
  67. +0 −46 ethernet.h
  68. +0 −344 main.m
View
1 QuickCursor-Info.plist
@@ -36,6 +36,7 @@
<array>
<string>org.gnu.Aquamacs</string>
<string>com.barebones.bbedit</string>
+ <string>com.metaclassy.byword</string>
<string>com.macrabbit.espresso</string>
<string>org.fraise.Fraise</string>
<string>org.vim.MacVim</string>
View
187 QuickCursor.xcodeproj/project.pbxproj
@@ -27,37 +27,11 @@
882CFA52131BF12D009C75A6 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 882CFA51131BF12D009C75A6 /* libssl.dylib */; };
882CFA5A131BF14D009C75A6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 882CFA59131BF14D009C75A6 /* Security.framework */; };
882CFA64131BF22E009C75A6 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 882CFA63131BF22E009C75A6 /* IOKit.framework */; };
- 882CFB8F131BFF8E009C75A6 /* ethernet.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B77812F9A37300696670 /* ethernet.c */; };
- 882CFB92131BFF9E009C75A6 /* ber_tlv_length.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73012F9A35B00696670 /* ber_tlv_length.c */; };
- 882CFB93131BFF9E009C75A6 /* ReceiptAttribute.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75512F9A35B00696670 /* ReceiptAttribute.c */; };
- 882CFB94131BFF9F009C75A6 /* module.asn1 in Resources */ = {isa = PBXBuildFile; fileRef = 8858B74412F9A35B00696670 /* module.asn1 */; };
- 882CFB95131BFF9F009C75A6 /* constraints.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73C12F9A35B00696670 /* constraints.c */; };
- 882CFB96131BFFA0009C75A6 /* xer_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75712F9A35B00696670 /* xer_decoder.c */; };
- 882CFB97131BFFA1009C75A6 /* NativeInteger.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74712F9A35B00696670 /* NativeInteger.c */; };
- 882CFB98131BFFA3009C75A6 /* constr_SEQUENCE.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73612F9A35B00696670 /* constr_SEQUENCE.c */; };
- 882CFB99131BFFA4009C75A6 /* asn_codecs_prim.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B72812F9A35B00696670 /* asn_codecs_prim.c */; };
- 882CFB9A131BFFA4009C75A6 /* xer_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75B12F9A35B00696670 /* xer_support.c */; };
- 882CFB9B131BFFA5009C75A6 /* xer_encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75912F9A35B00696670 /* xer_encoder.c */; };
- 882CFB9C131BFFA6009C75A6 /* der_encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73F12F9A35B00696670 /* der_encoder.c */; };
- 882CFB9D131BFFA7009C75A6 /* constr_TYPE.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73A12F9A35B00696670 /* constr_TYPE.c */; };
- 882CFB9E131BFFA7009C75A6 /* per_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74D12F9A35B00696670 /* per_decoder.c */; };
- 882CFB9F131BFFA8009C75A6 /* ber_tlv_tag.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73212F9A35B00696670 /* ber_tlv_tag.c */; };
- 882CFBA0131BFFA9009C75A6 /* per_opentype.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75112F9A35B00696670 /* per_opentype.c */; };
- 882CFBA1131BFFA9009C75A6 /* per_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B75312F9A35B00696670 /* per_support.c */; };
- 882CFBA2131BFFAA009C75A6 /* per_encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74F12F9A35B00696670 /* per_encoder.c */; };
- 882CFBA3131BFFAA009C75A6 /* ber_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B72E12F9A35B00696670 /* ber_decoder.c */; };
- 882CFBA4131BFFAA009C75A6 /* Payload.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74B12F9A35B00696670 /* Payload.c */; };
- 882CFBA5131BFFAC009C75A6 /* constr_SET_OF.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73812F9A35B00696670 /* constr_SET_OF.c */; };
- 882CFBA6131BFFAD009C75A6 /* OCTET_STRING.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74912F9A35B00696670 /* OCTET_STRING.c */; };
- 882CFBA7131BFFAE009C75A6 /* asn_SET_OF.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B72B12F9A35B00696670 /* asn_SET_OF.c */; };
- 882CFBA8131BFFAE009C75A6 /* INTEGER.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74112F9A35B00696670 /* INTEGER.c */; };
- 882CFBA9131BFFAF009C75A6 /* BIT_STRING.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B73412F9A35B00696670 /* BIT_STRING.c */; };
- 882CFBAA131BFFAF009C75A6 /* Makefile.am.sample in Resources */ = {isa = PBXBuildFile; fileRef = 8858B74312F9A35B00696670 /* Makefile.am.sample */; };
- 882CFBAB131BFFB0009C75A6 /* NativeEnumerated.c in Sources */ = {isa = PBXBuildFile; fileRef = 8858B74512F9A35B00696670 /* NativeEnumerated.c */; };
884E34C4128C7E4100B60730 /* ShortcutRecorder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 884E34C3128C7E4100B60730 /* ShortcutRecorder.framework */; };
884E34CF128C7E4700B60730 /* ShortcutRecorder.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 884E34C3128C7E4100B60730 /* ShortcutRecorder.framework */; };
88564D8A12DF407E00070CD3 /* StatusItemIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 88564D8912DF407E00070CD3 /* StatusItemIcon.png */; };
8858B82912F9AC6600696670 /* receipt in Resources */ = {isa = PBXBuildFile; fileRef = 8858B82812F9AC6600696670 /* receipt */; };
+ 88D3FC48133D0F8B00C2E651 /* ReceiptVerification.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D3FC47133D0F8B00C2E651 /* ReceiptVerification.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@@ -119,63 +93,9 @@
882CFA63131BF22E009C75A6 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
884E34C3128C7E4100B60730 /* ShortcutRecorder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ShortcutRecorder.framework; sourceTree = "<group>"; };
88564D8912DF407E00070CD3 /* StatusItemIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StatusItemIcon.png; sourceTree = "<group>"; };
- 8858B72612F9A35B00696670 /* asn_application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_application.h; sourceTree = "<group>"; };
- 8858B72712F9A35B00696670 /* asn_codecs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_codecs.h; sourceTree = "<group>"; };
- 8858B72812F9A35B00696670 /* asn_codecs_prim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asn_codecs_prim.c; sourceTree = "<group>"; };
- 8858B72912F9A35B00696670 /* asn_codecs_prim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_codecs_prim.h; sourceTree = "<group>"; };
- 8858B72A12F9A35B00696670 /* asn_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_internal.h; sourceTree = "<group>"; };
- 8858B72B12F9A35B00696670 /* asn_SET_OF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asn_SET_OF.c; sourceTree = "<group>"; };
- 8858B72C12F9A35B00696670 /* asn_SET_OF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_SET_OF.h; sourceTree = "<group>"; };
- 8858B72D12F9A35B00696670 /* asn_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn_system.h; sourceTree = "<group>"; };
- 8858B72E12F9A35B00696670 /* ber_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ber_decoder.c; sourceTree = "<group>"; };
- 8858B72F12F9A35B00696670 /* ber_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ber_decoder.h; sourceTree = "<group>"; };
- 8858B73012F9A35B00696670 /* ber_tlv_length.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ber_tlv_length.c; sourceTree = "<group>"; };
- 8858B73112F9A35B00696670 /* ber_tlv_length.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ber_tlv_length.h; sourceTree = "<group>"; };
- 8858B73212F9A35B00696670 /* ber_tlv_tag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ber_tlv_tag.c; sourceTree = "<group>"; };
- 8858B73312F9A35B00696670 /* ber_tlv_tag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ber_tlv_tag.h; sourceTree = "<group>"; };
- 8858B73412F9A35B00696670 /* BIT_STRING.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BIT_STRING.c; sourceTree = "<group>"; };
- 8858B73512F9A35B00696670 /* BIT_STRING.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BIT_STRING.h; sourceTree = "<group>"; };
- 8858B73612F9A35B00696670 /* constr_SEQUENCE.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = constr_SEQUENCE.c; sourceTree = "<group>"; };
- 8858B73712F9A35B00696670 /* constr_SEQUENCE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constr_SEQUENCE.h; sourceTree = "<group>"; };
- 8858B73812F9A35B00696670 /* constr_SET_OF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = constr_SET_OF.c; sourceTree = "<group>"; };
- 8858B73912F9A35B00696670 /* constr_SET_OF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constr_SET_OF.h; sourceTree = "<group>"; };
- 8858B73A12F9A35B00696670 /* constr_TYPE.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = constr_TYPE.c; sourceTree = "<group>"; };
- 8858B73B12F9A35B00696670 /* constr_TYPE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constr_TYPE.h; sourceTree = "<group>"; };
- 8858B73C12F9A35B00696670 /* constraints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = constraints.c; sourceTree = "<group>"; };
- 8858B73D12F9A35B00696670 /* constraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constraints.h; sourceTree = "<group>"; };
- 8858B73F12F9A35B00696670 /* der_encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = der_encoder.c; sourceTree = "<group>"; };
- 8858B74012F9A35B00696670 /* der_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = der_encoder.h; sourceTree = "<group>"; };
- 8858B74112F9A35B00696670 /* INTEGER.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = INTEGER.c; sourceTree = "<group>"; };
- 8858B74212F9A35B00696670 /* INTEGER.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INTEGER.h; sourceTree = "<group>"; };
- 8858B74312F9A35B00696670 /* Makefile.am.sample */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am.sample; sourceTree = "<group>"; };
- 8858B74412F9A35B00696670 /* module.asn1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = module.asn1; sourceTree = "<group>"; };
- 8858B74512F9A35B00696670 /* NativeEnumerated.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NativeEnumerated.c; sourceTree = "<group>"; };
- 8858B74612F9A35B00696670 /* NativeEnumerated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeEnumerated.h; sourceTree = "<group>"; };
- 8858B74712F9A35B00696670 /* NativeInteger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NativeInteger.c; sourceTree = "<group>"; };
- 8858B74812F9A35B00696670 /* NativeInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeInteger.h; sourceTree = "<group>"; };
- 8858B74912F9A35B00696670 /* OCTET_STRING.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OCTET_STRING.c; sourceTree = "<group>"; };
- 8858B74A12F9A35B00696670 /* OCTET_STRING.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCTET_STRING.h; sourceTree = "<group>"; };
- 8858B74B12F9A35B00696670 /* Payload.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Payload.c; sourceTree = "<group>"; };
- 8858B74C12F9A35B00696670 /* Payload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Payload.h; sourceTree = "<group>"; };
- 8858B74D12F9A35B00696670 /* per_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = per_decoder.c; sourceTree = "<group>"; };
- 8858B74E12F9A35B00696670 /* per_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = per_decoder.h; sourceTree = "<group>"; };
- 8858B74F12F9A35B00696670 /* per_encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = per_encoder.c; sourceTree = "<group>"; };
- 8858B75012F9A35B00696670 /* per_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = per_encoder.h; sourceTree = "<group>"; };
- 8858B75112F9A35B00696670 /* per_opentype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = per_opentype.c; sourceTree = "<group>"; };
- 8858B75212F9A35B00696670 /* per_opentype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = per_opentype.h; sourceTree = "<group>"; };
- 8858B75312F9A35B00696670 /* per_support.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = per_support.c; sourceTree = "<group>"; };
- 8858B75412F9A35B00696670 /* per_support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = per_support.h; sourceTree = "<group>"; };
- 8858B75512F9A35B00696670 /* ReceiptAttribute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ReceiptAttribute.c; sourceTree = "<group>"; };
- 8858B75612F9A35B00696670 /* ReceiptAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReceiptAttribute.h; sourceTree = "<group>"; };
- 8858B75712F9A35B00696670 /* xer_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xer_decoder.c; sourceTree = "<group>"; };
- 8858B75812F9A35B00696670 /* xer_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xer_decoder.h; sourceTree = "<group>"; };
- 8858B75912F9A35B00696670 /* xer_encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xer_encoder.c; sourceTree = "<group>"; };
- 8858B75A12F9A35B00696670 /* xer_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xer_encoder.h; sourceTree = "<group>"; };
- 8858B75B12F9A35B00696670 /* xer_support.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xer_support.c; sourceTree = "<group>"; };
- 8858B75C12F9A35B00696670 /* xer_support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xer_support.h; sourceTree = "<group>"; };
- 8858B77812F9A37300696670 /* ethernet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ethernet.c; sourceTree = "<group>"; };
- 8858B77912F9A37300696670 /* ethernet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ethernet.h; sourceTree = "<group>"; };
8858B82812F9AC6600696670 /* receipt */ = {isa = PBXFileReference; lastKnownFileType = file; path = receipt; sourceTree = "<group>"; };
+ 88D3FC46133D0F8B00C2E651 /* ReceiptVerification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReceiptVerification.h; sourceTree = "<group>"; };
+ 88D3FC47133D0F8B00C2E651 /* ReceiptVerification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReceiptVerification.m; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* QuickCursor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuickCursor.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -205,7 +125,6 @@
882A8BAB128C33BC00D05C94 /* QCAppDelegate.m */,
882A8BAC128C33BC00D05C94 /* QCUIElement.h */,
882A8BAD128C33BC00D05C94 /* QCUIElement.m */,
- 8858B72512F9A35B00696670 /* asn1 */,
882A8C26128C368400D05C94 /* ODB Editor */,
882A8C27128C369100D05C94 /* Hot Key */,
);
@@ -261,9 +180,9 @@
isa = PBXGroup;
children = (
882A8BB2128C33F000D05C94 /* README.txt */,
- 8858B77912F9A37300696670 /* ethernet.h */,
- 8858B77812F9A37300696670 /* ethernet.c */,
29B97316FDCFA39411CA2CEA /* main.m */,
+ 88D3FC46133D0F8B00C2E651 /* ReceiptVerification.h */,
+ 88D3FC47133D0F8B00C2E651 /* ReceiptVerification.m */,
256AC3F00F4B6AF500CF3369 /* QuickCursor_Prefix.pch */,
);
name = "Other Sources";
@@ -323,67 +242,6 @@
name = "Hot Key";
sourceTree = "<group>";
};
- 8858B72512F9A35B00696670 /* asn1 */ = {
- isa = PBXGroup;
- children = (
- 8858B72612F9A35B00696670 /* asn_application.h */,
- 8858B72712F9A35B00696670 /* asn_codecs.h */,
- 8858B72812F9A35B00696670 /* asn_codecs_prim.c */,
- 8858B72912F9A35B00696670 /* asn_codecs_prim.h */,
- 8858B72A12F9A35B00696670 /* asn_internal.h */,
- 8858B72B12F9A35B00696670 /* asn_SET_OF.c */,
- 8858B72C12F9A35B00696670 /* asn_SET_OF.h */,
- 8858B72D12F9A35B00696670 /* asn_system.h */,
- 8858B72E12F9A35B00696670 /* ber_decoder.c */,
- 8858B72F12F9A35B00696670 /* ber_decoder.h */,
- 8858B73012F9A35B00696670 /* ber_tlv_length.c */,
- 8858B73112F9A35B00696670 /* ber_tlv_length.h */,
- 8858B73212F9A35B00696670 /* ber_tlv_tag.c */,
- 8858B73312F9A35B00696670 /* ber_tlv_tag.h */,
- 8858B73412F9A35B00696670 /* BIT_STRING.c */,
- 8858B73512F9A35B00696670 /* BIT_STRING.h */,
- 8858B73612F9A35B00696670 /* constr_SEQUENCE.c */,
- 8858B73712F9A35B00696670 /* constr_SEQUENCE.h */,
- 8858B73812F9A35B00696670 /* constr_SET_OF.c */,
- 8858B73912F9A35B00696670 /* constr_SET_OF.h */,
- 8858B73A12F9A35B00696670 /* constr_TYPE.c */,
- 8858B73B12F9A35B00696670 /* constr_TYPE.h */,
- 8858B73C12F9A35B00696670 /* constraints.c */,
- 8858B73D12F9A35B00696670 /* constraints.h */,
- 8858B73F12F9A35B00696670 /* der_encoder.c */,
- 8858B74012F9A35B00696670 /* der_encoder.h */,
- 8858B74112F9A35B00696670 /* INTEGER.c */,
- 8858B74212F9A35B00696670 /* INTEGER.h */,
- 8858B74312F9A35B00696670 /* Makefile.am.sample */,
- 8858B74412F9A35B00696670 /* module.asn1 */,
- 8858B74512F9A35B00696670 /* NativeEnumerated.c */,
- 8858B74612F9A35B00696670 /* NativeEnumerated.h */,
- 8858B74712F9A35B00696670 /* NativeInteger.c */,
- 8858B74812F9A35B00696670 /* NativeInteger.h */,
- 8858B74912F9A35B00696670 /* OCTET_STRING.c */,
- 8858B74A12F9A35B00696670 /* OCTET_STRING.h */,
- 8858B74B12F9A35B00696670 /* Payload.c */,
- 8858B74C12F9A35B00696670 /* Payload.h */,
- 8858B74D12F9A35B00696670 /* per_decoder.c */,
- 8858B74E12F9A35B00696670 /* per_decoder.h */,
- 8858B74F12F9A35B00696670 /* per_encoder.c */,
- 8858B75012F9A35B00696670 /* per_encoder.h */,
- 8858B75112F9A35B00696670 /* per_opentype.c */,
- 8858B75212F9A35B00696670 /* per_opentype.h */,
- 8858B75312F9A35B00696670 /* per_support.c */,
- 8858B75412F9A35B00696670 /* per_support.h */,
- 8858B75512F9A35B00696670 /* ReceiptAttribute.c */,
- 8858B75612F9A35B00696670 /* ReceiptAttribute.h */,
- 8858B75712F9A35B00696670 /* xer_decoder.c */,
- 8858B75812F9A35B00696670 /* xer_decoder.h */,
- 8858B75912F9A35B00696670 /* xer_encoder.c */,
- 8858B75A12F9A35B00696670 /* xer_encoder.h */,
- 8858B75B12F9A35B00696670 /* xer_support.c */,
- 8858B75C12F9A35B00696670 /* xer_support.h */,
- );
- path = asn1;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -444,8 +302,6 @@
882A8DDE128C392800D05C94 /* QuickCursor User's Guide.pdf in Resources */,
88564D8A12DF407E00070CD3 /* StatusItemIcon.png in Resources */,
8858B82912F9AC6600696670 /* receipt in Resources */,
- 882CFB94131BFF9F009C75A6 /* module.asn1 in Resources */,
- 882CFBAA131BFFAF009C75A6 /* Makefile.am.sample in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -465,31 +321,7 @@
882A8BDB128C349E00D05C94 /* PTHotKey.m in Sources */,
882A8BDC128C349F00D05C94 /* ODBEditor.m in Sources */,
882A8BDD128C349F00D05C94 /* NSAppleEventDescriptor-Extensions.m in Sources */,
- 882CFB8F131BFF8E009C75A6 /* ethernet.c in Sources */,
- 882CFB92131BFF9E009C75A6 /* ber_tlv_length.c in Sources */,
- 882CFB93131BFF9E009C75A6 /* ReceiptAttribute.c in Sources */,
- 882CFB95131BFF9F009C75A6 /* constraints.c in Sources */,
- 882CFB96131BFFA0009C75A6 /* xer_decoder.c in Sources */,
- 882CFB97131BFFA1009C75A6 /* NativeInteger.c in Sources */,
- 882CFB98131BFFA3009C75A6 /* constr_SEQUENCE.c in Sources */,
- 882CFB99131BFFA4009C75A6 /* asn_codecs_prim.c in Sources */,
- 882CFB9A131BFFA4009C75A6 /* xer_support.c in Sources */,
- 882CFB9B131BFFA5009C75A6 /* xer_encoder.c in Sources */,
- 882CFB9C131BFFA6009C75A6 /* der_encoder.c in Sources */,
- 882CFB9D131BFFA7009C75A6 /* constr_TYPE.c in Sources */,
- 882CFB9E131BFFA7009C75A6 /* per_decoder.c in Sources */,
- 882CFB9F131BFFA8009C75A6 /* ber_tlv_tag.c in Sources */,
- 882CFBA0131BFFA9009C75A6 /* per_opentype.c in Sources */,
- 882CFBA1131BFFA9009C75A6 /* per_support.c in Sources */,
- 882CFBA2131BFFAA009C75A6 /* per_encoder.c in Sources */,
- 882CFBA3131BFFAA009C75A6 /* ber_decoder.c in Sources */,
- 882CFBA4131BFFAA009C75A6 /* Payload.c in Sources */,
- 882CFBA5131BFFAC009C75A6 /* constr_SET_OF.c in Sources */,
- 882CFBA6131BFFAD009C75A6 /* OCTET_STRING.c in Sources */,
- 882CFBA7131BFFAE009C75A6 /* asn_SET_OF.c in Sources */,
- 882CFBA8131BFFAE009C75A6 /* INTEGER.c in Sources */,
- 882CFBA9131BFFAF009C75A6 /* BIT_STRING.c in Sources */,
- 882CFBAB131BFFB0009C75A6 /* NativeEnumerated.c in Sources */,
+ 88D3FC48133D0F8B00C2E651 /* ReceiptVerification.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -524,6 +356,7 @@
);
CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application: Jesse Grosjean";
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_PREPROCESSOR_DEFINITIONS = MAS;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
@@ -543,7 +376,6 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = QuickCursor_Prefix.pch;
- GCC_PREPROCESSOR_DEFINITIONS = MAS;
HEADER_SEARCH_PATHS = "${SOURCE_ROOT}/asn1";
INFOPLIST_FILE = "QuickCursor-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
@@ -572,10 +404,6 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = QuickCursor_Prefix.pch;
- GCC_PREPROCESSOR_DEFINITIONS = (
- USE_SAMPLE_RECEIPT,
- MAS,
- );
HEADER_SEARCH_PATHS = "${SOURCE_ROOT}/asn1";
INFOPLIST_FILE = "QuickCursor-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
@@ -596,7 +424,6 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = QuickCursor_Prefix.pch;
- GCC_PREPROCESSOR_DEFINITIONS = MAS;
HEADER_SEARCH_PATHS = "${SOURCE_ROOT}/asn1";
INFOPLIST_FILE = "QuickCursor-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
View
7 QuickCursor.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:QuickCursor.xcodeproj">
+ </FileRef>
+</Workspace>
View
7,697 ...xcodeproj/project.xcworkspace/xcuserdata/jesse.xcuserdatad/UserInterfaceState.xcuserstate
7,697 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 ...r.xcodeproj/project.xcworkspace/xcuserdata/jesse.xcuserdatad/WorkspaceSettings.xcsettings
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
+ <true/>
+ <key>IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges</key>
+ <false/>
+</dict>
+</plist>
View
63 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+ <FileBreakpoints>
+ <FileBreakpoint
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "NPReceiptVerification.m"
+ timestampString = "322770119.005675"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "98"
+ endingLineNumber = "98"
+ landmarkName = "+load"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "NPReceiptVerification.m"
+ timestampString = "322770119.005675"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "106"
+ endingLineNumber = "106"
+ landmarkName = "+load"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "NPReceiptVerification.m"
+ timestampString = "322770119.005675"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "113"
+ endingLineNumber = "113"
+ landmarkName = "+load"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "NPReceiptVerification.m"
+ timestampString = "322770119.005675"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "134"
+ endingLineNumber = "134"
+ landmarkName = "+load"
+ landmarkType = "5">
+ </FileBreakpoint>
+ </FileBreakpoints>
+</Bucket>
View
76 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/QuickCursor MAS.xcscheme
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Distribution"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
76 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/QuickCursor.xcscheme
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
+ BuildableName = "QuickCursor.app"
+ BlueprintName = "QuickCursor"
+ ReferencedContainer = "container:QuickCursor.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
27 QuickCursor.xcodeproj/xcuserdata/jesse.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>QuickCursor MAS.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>1</integer>
+ </dict>
+ <key>QuickCursor.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>8D1107260486CEB800E47090</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
33 ReceiptVerification.h
@@ -0,0 +1,33 @@
+//
+// NPReceiptVerification.h
+//
+// Created by Nick Paulson on 1/15/11.
+// Copyright (c) 2011 Nick Paulson
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface ReceiptVerification : NSObject {
+
+}
+
+@end
View
476 ReceiptVerification.m
@@ -0,0 +1,476 @@
+//
+// NPReceiptVerification.m
+//
+// Created by Nick Paulson on 1/15/11.
+// Copyright (c) 2011 Nick Paulson
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ReceiptVerification.h"
+
+#import <IOKit/IOKitLib.h>
+#import <Foundation/Foundation.h>
+
+#import <Security/Security.h>
+#import <Security/CSCommon.h>
+#import <Security/SecStaticCode.h>
+#import <Security/SecRequirement.h>
+
+#include <openssl/pkcs7.h>
+#include <openssl/objects.h>
+#include <openssl/sha.h>
+#include <openssl/x509.h>
+#include <openssl/err.h>
+
+@interface ReceiptVerification ()
++ (NSData *)systemMACAddress;
++ (NSData *)appleRootCertificateData;
++ (NSDictionary *)appStoreReceiptDictionaryForFile:(NSString *)receiptFilePath;
+@end
+
+//These need to be defined for each application and version
+static NSString * const kReceiptBundleVersion = @"2.3";
+static NSString * const kReceiptBundleIdentifier = @"com.hogbaysoftware.QuickCursor";
+
+static NSString * const kReceiptBundleIdentiferKey = @"BundleIdentifier";
+static NSString * const kReceiptBundleIdentiferDataKey = @"BundleIdentifierData";
+static NSString * const kReceiptVersionKey = @"Version";
+static NSString * const kReceiptOpaqueValueKey = @"OpaqueValue";
+static NSString * const kReceiptHashKey = @"Hash";
+
+@implementation ReceiptVerification
+
++ (void)load {
+
+#ifndef MAS
+ return;
+#endif
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSBundle *appBundle = [NSBundle mainBundle];
+ NSString *appPath = [appBundle bundlePath];
+ NSString *masReceiptPath = [[[appPath stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"_MASReceipt"] stringByAppendingPathComponent:@"receipt"];
+
+ //If the receipt file doesn't exist...
+ if (![[NSFileManager defaultManager] fileExistsAtPath:masReceiptPath]) {
+ exit(173);
+ pool = (NSAutoreleasePool *)1;
+ }
+
+ //Verify code signing identity is something Apple
+ SecStaticCodeRef staticCode = NULL;
+ SecRequirementRef req = NULL;
+
+ char thea = 'a';
+ char theSpace = ' ';
+ char thec = 'c';
+ char thel = 'l';
+ char theh = 'h';
+ char ther = 'r';
+ char thep = 'p';
+ char theo = 'o';
+ char then = 'n';
+ char thee = 'e';
+
+ NSString *anchorString = [NSString stringWithFormat:@"%5$c%9$c%1$c%8$c%6$c%10$c%3$c%5$c%2$c%2$c%7$c%4$c",
+ thec, thep, theSpace, thee, thea, theo, thel, theh, then, ther];
+ anchorString = [anchorString stringByAppendingString:@" generic"];
+
+ OSStatus status = SecStaticCodeCreateWithPath((CFURLRef)[NSURL fileURLWithPath:appPath], kSecCSDefaultFlags, &staticCode);
+ status = SecRequirementCreateWithString((CFStringRef)anchorString, kSecCSDefaultFlags, &req);
+ status = SecStaticCodeCheckValidity(staticCode, kSecCSDefaultFlags, req);
+
+ if(status != noErr) {
+ exit(173);
+ pool = (NSAutoreleasePool *)1;
+ }
+
+ //Verify MAS Receipt
+ NSDictionary *receiptDict = [[self class] appStoreReceiptDictionaryForFile:masReceiptPath];
+
+ if(receiptDict == nil) {
+ exit(173);
+ pool = (NSAutoreleasePool *)1;
+ }
+
+
+ NSData *guidData = [[self class] systemMACAddress];
+ if (guidData == nil) {
+ exit(173);
+ pool = (NSAutoreleasePool *)1;
+ }
+
+ NSAssert([kReceiptBundleVersion isEqualToString:[appBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]],
+ @"CFBundleShortVersionString must match hardcoded version number!");
+ NSAssert([kReceiptBundleIdentifier isEqualToString:[appBundle bundleIdentifier]],
+ @"Bundle identifier must match hardcoded bundle identifier");
+
+ NSMutableData *input = [NSMutableData data];
+ [input appendData:guidData];
+ [input appendData:[receiptDict objectForKey:kReceiptOpaqueValueKey]];
+ [input appendData:[receiptDict objectForKey:kReceiptBundleIdentiferDataKey]];
+
+ NSMutableData *hash = [NSMutableData dataWithLength:SHA_DIGEST_LENGTH];
+ SHA1([input bytes], [input length], [hash mutableBytes]);
+
+ if (!([kReceiptBundleIdentifier isEqualToString:[receiptDict objectForKey:kReceiptBundleIdentiferKey]] &&
+ [kReceiptBundleVersion isEqualToString:[receiptDict objectForKey:kReceiptVersionKey]] &&
+ [hash isEqualToData:[receiptDict objectForKey:kReceiptHashKey]]) )
+ {
+ exit(173);
+ pool = (NSAutoreleasePool *)1;
+ }
+
+ [pool release];
+}
+
++ (NSData *)appleRootCertificateData {
+ OSStatus status;
+
+ SecKeychainRef keychain = nil;
+
+ NSString *rootString = @"Root";
+ NSString *ificatesString = @"ificates";
+ NSString *keychainsString = @"Keychains";
+ NSString *systemString = @"System";
+ NSString *certString = @"Cert";
+
+
+ NSString *pathString = [NSString stringWithFormat:@"/%3$@/Library/%2$@/%3$@%1$@%5$@%4$@.%6$@",
+ rootString, keychainsString, systemString, ificatesString, certString, [[keychainsString lowercaseString] substringWithRange:NSMakeRange(0, [keychainsString length] - 1)]];
+
+ status = SecKeychainOpen([pathString cStringUsingEncoding:NSUTF8StringEncoding], &keychain);
+ if(status) {
+ if(keychain) CFRelease(keychain);
+ return nil;
+ }
+
+ CFArrayRef searchList = CFArrayCreate(kCFAllocatorDefault, (const void**)&keychain, 1, &kCFTypeArrayCallBacks);
+
+ // For some reason we get a malloc reference underflow warning message when garbage collection
+ // is on. Perhaps a bug in SecKeychainOpen where the keychain reference isn't actually retained
+ // in GC?
+#ifndef __OBJC_GC__
+ if (keychain)
+ CFRelease(keychain);
+#endif
+
+ SecKeychainSearchRef searchRef = nil;
+ status = SecKeychainSearchCreateFromAttributes(searchList, kSecCertificateItemClass, NULL, &searchRef);
+ if(status) {
+ if(searchRef) CFRelease(searchRef);
+ if(searchList) CFRelease(searchList);
+ return nil;
+ }
+
+ SecKeychainItemRef itemRef = nil;
+ NSData * resultData = nil;
+
+ char theA = 'A';
+ char thep = 'p';
+ char theC = 'C';
+ char theSpace = ' ';
+ char theR = 'R';
+ char thee = 'e';
+ char theo = 'o';
+ char thel = 'l';
+ char thet = 't';
+
+ NSString *certName = [NSString stringWithFormat:@"%3$c%2$c%2$c%1$c%7$c%9$c%8$c%4$c%4$c%5$c%9$c%6$c%3$c",
+ thel, thep, theA, theo, thet, theC, thee, theR, theSpace];
+
+ while(SecKeychainSearchCopyNext(searchRef, &itemRef) == noErr && resultData == nil) {
+ // Grab the name of the certificate
+ SecKeychainAttributeList list;
+ SecKeychainAttribute attributes[1];
+
+ attributes[0].tag = kSecLabelItemAttr;
+
+ list.count = 1;
+ list.attr = attributes;
+
+ SecKeychainItemCopyContent(itemRef, nil, &list, nil, nil);
+ NSData *nameData = [NSData dataWithBytesNoCopy:attributes[0].data length:attributes[0].length freeWhenDone:NO];
+ NSString *name = [[NSString alloc] initWithData:nameData encoding:NSUTF8StringEncoding];
+
+ if([name isEqualToString:certName]) {
+ CSSM_DATA certData;
+ status = SecCertificateGetData((SecCertificateRef)itemRef, &certData);
+
+ if (!status) {
+ resultData = [NSData dataWithBytes:certData.Data length:certData.Length];
+ }
+ }
+ SecKeychainItemFreeContent(&list, NULL);
+ if(itemRef)
+ CFRelease(itemRef);
+ [name release];
+ }
+ CFRelease(searchList);
+ CFRelease(searchRef);
+
+ return resultData;
+
+}
+
++ (NSData *)systemMACAddress {
+ kern_return_t kernResult;
+ mach_port_t master_port;
+ CFMutableDictionaryRef matchingDict;
+ io_iterator_t iterator;
+ io_object_t service;
+ CFDataRef macAddress = nil;
+
+ kernResult = IOMasterPort(MACH_PORT_NULL, &master_port);
+ if (kernResult != KERN_SUCCESS) {
+ // NSLog("IOMasterPort returned %d", kernResult);
+ return nil;
+ }
+
+ char then = 'n';
+ char thee = 'e';
+ char the0 = '0';
+ NSString *bsdName = [NSString stringWithFormat:@"%2$c%3$c%1$c", the0, thee, then];
+ matchingDict = IOBSDNameMatching(master_port, 0, [bsdName UTF8String]);
+ if(!matchingDict) {
+ // NSLog("IOBSDNameMatching returned empty dictionary");
+ return nil;
+ }
+
+ kernResult = IOServiceGetMatchingServices(master_port, matchingDict, &iterator);
+ if (kernResult != KERN_SUCCESS) {
+ // NSLog("IOServiceGetMatchingServices returned %d", kernResult);
+ return nil;
+ }
+
+ while((service = IOIteratorNext(iterator)) != 0)
+ {
+ io_object_t parentService;
+
+ kernResult = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parentService);
+ if(kernResult == KERN_SUCCESS)
+ {
+ if(macAddress) CFRelease(macAddress);
+ char theO = 'O';
+ char theI = 'I';
+ char thes = 's';
+ char theC = 'C';
+ char ther = 'r';
+ char theM = 'M';
+ char thed = 'd';
+ char theA = 'A';
+
+ NSString *macAddressString = [NSString stringWithFormat:
+ @"%2$c%7$c%5$c%1$c%8$c%1$c%3$c%3$c%6$c%9$c%4$c%4$c", theA, theI, thed, thes, theM, ther, theO, theC, thee];
+ macAddress = IORegistryEntryCreateCFProperty(parentService, (CFStringRef)macAddressString, kCFAllocatorDefault, 0);
+ IOObjectRelease(parentService);
+ }
+ else {
+ //NSLog("IORegistryEntryGetParentEntry returned %d", kernResult);
+ }
+
+ IOObjectRelease(service);
+ }
+
+ return [(NSData *)macAddress autorelease];
+}
+
++ (NSDictionary *)appStoreReceiptDictionaryForFile:(NSString *)receiptFilePath {
+ NSData * rootCertData = [[self class] appleRootCertificateData];
+
+ enum ATTRIBUTES
+ {
+ ATTR_START = 1,
+ BUNDLE_ID,
+ VERSION,
+ OPAQUE_VALUE,
+ HASH,
+ ATTR_END
+ };
+
+ ERR_load_PKCS7_strings();
+ ERR_load_X509_strings();
+ OpenSSL_add_all_digests();
+
+ // Expected input is a PKCS7 container with signed data containing
+ // an ASN.1 SET of SEQUENCE structures. Each SEQUENCE contains
+ // two INTEGERS and an OCTET STRING.
+
+ const char * receiptPath = [[receiptFilePath stringByStandardizingPath] fileSystemRepresentation];
+ FILE *fp = fopen(receiptPath, "rb");
+ if (fp == NULL)
+ return nil;
+
+ PKCS7 *p7 = d2i_PKCS7_fp(fp, NULL);
+ fclose(fp);
+
+ // Check if the receipt file was invalid (otherwise we go crashing and burning)
+ if (p7 == NULL) {
+ return nil;
+ }
+
+ if (!PKCS7_type_is_signed(p7)) {
+ PKCS7_free(p7);
+ return nil;
+ }
+
+ if (!PKCS7_type_is_data(p7->d.sign->contents)) {
+ PKCS7_free(p7);
+ return nil;
+ }
+
+ int verifyReturnValue = 0;
+ X509_STORE *store = X509_STORE_new();
+ if (store)
+ {
+ const unsigned char *data = (unsigned char *)(rootCertData.bytes);
+ X509 *appleCA = d2i_X509(NULL, &data, (long)rootCertData.length);
+ if (appleCA)
+ {
+ BIO *payload = BIO_new(BIO_s_mem());
+ X509_STORE_add_cert(store, appleCA);
+
+ if (payload)
+ {
+ verifyReturnValue = PKCS7_verify(p7,NULL,store,NULL,payload,0);
+ BIO_free(payload);
+ }
+
+ X509_free(appleCA);
+ }
+ X509_STORE_free(store);
+ }
+ EVP_cleanup();
+
+ if (verifyReturnValue != 1)
+ {
+ PKCS7_free(p7);
+ return nil;
+ }
+
+ ASN1_OCTET_STRING *octets = p7->d.sign->contents->d.data;
+ const unsigned char *p = octets->data;
+ const unsigned char *end = p + octets->length;
+
+ int type = 0;
+ int xclass = 0;
+ long length = 0;
+
+ ASN1_get_object(&p, &length, &type, &xclass, end - p);
+ if (type != V_ASN1_SET) {
+ PKCS7_free(p7);
+ return nil;
+ }
+
+ NSMutableDictionary *info = [NSMutableDictionary dictionary];
+
+ while (p < end) {
+ ASN1_get_object(&p, &length, &type, &xclass, end - p);
+ if (type != V_ASN1_SEQUENCE)
+ break;
+
+ const unsigned char *seq_end = p + length;
+
+ int attr_type = 0;
+ int attr_version = 0;
+
+ // Attribute type
+ ASN1_get_object(&p, &length, &type, &xclass, seq_end - p);
+ if (type == V_ASN1_INTEGER && length == 1) {
+ attr_type = p[0];
+ }
+ p += length;
+
+ // Attribute version
+ ASN1_get_object(&p, &length, &type, &xclass, seq_end - p);
+ if (type == V_ASN1_INTEGER && length == 1) {
+ attr_version = p[0];
+ attr_version = attr_version;
+ }
+ p += length;
+
+ // Only parse attributes we're interested in
+ if (attr_type > ATTR_START && attr_type < ATTR_END) {
+ NSString *key;
+
+ ASN1_get_object(&p, &length, &type, &xclass, seq_end - p);
+ if (type == V_ASN1_OCTET_STRING) {
+
+ // Bytes
+ if (attr_type == BUNDLE_ID || attr_type == OPAQUE_VALUE || attr_type == HASH) {
+ NSData *data = [NSData dataWithBytes:p length:(NSUInteger)length];
+
+ switch (attr_type) {
+ case BUNDLE_ID:
+ // This is included for hash generation
+ key = kReceiptBundleIdentiferDataKey;
+ break;
+ case OPAQUE_VALUE:
+ key = kReceiptOpaqueValueKey;
+ break;
+ case HASH:
+ key = kReceiptHashKey;
+ break;
+ }
+
+ [info setObject:data forKey:key];
+ }
+
+ // Strings
+ if (attr_type == BUNDLE_ID || attr_type == VERSION) {
+ int str_type = 0;
+ long str_length = 0;
+ const unsigned char *str_p = p;
+ ASN1_get_object(&str_p, &str_length, &str_type, &xclass, seq_end - str_p);
+ if (str_type == V_ASN1_UTF8STRING) {
+ NSString *string = [[[NSString alloc] initWithBytes:str_p
+ length:(NSUInteger)str_length
+ encoding:NSUTF8StringEncoding] autorelease];
+
+ switch (attr_type) {
+ case BUNDLE_ID:
+ key = kReceiptBundleIdentiferKey;
+ break;
+ case VERSION:
+ key = kReceiptVersionKey;
+ break;
+ }
+
+ [info setObject:string forKey:key];
+ }
+ }
+ }
+ p += length;
+ }
+
+ // Skip any remaining fields in this SEQUENCE
+ while (p < seq_end) {
+ ASN1_get_object(&p, &length, &type, &xclass, seq_end - p);
+ p += length;
+ }
+ }
+
+ PKCS7_free(p7);
+
+ return info;
+}
+
+@end
View
189 asn1/BIT_STRING.c
@@ -1,189 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#include <asn_internal.h>
-#include <BIT_STRING.h>
-#include <asn_internal.h>
-
-/*
- * BIT STRING basic type description.
- */
-static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
- (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
-};
-static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = {
- sizeof(BIT_STRING_t),
- offsetof(BIT_STRING_t, _asn_ctx),
- ASN_OSUBV_BIT
-};
-asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
- "BIT STRING",
- "BIT_STRING",
- OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
- BIT_STRING_print,
- BIT_STRING_constraint,
- OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
- OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
- OCTET_STRING_decode_xer_binary,
- BIT_STRING_encode_xer,
- OCTET_STRING_decode_uper, /* Unaligned PER decoder */
- OCTET_STRING_encode_uper, /* Unaligned PER encoder */
- 0, /* Use generic outmost tag fetcher */
- asn_DEF_BIT_STRING_tags,
- sizeof(asn_DEF_BIT_STRING_tags)
- / sizeof(asn_DEF_BIT_STRING_tags[0]),
- asn_DEF_BIT_STRING_tags, /* Same as above */
- sizeof(asn_DEF_BIT_STRING_tags)
- / sizeof(asn_DEF_BIT_STRING_tags[0]),
- 0, /* No PER visible constraints */
- 0, 0, /* No members */
- &asn_DEF_BIT_STRING_specs
-};
-
-/*
- * BIT STRING generic constraint.
- */
-int
-BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
- asn_app_constraint_failed_f *ctfailcb, void *app_key) {
- const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
-
- if(st && st->buf) {
- if((st->size == 0 && st->bits_unused)
- || st->bits_unused < 0 || st->bits_unused > 7) {
- _ASN_CTFAIL(app_key, td, sptr,
- "%s: invalid padding byte (%s:%d)",
- td->name, __FILE__, __LINE__);
- return -1;
- }
- } else {
- _ASN_CTFAIL(app_key, td, sptr,
- "%s: value not given (%s:%d)",
- td->name, __FILE__, __LINE__);
- return -1;
- }
-
- return 0;
-}
-
-static char *_bit_pattern[16] = {
- "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
- "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"
-};
-
-asn_enc_rval_t
-BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
- asn_app_consume_bytes_f *cb, void *app_key) {
- asn_enc_rval_t er;
- char scratch[128];
- char *p = scratch;
- char *scend = scratch + (sizeof(scratch) - 10);
- const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
- int xcan = (flags & XER_F_CANONICAL);
- uint8_t *buf;
- uint8_t *end;
-
- if(!st || !st->buf)
- _ASN_ENCODE_FAILED;
-
- er.encoded = 0;
-
- buf = st->buf;
- end = buf + st->size - 1; /* Last byte is special */
-
- /*
- * Binary dump
- */
- for(; buf < end; buf++) {
- int v = *buf;
- int nline = xcan?0:(((buf - st->buf) % 8) == 0);
- if(p >= scend || nline) {
- er.encoded += p - scratch;
- _ASN_CALLBACK(scratch, p - scratch);
- p = scratch;
- if(nline) _i_ASN_TEXT_INDENT(1, ilevel);
- }
- memcpy(p + 0, _bit_pattern[v >> 4], 4);
- memcpy(p + 4, _bit_pattern[v & 0x0f], 4);
- p += 8;
- }
-
- if(!xcan && ((buf - st->buf) % 8) == 0)
- _i_ASN_TEXT_INDENT(1, ilevel);
- er.encoded += p - scratch;
- _ASN_CALLBACK(scratch, p - scratch);
- p = scratch;
-
- if(buf == end) {
- int v = *buf;
- int ubits = st->bits_unused;
- int i;
- for(i = 7; i >= ubits; i--)
- *p++ = (v & (1 << i)) ? 0x31 : 0x30;
- er.encoded += p - scratch;
- _ASN_CALLBACK(scratch, p - scratch);
- }
-
- if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1);
-
- _ASN_ENCODED_OK(er);
-cb_failed:
- _ASN_ENCODE_FAILED;
-}
-
-
-/*
- * BIT STRING specific contents printer.
- */
-int
-BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- asn_app_consume_bytes_f *cb, void *app_key) {
- static const char *h2c = "0123456789ABCDEF";
- char scratch[64];
- const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
- uint8_t *buf;
- uint8_t *end;
- char *p = scratch;
-
- (void)td; /* Unused argument */
-
- if(!st || !st->buf)
- return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
-
- ilevel++;
- buf = st->buf;
- end = buf + st->size;
-
- /*
- * Hexadecimal dump.
- */
- for(; buf < end; buf++) {
- if((buf - st->buf) % 16 == 0 && (st->size > 16)
- && buf != st->buf) {
- _i_INDENT(1);
- /* Dump the string */
- if(cb(scratch, p - scratch, app_key) < 0) return -1;
- p = scratch;
- }
- *p++ = h2c[*buf >> 4];
- *p++ = h2c[*buf & 0x0F];
- *p++ = 0x20;
- }
-
- if(p > scratch) {
- p--; /* Eat the tailing space */
-
- if((st->size > 16)) {
- _i_INDENT(1);
- }
-
- /* Dump the incomplete 16-bytes row */
- if(cb(scratch, p - scratch, app_key) < 0)
- return -1;
- }
-
- return 0;
-}
-
View
33 asn1/BIT_STRING.h
@@ -1,33 +0,0 @@
-/*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef _BIT_STRING_H_
-#define _BIT_STRING_H_
-
-#include <OCTET_STRING.h> /* Some help from OCTET STRING */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct BIT_STRING_s {
- uint8_t *buf; /* BIT STRING body */
- int size; /* Size of the above buffer */
-
- int bits_unused;/* Unused trailing bits in the last octet (0..7) */
-
- asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
-} BIT_STRING_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING;
-
-asn_struct_print_f BIT_STRING_print; /* Human-readable output */
-asn_constr_check_f BIT_STRING_constraint;
-xer_type_encoder_f BIT_STRING_encode_xer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BIT_STRING_H_ */
View
934 asn1/INTEGER.c
@@ -1,934 +0,0 @@
-/*-
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#include <asn_internal.h>
-#include <INTEGER.h>
-#include <asn_codecs_prim.h> /* Encoder and decoder of a primitive type */
-#include <errno.h>
-
-/*
- * INTEGER basic type description.
- */
-static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = {
- (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
-};
-asn_TYPE_descriptor_t asn_DEF_INTEGER = {
- "INTEGER",
- "INTEGER",
- ASN__PRIMITIVE_TYPE_free,
- INTEGER_print,
- asn_generic_no_constraint,
- ber_decode_primitive,
- INTEGER_encode_der,
- INTEGER_decode_xer,
- INTEGER_encode_xer,
- INTEGER_decode_uper, /* Unaligned PER decoder */
- INTEGER_encode_uper, /* Unaligned PER encoder */
- 0, /* Use generic outmost tag fetcher */
- asn_DEF_INTEGER_tags,
- sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]),
- asn_DEF_INTEGER_tags, /* Same as above */
- sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]),
- 0, /* No PER visible constraints */
- 0, 0, /* No members */
- 0 /* No specifics */
-};
-
-/*
- * Encode INTEGER type using DER.
- */
-asn_enc_rval_t
-INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
- int tag_mode, ber_tlv_tag_t tag,
- asn_app_consume_bytes_f *cb, void *app_key) {
- INTEGER_t *st = (INTEGER_t *)sptr;
-
- ASN_DEBUG("%s %s as INTEGER (tm=%d)",
- cb?"Encoding":"Estimating", td->name, tag_mode);
-
- /*
- * Canonicalize integer in the buffer.
- * (Remove too long sign extension, remove some first 0x00 bytes)
- */
- if(st->buf) {
- uint8_t *buf = st->buf;
- uint8_t *end1 = buf + st->size - 1;
- int shift;
-
- /* Compute the number of superfluous leading bytes */
- for(; buf < end1; buf++) {
- /*
- * If the contents octets of an integer value encoding
- * consist of more than one octet, then the bits of the
- * first octet and bit 8 of the second octet:
- * a) shall not all be ones; and
- * b) shall not all be zero.
- */
- switch(*buf) {
- case 0x00: if((buf[1] & 0x80) == 0)
- continue;
- break;
- case 0xff: if((buf[1] & 0x80))
- continue;
- break;
- }
- break;
- }
-
- /* Remove leading superfluous bytes from the integer */
- shift = buf - st->buf;
- if(shift) {
- uint8_t *nb = st->buf;
- uint8_t *end;
-
- st->size -= shift; /* New size, minus bad bytes */
- end = nb + st->size;
-
- for(; nb < end; nb++, buf++)
- *nb = *buf;
- }
-
- } /* if(1) */
-
- return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key);
-}
-
-static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop);
-
-/*
- * INTEGER specific human-readable output.
- */
-static ssize_t
-INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
- asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
- char scratch[32]; /* Enough for 64-bit integer */
- uint8_t *buf = st->buf;
- uint8_t *buf_end = st->buf + st->size;
- signed long accum;
- ssize_t wrote = 0;
- char *p;
- int ret;
-
- /*
- * Advance buf pointer until the start of the value's body.
- * This will make us able to process large integers using simple case,
- * when the actual value is small
- * (0x0000000000abcdef would yield a fine 0x00abcdef)
- */
- /* Skip the insignificant leading bytes */
- for(; buf < buf_end-1; buf++) {
- switch(*buf) {
- case 0x00: if((buf[1] & 0x80) == 0) continue; break;
- case 0xff: if((buf[1] & 0x80) != 0) continue; break;
- }
- break;
- }
-
- /* Simple case: the integer size is small */
- if((size_t)(buf_end - buf) <= sizeof(accum)) {
- const asn_INTEGER_enum_map_t *el;
- size_t scrsize;
- char *scr;
-
- if(buf == buf_end) {
- accum = 0;
- } else {
- accum = (*buf & 0x80) ? -1 : 0;
- for(; buf < buf_end; buf++)
- accum = (accum << 8) | *buf;
- }
-
- el = INTEGER_map_value2enum(specs, accum);
- if(el) {
- scrsize = el->enum_len + 32;
- scr = (char *)alloca(scrsize);
- if(plainOrXER == 0)
- ret = snprintf(scr, scrsize,
- "%ld (%s)", accum, el->enum_name);
- else
- ret = snprintf(scr, scrsize,
- "<%s/>", el->enum_name);
- } else if(plainOrXER && specs && specs->strict_enumeration) {
- ASN_DEBUG("ASN.1 forbids dealing with "
- "unknown value of ENUMERATED type");
- errno = EPERM;
- return -1;
- } else {
- scrsize = sizeof(scratch);
- scr = scratch;
- ret = snprintf(scr, scrsize,
- (specs && specs->field_unsigned)
- ?"%lu":"%ld", accum);
- }
- assert(ret > 0 && (size_t)ret < scrsize);
- return (cb(scr, ret, app_key) < 0) ? -1 : ret;
- } else if(plainOrXER && specs && specs->strict_enumeration) {
- /*
- * Here and earlier, we cannot encode the ENUMERATED values
- * if there is no corresponding identifier.
- */
- ASN_DEBUG("ASN.1 forbids dealing with "
- "unknown value of ENUMERATED type");
- errno = EPERM;
- return -1;
- }
-
- /* Output in the long xx:yy:zz... format */
- /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */
- for(p = scratch; buf < buf_end; buf++) {
- static const char *h2c = "0123456789ABCDEF";
- if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) {
- /* Flush buffer */
- if(cb(scratch, p - scratch, app_key) < 0)
- return -1;
- wrote += p - scratch;
- p = scratch;
- }
- *p++ = h2c[*buf >> 4];
- *p++ = h2c[*buf & 0x0F];
- *p++ = 0x3a; /* ":" */
- }
- if(p != scratch)
- p--; /* Remove the last ":" */
-
- wrote += p - scratch;
- return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote;
-}
-
-/*
- * INTEGER specific human-readable output.
- */
-int
-INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- asn_app_consume_bytes_f *cb, void *app_key) {
- const INTEGER_t *st = (const INTEGER_t *)sptr;
- ssize_t ret;
-
- (void)td;
- (void)ilevel;
-
- if(!st || !st->buf)
- ret = cb("<absent>", 8, app_key);
- else
- ret = INTEGER__dump(td, st, cb, app_key, 0);
-
- return (ret < 0) ? -1 : 0;
-}
-
-struct e2v_key {
- const char *start;
- const char *stop;
- asn_INTEGER_enum_map_t *vemap;
- unsigned int *evmap;
-};
-static int
-INTEGER__compar_enum2value(const void *kp, const void *am) {
- const struct e2v_key *key = (const struct e2v_key *)kp;
- const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am;
- const char *ptr, *end, *name;
-
- /* Remap the element (sort by different criterion) */
- el = key->vemap + key->evmap[el - key->vemap];
-
- /* Compare strings */
- for(ptr = key->start, end = key->stop, name = el->enum_name;
- ptr < end; ptr++, name++) {
- if(*ptr != *name)
- return *(const unsigned char *)ptr
- - *(const unsigned char *)name;
- }
- return name[0] ? -1 : 0;
-}
-
-static const asn_INTEGER_enum_map_t *
-INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) {
- asn_INTEGER_enum_map_t *el_found;
- int count = specs ? specs->map_count : 0;
- struct e2v_key key;
- const char *lp;
-
- if(!count) return NULL;
-
- /* Guaranteed: assert(lstart < lstop); */
- /* Figure out the tag name */
- for(lstart++, lp = lstart; lp < lstop; lp++) {
- switch(*lp) {
- case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */
- case 0x2f: /* '/' */ case 0x3e: /* '>' */
- break;
- default:
- continue;
- }
- break;
- }
- if(lp == lstop) return NULL; /* No tag found */
- lstop = lp;
-
- key.start = lstart;
- key.stop = lstop;
- key.vemap = specs->value2enum;
- key.evmap = specs->enum2value;
- el_found = (asn_INTEGER_enum_map_t *)bsearch(&key,
- specs->value2enum, count, sizeof(specs->value2enum[0]),
- INTEGER__compar_enum2value);
- if(el_found) {
- /* Remap enum2value into value2enum */
- el_found = key.vemap + key.evmap[el_found - key.vemap];
- }
- return el_found;
-}
-
-static int
-INTEGER__compar_value2enum(const void *kp, const void *am) {
- long a = *(const long *)kp;
- const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am;
- long b = el->nat_value;
- if(a < b) return -1;
- else if(a == b) return 0;
- else return 1;
-}
-
-const asn_INTEGER_enum_map_t *
-INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) {
- int count = specs ? specs->map_count : 0;
- if(!count) return 0;
- return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum,
- count, sizeof(specs->value2enum[0]),
- INTEGER__compar_value2enum);
-}
-
-static int
-INTEGER_st_prealloc(INTEGER_t *st, int min_size) {
- void *p = MALLOC(min_size + 1);
- if(p) {
- void *b = st->buf;
- st->size = 0;
- st->buf = p;
- FREEMEM(b);
- return 0;
- } else {
- return -1;
- }
-}
-
-/*
- * Decode the chunk of XML text encoding INTEGER.
- */
-static enum xer_pbd_rval
-INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
- INTEGER_t *st = (INTEGER_t *)sptr;
- long sign = 1;
- long value;
- const char *lp;
- const char *lstart = (const char *)chunk_buf;
- const char *lstop = lstart + chunk_size;
- enum {
- ST_SKIPSPACE,
- ST_SKIPSPHEX,
- ST_WAITDIGITS,
- ST_DIGITS,
- ST_HEXDIGIT1,
- ST_HEXDIGIT2,
- ST_HEXCOLON,
- ST_EXTRASTUFF
- } state = ST_SKIPSPACE;
-
- if(chunk_size)
- ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x",
- (long)chunk_size, *lstart, lstop[-1]);
-
- /*
- * We may have received a tag here. It will be processed inline.
- * Use strtoul()-like code and serialize the result.
- */
- for(value = 0, lp = lstart; lp < lstop; lp++) {
- int lv = *lp;
- switch(lv) {
- case 0x09: case 0x0a: case 0x0d: case 0x20:
- switch(state) {
- case ST_SKIPSPACE:
- case ST_SKIPSPHEX:
- continue;
- case ST_HEXCOLON:
- if(xer_is_whitespace(lp, lstop - lp)) {
- lp = lstop - 1;
- continue;
- }
- break;
- default:
- break;
- }
- break;
- case 0x2d: /* '-' */
- if(state == ST_SKIPSPACE) {
- sign = -1;
- state = ST_WAITDIGITS;
- continue;
- }
- break;
- case 0x2b: /* '+' */
- if(state == ST_SKIPSPACE) {
- state = ST_WAITDIGITS;
- continue;
- }
- break;
- case 0x30: case 0x31: case 0x32: case 0x33: case 0x34:
- case 0x35: case 0x36: case 0x37: case 0x38: case 0x39:
- switch(state) {
- case ST_DIGITS: break;
- case ST_SKIPSPHEX: /* Fall through */
- case ST_HEXDIGIT1:
- value = (lv - 0x30) << 4;
- state = ST_HEXDIGIT2;
- continue;
- case ST_HEXDIGIT2:
- value += (lv - 0x30);
- state = ST_HEXCOLON;
- st->buf[st->size++] = (uint8_t)value;
- continue;
- case ST_HEXCOLON:
- return XPBD_BROKEN_ENCODING;
- default:
- state = ST_DIGITS;
- break;
- }
-
- {
- long new_value = value * 10;
-
- if(new_value / 10 != value)
- /* Overflow */
- return XPBD_DECODER_LIMIT;
-
- value = new_value + (lv - 0x30);
- /* Check for two's complement overflow */
- if(value < 0) {
- /* Check whether it is a LONG_MIN */
- if(sign == -1
- && (unsigned long)value
- == ~((unsigned long)-1 >> 1)) {
- sign = 1;
- } else {
- /* Overflow */
- return XPBD_DECODER_LIMIT;
- }
- }
- }
- continue;
- case 0x3c: /* '<' */
- if(state == ST_SKIPSPACE) {
- const asn_INTEGER_enum_map_t *el;
- el = INTEGER_map_enum2value(
- (asn_INTEGER_specifics_t *)
- td->specifics, lstart, lstop);
- if(el) {
- ASN_DEBUG("Found \"%s\" => %ld",
- el->enum_name, el->nat_value);
- state = ST_DIGITS;
- value = el->nat_value;
- lp = lstop - 1;
- continue;
- }
- ASN_DEBUG("Unknown identifier for INTEGER");
- }
- return XPBD_BROKEN_ENCODING;
- case 0x3a: /* ':' */
- if(state == ST_HEXCOLON) {
- /* This colon is expected */
- state = ST_HEXDIGIT1;
- continue;
- } else if(state == ST_DIGITS) {
- /* The colon here means that we have
- * decoded the first two hexadecimal
- * places as a decimal value.
- * Switch decoding mode. */
- ASN_DEBUG("INTEGER re-evaluate as hex form");
- if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
- return XPBD_SYSTEM_FAILURE;
- state = ST_SKIPSPHEX;
- lp = lstart - 1;
- continue;
- } else {
- ASN_DEBUG("state %d at %d", state, lp - lstart);
- break;
- }
- /* [A-Fa-f] */
- case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46:
- case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66:
- switch(state) {
- case ST_SKIPSPHEX:
- case ST_SKIPSPACE: /* Fall through */
- case ST_HEXDIGIT1:
- value = lv - ((lv < 0x61) ? 0x41 : 0x61);
- value += 10;
- value <<= 4;
- state = ST_HEXDIGIT2;
- continue;
- case ST_HEXDIGIT2:
- value += lv - ((lv < 0x61) ? 0x41 : 0x61);
- value += 10;
- st->buf[st->size++] = (uint8_t)value;
- state = ST_HEXCOLON;
- continue;
- case ST_DIGITS:
- ASN_DEBUG("INTEGER re-evaluate as hex form");
- if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
- return XPBD_SYSTEM_FAILURE;
- state = ST_SKIPSPHEX;
- lp = lstart - 1;
- continue;
- default:
- break;
- }
- break;
- }
-
- /* Found extra non-numeric stuff */
- ASN_DEBUG("Found non-numeric 0x%2x at %d",
- lv, lp - lstart);
- state = ST_EXTRASTUFF;
- break;
- }
-
- switch(state) {
- case ST_DIGITS:
- /* Everything is cool */
- break;
- case ST_HEXCOLON:
- st->buf[st->size] = 0; /* Just in case termination */
- return XPBD_BODY_CONSUMED;
- case ST_HEXDIGIT1:
- case ST_HEXDIGIT2:
- case ST_SKIPSPHEX:
- return XPBD_BROKEN_ENCODING;
- default:
- if(xer_is_whitespace(lp, lstop - lp)) {
- if(state != ST_EXTRASTUFF)
- return XPBD_NOT_BODY_IGNORE;
- break;
- } else {
- ASN_DEBUG("INTEGER: No useful digits (state %d)",
- state);
- return XPBD_BROKEN_ENCODING; /* No digits */
- }
- break;
- }
-
- value *= sign; /* Change sign, if needed */
-
- if(asn_long2INTEGER(st, value))
- return XPBD_SYSTEM_FAILURE;
-
- return XPBD_BODY_CONSUMED;
-}
-
-asn_dec_rval_t
-INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
- asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
- const void *buf_ptr, size_t size) {
-
- return xer_decode_primitive(opt_codec_ctx, td,
- sptr, sizeof(INTEGER_t), opt_mname,
- buf_ptr, size, INTEGER__xer_body_decode);
-}
-
-asn_enc_rval_t
-INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
- asn_app_consume_bytes_f *cb, void *app_key) {
- const INTEGER_t *st = (const INTEGER_t *)sptr;
- asn_enc_rval_t er;
-
- (void)ilevel;
- (void)flags;
-
- if(!st || !st->buf)
- _ASN_ENCODE_FAILED;
-
- er.encoded = INTEGER__dump(td, st, cb, app_key, 1);
- if(er.encoded < 0) _ASN_ENCODE_FAILED;
-
- _ASN_ENCODED_OK(er);
-}
-
-asn_dec_rval_t
-INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
- asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
- asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
- asn_dec_rval_t rval = { RC_OK, 0 };
- INTEGER_t *st = (INTEGER_t *)*sptr;
- asn_per_constraint_t *ct;
- int repeat;
-
- (void)opt_codec_ctx;
-
- if(!st) {
- st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st)));
- if(!st) _ASN_DECODE_FAILED;
- }
-
- if(!constraints) constraints = td->per_constraints;
- ct = constraints ? &constraints->value : 0;
-
- if(ct && ct->flags & APC_EXTENSIBLE) {
- int inext = per_get_few_bits(pd, 1);
- if(inext < 0) _ASN_DECODE_STARVED;
- if(inext) ct = 0;
- }
-
- FREEMEM(st->buf);
- st->buf = 0;
- st->size = 0;
- if(ct) {
- if(ct->flags & APC_SEMI_CONSTRAINED) {
- st->buf = (uint8_t *)CALLOC(1, 2);
- if(!st->buf) _ASN_DECODE_FAILED;
- st->size = 1;
- } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) {
- size_t size = (ct->range_bits + 7) >> 3;
- st->buf = (uint8_t *)MALLOC(1 + size + 1);
- if(!st->buf) _ASN_DECODE_FAILED;
- st->size = size;
- }
- }
-
- /* X.691, #12.2.2 */
- if(ct && ct->flags != APC_UNCONSTRAINED) {
- /* #10.5.6 */
- ASN_DEBUG("Integer with range %d bits", ct->range_bits);
- if(ct->range_bits >= 0) {
- long value;
- if(ct->range_bits == 32) {
- long lhalf;
- value = per_get_few_bits(pd, 16);
- if(value < 0) _ASN_DECODE_STARVED;
- lhalf = per_get_few_bits(pd, 16);
- if(lhalf < 0) _ASN_DECODE_STARVED;
- value = (value << 16) | lhalf;
- } else {
- value = per_get_few_bits(pd, ct->range_bits);
- if(value < 0) _ASN_DECODE_STARVED;
- }
- ASN_DEBUG("Got value %ld + low %ld",
- value, ct->lower_bound);
- value += ct->lower_bound;
- if((specs && specs->field_unsigned)
- ? asn_ulong2INTEGER(st, value)
- : asn_long2INTEGER(st, value))
- _ASN_DECODE_FAILED;
- return rval;
- }
- } else {
- ASN_DEBUG("Decoding unconstrained integer %s", td->name);
- }
-
- /* X.691, #12.2.3, #12.2.4 */
- do {
- ssize_t len;
- void *p;
- int ret;
-
- /* Get the PER length */
- len = uper_get_length(pd, -1, &repeat);
- if(len < 0) _ASN_DECODE_STARVED;
-
- p = REALLOC(st->buf, st->size + len + 1);
- if(!p) _ASN_DECODE_FAILED;
- st->buf = (uint8_t *)p;
-
- ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len);
- if(ret < 0) _ASN_DECODE_STARVED;
- st->size += len;
- } while(repeat);
- st->buf[st->size] = 0; /* JIC */
-
- /* #12.2.3 */
- if(ct && ct->lower_bound) {
- /*
- * TODO: replace by in-place arithmetics.
- */
- long value;
- if(asn_INTEGER2long(st, &value))
- _ASN_DECODE_FAILED;
- if(asn_long2INTEGER(st, value + ct->lower_bound))
- _ASN_DECODE_FAILED;
- }
-
- return rval;
-}
-
-asn_enc_rval_t
-INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
- asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
- asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
- asn_enc_rval_t er;
- INTEGER_t *st = (INTEGER_t *)sptr;
- const uint8_t *buf;
- const uint8_t *end;
- asn_per_constraint_t *ct;
- long value = 0;
-
- if(!st || st->size == 0) _ASN_ENCODE_FAILED;
-
- if(!constraints) constraints = td->per_constraints;
- ct = constraints ? &constraints->value : 0;
-
- er.encoded = 0;
-
- if(ct) {
- int inext = 0;
- if(specs && specs->field_unsigned) {
- unsigned long uval;
- if(asn_INTEGER2ulong(st, &uval))
- _ASN_ENCODE_FAILED;
- /* Check proper range */
- if(ct->flags & APC_SEMI_CONSTRAINED) {
- if(uval < (unsigned long)ct->lower_bound)
- inext = 1;
- } else if(ct->range_bits >= 0) {
- if(uval < (unsigned long)ct->lower_bound
- || uval > (unsigned long)ct->upper_bound)
- inext = 1;
- }
- ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s",
- uval, st->buf[0], st->size,
- ct->lower_bound, ct->upper_bound,
- inext ? "ext" : "fix");
- value = uval;
- } else {
- if(asn_INTEGER2long(st, &value))
- _ASN_ENCODE_FAILED;
- /* Check proper range */
- if(ct->flags & APC_SEMI_CONSTRAINED) {
- if(value < ct->lower_bound)
- inext = 1;
- } else if(ct->range_bits >= 0) {
- if(value < ct->lower_bound
- || value > ct->upper_bound)
- inext = 1;
- }
- ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s",
- value, st->buf[0], st->size,
- ct->lower_bound, ct->upper_bound,
- inext ? "ext" : "fix");
- }
- if(ct->flags & APC_EXTENSIBLE) {
- if(per_put_few_bits(po, inext, 1))
- _ASN_ENCODE_FAILED;
- if(inext) ct = 0;
- } else if(inext) {
- _ASN_ENCODE_FAILED;
- }
- }
-
-
- /* X.691, #12.2.2 */
- if(ct && ct->range_bits >= 0) {
- /* #10.5.6 */
- ASN_DEBUG("Encoding integer with range %d bits",
- ct->range_bits);
- if(ct->range_bits == 32) {
- /* TODO: extend to >32 bits */
- long v = value - ct->lower_bound;
- if(per_put_few_bits(po, v >> 1, 31)
- || per_put_few_bits(po, v, 1))
- _ASN_ENCODE_FAILED;
- } else {
- if(per_put_few_bits(po, value - ct->lower_bound,
- ct->range_bits))
- _ASN_ENCODE_FAILED;
- }
- _ASN_ENCODED_OK(er);
- }
-
- if(ct && ct->lower_bound) {
- ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound);
- /* TODO: adjust lower bound */
- _ASN_ENCODE_FAILED;
- }
-
- for(buf = st->buf, end = st->buf + st->size; buf < end;) {
- ssize_t mayEncode = uper_put_length(po, end - buf);
- if(mayEncode < 0)
- _ASN_ENCODE_FAILED;
- if(per_put_many_bits(po, buf, 8 * mayEncode))
- _ASN_ENCODE_FAILED;
- buf += mayEncode;
- }
-
- _ASN_ENCODED_OK(er);
-}
-
-int
-asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
- uint8_t *b, *end;
- size_t size;
- long l;
-
- /* Sanity checking */
- if(!iptr || !iptr->buf || !lptr) {
- errno = EINVAL;
- return -1;
- }
-
- /* Cache the begin/end of the buffer */
- b = iptr->buf; /* Start of the INTEGER buffer */
- size = iptr->size;
- end = b + size; /* Where to stop */
-
- if(size > sizeof(long)) {
- uint8_t *end1 = end - 1;
- /*
- * Slightly more advanced processing,
- * able to >sizeof(long) bytes,
- * when the actual value is small
- * (0x0000000000abcdef would yield a fine 0x00abcdef)
- */
- /* Skip out the insignificant leading bytes */
- for(; b < end1; b++) {
- switch(*b) {
- case 0x00: if((b[1] & 0x80) == 0) continue; break;
- case 0xff: if((b[1] & 0x80) != 0) continue; break;
- }
- break;
- }
-
- size = end - b;
- if(size > sizeof(long)) {
- /* Still cannot fit the long */
- errno = ERANGE;
- return -1;
- }
- }
-
- /* Shortcut processing of a corner case */
- if(end == b) {
- *lptr = 0;
- return 0;
- }
-
- /* Perform the sign initialization */
- /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */
- if((*b >> 7)) l = -1; else l = 0;
-
- /* Conversion engine */
- for(; b < end; b++)
- l = (l << 8) | *b;
-
- *lptr = l;
- return 0;
-}
-
-int
-asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
- uint8_t *b, *end;
- unsigned long l;
- size_t size;
-
- if(!iptr || !iptr->buf || !lptr) {
- errno = EINVAL;
- return -1;
- }
-
- b = iptr->buf;
- size = iptr->size;
- end = b + size;
-
- /* If all extra leading bytes are zeroes, ignore them */
- for(; size > sizeof(unsigned long); b++, size--) {
- if(*b) {
- /* Value won't fit unsigned long */
- errno = ERANGE;
- return -1;
- }
- }
-
- /* Conversion engine */
- for(l = 0; b < end; b++)
- l = (l << 8) | *b;
-
- *lptr = l;
- return 0;
-}
-
-int
-asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
- uint8_t *buf;
- uint8_t *end;
- uint8_t *b;
- int shr;
-
- if(value <= LONG_MAX)
- return asn_long2INTEGER(st, value);
-
- buf = (uint8_t *)MALLOC(1 + sizeof(value));
- if(!buf) return -1;
-
- end = buf + (sizeof(value) + 1);
- buf[0] = 0;
- for(b = buf, shr = (sizeof(long)-1)*8; b < end; shr -= 8)
- *(++b) = (uint8_t)(value >> shr);
-
- if(st->buf) FREEMEM(st->buf);
- st->buf = buf;
- st->size = 1 + sizeof(value);
-
- return 0;
-}
-
-int
-asn_long2INTEGER(INTEGER_t *st, long value) {
- uint8_t *buf, *bp;
- uint8_t *p;
- uint8_t *pstart;
- uint8_t *pend1;
- int littleEndian = 1; /* Run-time detection */
- int add;
-
- if(!st) {
- errno = EINVAL;
- return -1;
- }
-
- buf = (uint8_t *)MALLOC(sizeof(value));
- if(!buf) return -1;
-
- if(*(char *)&littleEndian) {
- pstart = (uint8_t *)&value + sizeof(value) - 1;
- pend1 = (uint8_t *)&value;
- add = -1;
- } else {
- pstart = (uint8_t *)&value;
- pend1 = pstart + sizeof(value) - 1;
- add = 1;
- }
-
- /*
- * If the contents octet consists of more than one octet,
- * then bits of the first octet and bit 8 of the second octet:
- * a) shall not all be ones; and
- * b) shall not all be zero.
- */
- for(p = pstart; p != pend1; p += add) {
- switch(*p) {
- case 0x00: if((*(p+add) & 0x80) == 0)
- continue;
- break;
- case 0xff: if((*(p+add) & 0x80))
- continue;
- break;
- }
- break;
- }
- /* Copy the integer body */
- for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
- *bp++ = *p;
-
- if(st->buf) FREEMEM(st->buf);
- st->buf = buf;
- st->size = bp - buf;
-
- return 0;
-}
View
69 asn1/INTEGER.h
@@ -1,69 +0,0 @@
-/*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef _INTEGER_H_
-#define _INTEGER_H_
-
-#include <asn_application.h>
-#include <asn_codecs_prim.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
-
-extern asn_TYPE_descriptor_t asn_DEF_INTEGER;
-
-/* Map with <tag> to integer value association */
-typedef struct asn_INTEGER_enum_map_s {
- long nat_value; /* associated native integer value */
- size_t enum_len; /* strlen("tag") */
- const char *enum_name; /* "tag" */
-} asn_INTEGER_enum_map_t;
-
-/* This type describes an enumeration for INTEGER and ENUMERATED types */
-typedef struct asn_INTEGER_specifics_s {
- asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */
- unsigned int *enum2value; /* "tag" => N; sorted by tag */
- int map_count; /* Elements in either map */
- int extension; /* This map is extensible */
- int strict_enumeration; /* Enumeration set is fixed */
- int field_width; /* Size of native integer */
- int field_unsigned; /* Signed=0, unsigned=1 */
-} asn_INTEGER_specifics_t;
-
-asn_struct_print_f INTEGER_print;
-ber_type_decoder_f INTEGER_decode_ber;
-der_type_encoder_f INTEGER_encode_der;
-xer_type_decoder_f INTEGER_decode_xer;
-xer_type_encoder_f INTEGER_encode_xer;
-per_type_decoder_f INTEGER_decode_uper;
-per_type_encoder_f INTEGER_encode_uper;
-
-/***********************************
- * Some handy conversion routines. *
- ***********************************/
-
-/*
- * Returns 0 if it was possible to convert, -1 otherwise.
- * -1/EINVAL: Mandatory argument missing
- * -1/ERANGE: Value encoded is out of range for long representation
- * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
- */
-int asn_INTEGER2long(const INTEGER_t *i, long *l);
-int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
-int asn_long2INTEGER(INTEGER_t *i, long l);
-int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);
-
-/*
- * Convert the integer value into the corresponding enumeration map entry.
- */
-const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _INTEGER_H_ */
View
88 asn1/Makefile.am.sample
@@ -1,88 +0,0 @@
-ASN_MODULE_SOURCES= \
- ReceiptAttribute.c \
- Payload.c
-
-ASN_MODULE_HEADERS= \
- ReceiptAttribute.h \
- Payload.h
-
-ASN_MODULE_HEADERS+=INTEGER.h
-ASN_MODULE_HEADERS+=NativeEnumerated.h
-ASN_MODULE_SOURCES+=INTEGER.c
-ASN_MODULE_SOURCES+=NativeEnumerated.c
-ASN_MODULE_HEADERS+=NativeInteger.h
-ASN_MODULE_SOURCES+=NativeInteger.c
-ASN_MODULE_HEADERS+=asn_SET_OF.h
-ASN_MODULE_SOURCES+=asn_SET_OF.c
-ASN_MODULE_HEADERS+=constr_SEQUENCE.h
-ASN_MODULE_SOURCES+=constr_SEQUENCE.c
-ASN_MODULE_HEADERS+=constr_SET_OF.h
-ASN_MODULE_SOURCES+=constr_SET_OF.c
-ASN_MODULE_HEADERS+=asn_application.h
-ASN_MODULE_HEADERS+=asn_system.h
-ASN_MODULE_HEADERS+=asn_codecs.h
-ASN_MODULE_HEADERS+=asn_internal.h
-ASN_MODULE_HEADERS+=OCTET_STRING.h
-ASN_MODULE_SOURCES+=OCTET_STRING.c
-ASN_MODULE_HEADERS+=BIT_STRING.h
-ASN_MODULE_SOURCES+=BIT_STRING.c
-ASN_MODULE_SOURCES+=asn_codecs_prim.c
-ASN_MODULE_HEADERS+=asn_codecs_prim.h
-ASN_MODULE_HEADERS+=ber_tlv_length.h
-ASN_MODULE_SOURCES+=ber_tlv_length.c
-ASN_MODULE_HEADERS+=ber_tlv_tag.h
-ASN_MODULE_SOURCES+=ber_tlv_tag.c
-ASN_MODULE_HEADERS+=ber_decoder.h
-ASN_MODULE_SOURCES+=ber_decoder.c
-ASN_MODULE_HEADERS+=der_encoder.h
-ASN_MODULE_SOURCES+=der_encoder.c
-ASN_MODULE_HEADERS+=constr_TYPE.h
-ASN_MODULE_SOURCES+=constr_TYPE.c
-ASN_MODULE_HEADERS+=constraints.h
-ASN_MODULE_SOURCES+=constraints.c
-ASN_MODULE_HEADERS+=xer_support.h
-ASN_MODULE_SOURCES+=xer_support.c
-ASN_MODULE_HEADERS+=xer_decoder.h
-ASN_MODULE_SOURCES+=xer_decoder.c
-ASN_MODULE_HEADERS+=xer_encoder.h
-ASN_MODULE_SOURCES+=xer_encoder.c
-ASN_MODULE_HEADERS+=per_support.h
-ASN_MODULE_SOURCES+=per_support.c
-ASN_MODULE_HEADERS+=per_decoder.h
-ASN_MODULE_SOURCES+=per_decoder.c
-ASN_MODULE_HEADERS+=per_encoder.h
-ASN_MODULE_SOURCES+=per_encoder.c
-ASN_MODULE_HEADERS+=per_opentype.h
-ASN_MODULE_SOURCES+=per_opentype.c
-ASN_CONVERTER_SOURCES+=converter-sample.c
-
-
-lib_LTLIBRARIES=libsomething.la
-libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)
-
-# This fil